예제 #1
0
        public async Task SendWithImage(LicensePlatePayload lp)
        {
            var payload = System.Text.Json.JsonSerializer.Serialize(lp);
            var request = new HttpRequestMessage(HttpMethod.Post, $"{_config.LicenseRoot}/lpr/platelocation");

            request.Headers.Authorization = new AuthenticationHeaderValue("Basic", _config.ApiKey);
            request.Content = new StringContent(payload, Encoding.UTF8, "application/json");
        }
예제 #2
0
 public static LicensePlateDTO ToDto(this LicensePlatePayload lp)
 {
     return(new LicensePlateDTO
     {
         LicensePlate = lp.LicensePlate,
         LicensePlateCaptureTime = lp.LicensePlateCaptureTime,
         Longitude = lp.Longitude,
         Latitude = lp.Latitude,
         ContextImageReference = lp.ContextImageReference
     });
 }
예제 #3
0
        public async Task <string> SendPlate(LicensePlatePayload lp)
        {
            var payload = System.Text.Json.JsonSerializer.Serialize(lp.ToDto());

            Console.WriteLine(payload);
            var request = new HttpRequestMessage(HttpMethod.Post, $"{_config.LicenseRoot}/lpr/platelocation");

            request.Headers.Authorization = new AuthenticationHeaderValue("Basic", _config.ApiKey);

            request.Content = new StringContent(payload, Encoding.UTF8, "application/json");

            var response = await _client.SendAsync(request);

            return(response.StatusCode.ToString());
        }