public async Task <object> RecognizeTextWithUrl(object objectToProcess = null, Dictionary <string, string> parameters = null) { var requestDictionary = new Dictionary <string, object>() { { "Endpoint_Uri", $"{_endpointUri}" }, { "Endpoint_Version", _version }, { "Operation_Method", "POST" }, { "Operation_Path", "recognizeText" }, { "Operation_SubPath", "" }, { "Headers", _headers .Append(new KeyValuePair <string, string> ("ContentType", "application/json")) .ToDictionary(kv => kv.Key, kv => kv.Value) }, { "Parameters", parameters }, { "RequestObject", objectToProcess } }; return(await RequestProcessor.ProcessRequest <object, object>(requestDictionary)); }
public static async Task <object> AddFaceAsync(dynamic objectToProcess) { using (FileStream fileStream = new FileStream(objectToProcess.imageFilePath, FileMode.Open, FileAccess.Read)) { BinaryReader binaryReader = new BinaryReader(fileStream); var bytes = binaryReader.ReadBytes((int)fileStream.Length); var requestDictionary = new Dictionary <string, object>() { { "EndpointUri", $"{ApiUri}/face" }, { "Version", "v1.0" }, { "Method", "POST" }, { "RequestObject", bytes }, { "RequestSubPath", $"{objectToProcess.faceListId}/persistedFaces" }, { "RequestPath", "facelists" }, { "Headers", new Dictionary <string, string> { { "Ocp-Apim-Subscription-Key", SubscriptionKey }, { "ContentType", "application/octet-stream" }, { "Accept", "application/json" } } }, { "Parameters", new Dictionary <string, string>() { { "detectionModel", objectToProcess.detectionModel }, { "targetFace", objectToProcess.targetFace } } } }; return (await RequestProcessor .ProcessRequest( requestDictionary, GetPostStreamRequestAction <object>(), GetPreRequestAction <object>())); } }