public MainPage(IApiController apiController) { InitializeComponent(); //_apiController = apiController; pageModel = new MainPageModel(this); BindingContext = pageModel; }
public SearchForMovieByTitleCommand( ICommonDataViewModel commonData, IApiController apiController) { _commonData = commonData; _apiController = apiController; }
public ScanForLocalMovieFilesCommand( ICommonDataViewModel commonData, IApiController apiController, IFileController fileController) { _commonData = commonData; _apiController = apiController; _fileController = fileController; }
public void ExposeToApi(IApiController apiController) { if (apiController == null) { throw new ArgumentNullException(nameof(apiController)); } apiController.RouteCommand("personalAgent", HandleCommand); }
public void ExposeToApi(IApiController apiController) { if (apiController == null) { throw new ArgumentNullException(nameof(apiController)); } apiController.RouteRequest("trace", HandleApiGet); }
public void SetUp() { IMComConfigRepository iMComConfigRepository = new MComConfigRepository(); apiController = new ApiController(iMComConfigRepository.GetMComConfig(), new OAuthAuthentication(iMComConfigRepository.GetMComConfig(), new CerteficateReader(), SecurityProtocolType.Tls12), new RestClient()); }
public void ExposeToApi(IApiController apiController) { if (apiController == null) { throw new ArgumentNullException(nameof(apiController)); } apiController.RouteRequest($"component/{_component.Id}/history", HandleApiRequest); apiController.RouteCommand($"component/{_component.Id}/history", HandleApiCommand); }
private void HandleRequest(HttpListenerContext ctx, List <string> el, Dictionary <string, string> urlParams) { string url = "/"; IRequest request = new Request(ctx, DataProvider, AuthenticationProvider, urlParams); string[] splitUrl = ctx.Request.Url?.LocalPath.TrimStart('/').TrimEnd('/').Split("/"); for (int i = 0; i < el.Count; i++) { if (el[i].StartsWith(":")) { url += $":{el[i].TrimStart(':')}/"; } else { url += $"{splitUrl[i]}/"; } } IApiController controller = Controllers[url.TrimEnd('/')]; switch (ctx.Request.HttpMethod.ToUpper()) { case "GET": { controller.Get(request); break; } case "POST": { controller.Post(request); break; } case "PUT": { controller.Put(request); break; } case "PATCH": { controller.Patch(request); break; } case "DELETE": { controller.Delete(request); break; } } }
public void ProcessRequest() { String controllername = m_requestContext.RouteData.Controller; IApiController controller = m_controllerFactory.CreateController(controllername); if (controller == null) { return; } controller.Execute(m_requestContext); }
private static IApiController GetApiController() { if (_iApiController == null) { IMComConfigRepository iMComConfigRepository = new MComConfigRepository(); _iApiController = new ApiController(iMComConfigRepository.GetMComConfig(), new OAuthAuthentication(iMComConfigRepository.GetMComConfig(), new CerteficateReader(), SecurityProtocolType.Tls12), new RestyClient(new MscMcomRequestRepository(), new RestClient())); } return(_iApiController); }
public OpenWeatherMapWeatherStationApiDispatcher(OpenWeatherMapService weatherStation, IApiController apiController) { if (weatherStation == null) { throw new ArgumentNullException(nameof(weatherStation)); } if (apiController == null) { throw new ArgumentNullException(nameof(apiController)); } _weatherStation = weatherStation; _apiController = apiController; }
public void Test1() { IApiController controller = new IApiController(); JObject expectedResult = new JObject(); expectedResult.Add("success", true); expectedResult.Add("message", "Lorum ipsum message.."); expectedResult.Add("data", JsonConvert.SerializeObject(new { test = "hallo" })); // ~ Act var response = controller.CreateResponse("Lorum ipsum message..", JsonConvert.SerializeObject(new { test = "hallo" }), true); JObject result = JObject.Parse(Convert.ToString(response.Value)); // ~ Assert Assert.NotNull(result); Assert.Equal(expectedResult, result); }
public SettingsContainerApiDispatcher(ISettingsContainer settingsContainer, string relativeUri, IApiController apiController) { if (settingsContainer == null) { throw new ArgumentNullException(nameof(settingsContainer)); } if (relativeUri == null) { throw new ArgumentNullException(nameof(relativeUri)); } if (apiController == null) { throw new ArgumentNullException(nameof(apiController)); } _settingsContainer = settingsContainer; _apiController = apiController; _relativeUri = relativeUri; }
public OpenWeatherMapWeatherService(IHomeAutomationTimer timer, IApiController apiController) { if (timer == null) { throw new ArgumentNullException(nameof(timer)); } if (apiController == null) { throw new ArgumentNullException(nameof(apiController)); } _timer = timer; LoadPersistedValues(); Task.Factory.StartNew( async() => await FetchWeahterData(), CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default); new OpenWeatherMapWeatherStationApiDispatcher(this, apiController).ExposeToApi(); }
public HealthMonitor(IBinaryOutput statusLed, IHomeAutomationTimer timer, IApiController apiController) { if (timer == null) { throw new ArgumentNullException(nameof(timer)); } if (apiController == null) { throw new ArgumentNullException(nameof(apiController)); } _statusLed = statusLed; _timer = timer; _startedDate = _timer.CurrentDateTime; if (statusLed != null) { _ledTimeout.Start(TimeSpan.FromMilliseconds(1)); } timer.Tick += Tick; apiController.RouteRequest("health", HandleApiGet); apiController.RouteCommand("health/reset", c => ResetStatistics()); }
public OpenWeatherMapService(IApiController apiController, IDateTimeService dateTimeService, ISchedulerService schedulerService, ISystemInformationService systemInformationService) { if (apiController == null) { throw new ArgumentNullException(nameof(apiController)); } if (dateTimeService == null) { throw new ArgumentNullException(nameof(dateTimeService)); } if (systemInformationService == null) { throw new ArgumentNullException(nameof(systemInformationService)); } _dateTimeService = dateTimeService; _systemInformationService = systemInformationService; LoadPersistedValues(); new OpenWeatherMapWeatherStationApiDispatcher(this, apiController).ExposeToApi(); schedulerService.RegisterSchedule("OpenWeatherMapServiceUpdater", TimeSpan.FromMinutes(5), Refresh); }
public Retrievals(IApiController apiController) { _apiController = apiController; }
public Claims(IApiController apiController) { _apiController = apiController; }
public LPD433MHzSignalSender(I2CHardwareBridge.I2CHardwareBridge i2CHardwareBridge, byte pin, IApiController apiController) { if (i2CHardwareBridge == null) { throw new ArgumentNullException(nameof(i2CHardwareBridge)); } if (apiController == null) { throw new ArgumentNullException(nameof(apiController)); } _i2CHardwareBridge = i2CHardwareBridge; _pin = pin; apiController.RouteCommand("433MHz", ApiPost); }
public void RegisterApi(IApiController controller) { controller.Add(new ContentMetadataApi()); }
private async void HandleIndex(HttpListenerContext ctx) { string url = "/"; IRequest request = new Request(ctx, DataProvider, AuthenticationProvider, new Dictionary <string, string>() { }); if (!Controllers.ContainsKey("/")) { HttpListenerResponse resp = ctx.Response; byte[] data = Encoding.UTF8.GetBytes(JsonSerializer.Serialize(new { Error = "404, Index Not Found", Status = 404 })); resp.StatusCode = 404; resp.ContentType = "application/json"; resp.ContentEncoding = Encoding.UTF8; resp.ContentLength64 = data.LongLength; await resp.OutputStream.WriteAsync(data, 0, data.Length); resp.Close(); return; } IApiController controller = Controllers["/"]; switch (ctx.Request.HttpMethod.ToUpper()) { case "GET": { controller.Get(request); break; } case "POST": { controller.Post(request); break; } case "PUT": { controller.Put(request); break; } case "PATCH": { controller.Patch(request); break; } case "DELETE": { controller.Delete(request); break; } } }
public CaseFiling(IApiController apiController) { _apiController = apiController; }
public Queues(IApiController apiController) { _apiController = apiController; }
public Transactions(IApiController apiController) { _apiController = apiController; }
public ApiController(IApiController implementation) { _implementation = implementation; }
public Fees(IApiController apiController) { _apiController = apiController; }
public Chargebacks(IApiController apiController) { _apiController = apiController; }
public Fraud(IApiController apiController) { _apiController = apiController; }