ImgesRequest.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using Newtonsoft.Json;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace KdanCommon.GoogleCloud.Data.Vision
  8. {
  9. public partial class ImgesRequest
  10. {
  11. [JsonProperty("requests")]
  12. public ImageRequest[] Requests { get; set; }
  13. public ImgesRequest(List<string> inputContents)
  14. {
  15. Requests = new ImageRequest[inputContents.Count];
  16. for (int i = 0; i < inputContents.Count; i++)
  17. {
  18. Requests[i] = new ImageRequest()
  19. {
  20. Image = new Image()
  21. {
  22. Content = inputContents[i]
  23. },
  24. Features = new Feature[]
  25. {
  26. new Feature()
  27. {
  28. Type = "TEXT_DETECTION"
  29. }
  30. }
  31. };
  32. }
  33. }
  34. }
  35. public partial class ImageRequest
  36. {
  37. [JsonProperty("image")]
  38. public Image Image { get; set; }
  39. [JsonProperty("features")]
  40. public Feature[] Features { get; set; }
  41. }
  42. public partial class Feature
  43. {
  44. [JsonProperty("type")]
  45. public string Type { get; set; }
  46. }
  47. public partial class Image
  48. {
  49. [JsonProperty("content")]
  50. public string Content { get; set; }
  51. }
  52. }