public override void AddToMultipartContent(Dictionary <string, dynamic> content) { if (!string.IsNullOrWhiteSpace(Face_Tokens)) { content.Add("face_tokens", new StringContent(Face_Tokens)); } else { throw new HttpRequestException("face_tokens is required"); } if (Return_Landmark.HasValue) { content.Add("return_landmark", new StringContent(Return_Landmark.ToString())); } if (!string.IsNullOrWhiteSpace(Return_Attributes)) { content.Add("return_attributes", new StringContent(Return_Attributes)); } if (!content.ContainsKey("return_landmark") && !content.ContainsKey("return_attributes")) { throw new HttpRequestException("any of return_landmark and return_attributes at least"); } }
public override void AddToMultipartContent(Dictionary <string, dynamic> content) { Image_File = content.AddAndGetStream(Image_Path); if (Image_File == null && Image_Base64 != null && Image_Base64.Length > 0) { content.Add("image_base64", new ByteArrayContent(Image_Base64)); } if (Image_File == null && Image_Base64 == null && !string.IsNullOrWhiteSpace(Image_Url)) { content.Add("image_url", new StringContent(Image_Url)); } if (Return_Landmark.HasValue) { content.Add("return_landmark", new StringContent(Return_Landmark.ToString())); } if (!string.IsNullOrWhiteSpace(Return_Attributes)) { content.Add("return_attributes", new StringContent(Return_Attributes)); } if (Calculate_All.HasValue) { content.Add("calculate_all", new StringContent(Calculate_All.ToString())); } if (!string.IsNullOrWhiteSpace(Face_Rectangle)) { content.Add("face_rectangle", new StringContent(Face_Rectangle)); } if (!content.ContainsKey("image_file") && !content.ContainsKey("image_base64") && !content.ContainsKey("image_url")) { throw new HttpRequestException("any of image_file, image_base64 and image_url at least"); } }