Exemplo n.º 1
0
        public virtual CreateJobResponse CreateImageJob(string imageUrl, string teamName, string contentId, string workflowName, string callbackEndpoint = "")
        {
            var response = RepositoryClient.Send(
                ApiKeys.ContentModerator,
                $"{ApiKeys.ContentModeratorEndpoint}{reviewUrl}{teamName}/jobs?ContentType=Image&ContentId={contentId}&WorkflowName={workflowName}{GetCreateJobQuerystring(callbackEndpoint)}",
                RepositoryClient.GetByteArray(JsonConvert.SerializeObject(new JobRequest {
                ContentValue = imageUrl
            })),
                "application/json",
                "POST",
                GetToken());

            return(JsonConvert.DeserializeObject <CreateJobResponse>(response));
        }
Exemplo n.º 2
0
        public virtual SpeechToTextResponse SpeechToText(Stream audioStream, ScenarioOptions scenario, SpeechLocaleOptions locale, SpeechOsOptions os, Guid fromDeviceId, int maxnbest = 1, int profanitycheck = 1)
        {
            string url   = GetSpeechToTextUrl(scenario, locale, os, fromDeviceId, maxnbest, profanitycheck);
            string token = RepositoryClient.SendSpeechTokenRequest(ApiKeys.SpeechTokenEndpoint, ApiKeys.Speech);

            byte[] data = RepositoryClient.GetByteArray(audioStream);

            var response = RepositoryClient.Send(ApiKeys.Speech, url, data, contentType, "POST", token, true, "speech.platform.bing.com");

            return(JsonConvert.DeserializeObject <SpeechToTextResponse>(response));
        }