/// <summary> /// request async,use image binarys to experience productAI search service /// </summary> /// <param name="serviceType"></param> /// <param name="serviceID"></param> /// <param name="fileBytes"></param> /// <param name="options"></param> /// <param name="callback"></param> /// <returns>async result use to end request and get result</returns> public void SubmitFileToSearchAsync(string serviceType, string serviceID, byte[] fileBytes, Dictionary <string, string> options, Action <bool, string> callback) { HttpPost hp = SubmitFileToSearchP(serviceType, serviceID, fileBytes, options); hp.PostAsync(callback); }
/// <summary> /// request async ,batch delete images from productAI imageset by CSV file /// </summary> /// <param name="imageSetId"></param> /// <param name="filePath"></param> /// <param name="options"></param> /// <param name="callBack"></param> /// <returns>async result use to end request and get result</returns> public void DeleteImageByFileAsync(string imageSetId, string filePath, Dictionary <string, string> options, Action <bool, string> callback) { HttpPost hp = ImageSetFileControlP(imageSetId, filePath, "urls_to_delete", options); hp.PostAsync(callback); }
/// <summary> /// request async,add a image to productAI imageset by image url /// </summary> /// <param name="imageSetId"></param> /// <param name="imageUrl"></param> /// <param name="options"></param> /// <param name="callback"></param> /// <returns>async result use to end request and get result</returns> public void AddImageToImageSetAsync(string imageSetId, string imageUrl, Dictionary <string, string> options, Action <bool, string> callback) { HttpPost hp = AddImageToImageSetP(imageSetId, imageUrl, options); hp.PostAsync(callback); }
/// <summary> /// request async , use image url to experience productAI search service /// </summary> /// <param name="serviceType"></param> /// <param name="serviceID"></param> /// <param name="PictureUrl"></param> /// <param name="options"></param> /// <param name="callback"></param> /// <returns>async result use to end request and get result</returns> public void SubmitFormToSearchAsync(string serviceType, string serviceID, string PictureUrl, Dictionary <string, string> options, Action <bool, string> callback) { HttpPost hp = SubmitFormToSearchP(serviceType, serviceID, PictureUrl, options); hp.PostAsync(callback); }
/// <summary> /// use image binarys to experience productAI search service /// </summary> /// <param name="serviceType"></param> /// <param name="serviceID"></param> /// <param name="filePath"></param> /// <param name="options"></param> /// <param name="respContent"></param> /// <returns>false request success,true request failed</returns> public bool SubmitFileToSearch(string serviceType, string serviceID, byte[] fileBytes, Dictionary <string, string> options, out string respContent) { HttpPost hp = SubmitFileToSearchP(serviceType, serviceID, fileBytes, options); hp.Post(); respContent = hp.ResultText; return(hp.IsError); }
/// <summary> /// batch delete images from imageset by CSV file /// </summary> /// <param name="imageSetId"></param> /// <param name="filePath"></param> /// <param name="options"></param> /// <param name="respContent"></param> /// <returns>false request success,true request failed</returns> public bool DeleteImageByFile(string imageSetId, string filePath, Dictionary <string, string> options, out string respContent) { HttpPost hp = ImageSetFileControlP(imageSetId, filePath, "urls_to_delete", options); hp.Post(); respContent = hp.ResultText; return(hp.IsError); }
/// <summary> /// add a image to productAI imageset by image url /// </summary> /// <param name="imageSetId"></param> /// <param name="imageUrl"></param> /// <param name="options"></param> /// <param name="respContent"></param> /// <returns>false request success,true request failed</returns> public bool AddImageToImageSet(string imageSetId, string imageUrl, Dictionary <string, string> options, out string respContent) { HttpPost hp = AddImageToImageSetP(imageSetId, imageUrl, options); hp.Post(); respContent = hp.ResultText; return(hp.IsError); }
/// <summary> /// use image url to experience productAI search service /// </summary> /// <param name="serviceType"></param> /// <param name="serviceID"></param> /// <param name="PictureUrl"></param> /// <param name="options"></param> /// <param name="respContent"></param> /// <returns>false request success,true request failed</returns> public bool SubmitFormToSearch(string serviceType, string serviceID, string PictureUrl, Dictionary <string, string> options, out string respContent) { HttpPost hp = SubmitFormToSearchP(serviceType, serviceID, PictureUrl, options); hp.Post(); respContent = hp.ResultText; return(hp.IsError); }
protected HttpPost ImageSetFileControlP( string imageSetId, string filePath, string ControlStr, Dictionary <string, string> options) { string postUrl = urlImageSet(imageSetId); Dictionary <string, string> headers = getCommonHeader(null); HttpForm form = new HttpForm(); byte[] bytes = Functions.getFileBytes(filePath); form.AddBinary(ControlStr, bytes, "productAIService.csv"); HttpPost hp = new HttpPost(postUrl, headers, form); return(hp); }
protected HttpPost SubmitFileToSearchP(string serviceType, string serviceID, byte[] fileBytes, Dictionary <string, string> options) { string url = urlSearch(serviceType, serviceID); Dictionary <string, string> headers = getCommonHeader(options); HttpForm form = new HttpForm(); foreach (var param in options) { form.AddField(param.Key, param.Value); } form.AddBinary("search", fileBytes, "productAIService.jpg", "image/jpegcv"); HttpPost hp = new HttpPost(url, headers, form); return(hp); }
protected HttpPost SubmitFormToSearchP(string serviceType, string serviceID, string PictureUrl, Dictionary <string, string> options) { string searchUrl = urlSearch(serviceType, serviceID); Dictionary <string, string> parameters = new Dictionary <string, string>(options); parameters.Add("url", PictureUrl); Dictionary <string, string> headers = getCommonHeader(parameters); UrlEncodeForm form = new UrlEncodeForm(); foreach (var param in parameters) { form.AddField(param.Key, param.Value); } HttpPost hp = new HttpPost(searchUrl, headers, form); return(hp); }
protected HttpPost AddImageToImageSetP(string imageSetId, string imageUrl, Dictionary <string, string> options) { string postUrl = urlImageSet(imageSetId); Dictionary <string, string> parameters = new Dictionary <string, string>(options); parameters.Add("image_url", imageUrl); Dictionary <string, string> headers = getCommonHeader(parameters); UrlEncodeForm form = new UrlEncodeForm(); foreach (var param in parameters) { form.AddField(param.Key, param.Value); } HttpPost hp = new HttpPost(postUrl, headers, form); return(hp); }