Exemplo n.º 1
0
        public virtual async Task <ImageSearchResponse> GetImagesAsync(string query, int count = 10, int offset = 0, string languageCode = "en-us", SafeSearchOptions safeSearch = SafeSearchOptions.Off)
        {
            string searchUrl = $"{imageSearchUrl}?q={query}&count={count}&offset={offset}&mkt={languageCode}&safeSearch={Enum.GetName(typeof(SafeSearchOptions), safeSearch)}";
            var    response  = await RepositoryClient.SendGetAsync(ApiKeys.BingSearch, searchUrl);

            return(JsonConvert.DeserializeObject <ImageSearchResponse>(response));
        }
        public virtual async Task <VideoSearchResponse> VideoSearchAsync(string text, int countOffset = 0, string languageCode = "", SafeSearchOptions safeSearch = SafeSearchOptions.Off)
        {
            var qs = GetVideoSearchQuerystring(countOffset, languageCode, safeSearch);

            var response = await RepositoryClient.SendGetAsync(ApiKeys.BingSearch, $"{ApiKeys.BingSearchEndpoint}{videoUrl}?q={text}{qs}");

            return(JsonConvert.DeserializeObject <VideoSearchResponse>(response));
        }
        public virtual async Task <NewsSearchCategoryResponse> CategorySearchAsync(NewsCategoryOptions category)
        {
            var catName = Enum.GetName(typeof(NewsCategoryOptions), category).Replace("USUK", "US/UK");

            var response = await RepositoryClient.SendGetAsync(ApiKeys.BingSearch, $"{ApiKeys.BingSearchEndpoint}{categoryUrl}?Category={catName}");

            return(JsonConvert.DeserializeObject <NewsSearchCategoryResponse>(response));
        }
Exemplo n.º 4
0
        public virtual async Task <CalcHistogramResponse> CalcHistogramAsync(string expression, AcademicModelOptions model, string attributes = "", int count = 10, int offset = 0)
        {
            var qs        = GetCalcQuerystring(attributes, count, offset);
            var modelName = GetModelName(model);
            var response  = await RepositoryClient.SendGetAsync(ApiKeys.Academic, $"{ApiKeys.AcademicEndpoint}{calcUrl}?expr={expression}&model={modelName}{qs}");

            return(JsonConvert.DeserializeObject <CalcHistogramResponse>(response));
        }
        public virtual async Task <SpellCheckResponse> SpellCheckAsync(string text, SpellCheckModeOptions mode = SpellCheckModeOptions.None, string languageCode = "")
        {
            var qs = GetSpellCheckQuerystring(text, mode, languageCode);

            var response = await RepositoryClient.SendGetAsync(ApiKeys.BingSpellCheck, $"{ApiKeys.BingSpellCheckEndpoint}{qs}");

            var obj = JsonConvert.DeserializeObject <SpellCheckResponse>(response);

            return(obj);
        }
        public virtual async Task <WebLMModelResponse> ListAvailableModelsAsync()
        {
            var response = await RepositoryClient.SendGetAsync(ApiKeys.WebLM, $"{ApiKeys.WebLMEndpoint}models");

            return(JsonConvert.DeserializeObject <WebLMModelResponse>(response));
        }
        public virtual async Task <VideoOperationResult> GetOperationResultAsync(VideoOperation operation)
        {
            var response = await RepositoryClient.SendGetAsync(ApiKeys.Video, operation.Url);

            return(JsonConvert.DeserializeObject <VideoOperationResult>(response));
        }
Exemplo n.º 8
0
        public virtual async Task <Profile> GetProfileAsync(Guid id)
        {
            var response = await RepositoryClient.SendGetAsync(ApiKeys.SpeakerRecognition, $"{ApiKeys.SpeakerRecognition}identificationProfiles/{id.ToString("D")}");

            return(JsonConvert.DeserializeObject <Profile>(response));
        }
        public virtual async Task <string> DownloadKnowledgeBaseAsync(Guid knowledgeBaseId)
        {
            var response = await RepositoryClient.SendGetAsync(ApiKeys.QnA, $"{ApiKeys.QnAEndpoint}{knowledgeBaseId}");

            return(response);
        }
Exemplo n.º 10
0
        public virtual async Task <GetImagesResponse> GetAllImageIdsAsync(string listId)
        {
            var response = await RepositoryClient.SendGetAsync(ApiKeys.ContentModerator, $"{ApiKeys.ContentModeratorEndpoint}{listUrl}{listId}/images");

            return(JsonConvert.DeserializeObject <GetImagesResponse>(response));
        }
Exemplo n.º 11
0
        public virtual async Task <FaceList> GetFaceListAsync(string faceListId)
        {
            var response = await RepositoryClient.SendGetAsync(ApiKeys.Face, $"{ApiKeys.FaceEndpoint}facelists/{faceListId}");

            return(JsonConvert.DeserializeObject <FaceList>(response));
        }
Exemplo n.º 12
0
        public virtual async Task <ModelResult> ListModelsAsync()
        {
            var response = await RepositoryClient.SendGetAsync(ApiKeys.ComputerVision, $"{ApiKeys.ComputerVisionEndpoint}models");

            return(JsonConvert.DeserializeObject <ModelResult>(response));
        }
        public virtual async Task <AutoSuggestResponse> GetSuggestionsAsync(string text)
        {
            var response = await RepositoryClient.SendGetAsync(ApiKeys.BingAutosuggest, $"{ApiKeys.BingAutosuggestEndpoint}?q={text}");

            return(JsonConvert.DeserializeObject <AutoSuggestResponse>(response));
        }
Exemplo n.º 14
0
        public virtual async Task <PersonGroup> GetPersonGroupAsync(string personGroupId)
        {
            var response = await RepositoryClient.SendGetAsync(ApiKeys.Face, $"{ApiKeys.FaceEndpoint}persongroups{personGroupId}");

            return(JsonConvert.DeserializeObject <PersonGroup>(response));
        }
        public virtual async Task <string> DownloadUsageFileAsync(string modelId, string fileId)
        {
            var response = await RepositoryClient.SendGetAsync(ApiKeys.Recommendations, $"{ApiKeys.RecommendationsEndpoint}{modelsUrl}{modelId}/usage/{fileId}");

            return(response);
        }
Exemplo n.º 16
0
        public virtual async Task <VerificationPhrase[]> GetPhrasesAsync(string locale)
        {
            var response = await RepositoryClient.SendGetAsync(ApiKeys.SpeakerRecognition, $"{ApiKeys.SpeakerRecognition}verificationPhrases?locale={locale}");

            return(JsonConvert.DeserializeObject <VerificationPhrase[]>(response));
        }