示例#1
0
        public virtual ImageSearchResponse GetImages(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  = RepositoryClient.SendGet(ApiKeys.BingSearch, searchUrl);

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

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

            return(JsonConvert.DeserializeObject <VideoSearchResponse>(response));
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="expression">Example: Composite(AA.AuN='sue dumais') - See: https://www.microsoft.com/cognitive-services/en-us/Academic-Knowledge-API/documentation/QueryExpressionSyntax</param>
        /// <param name="model"></param>
        /// <param name="attributes"></param>
        /// <param name="count"></param>
        /// <param name="offset"></param>
        /// <returns></returns>
        public virtual CalcHistogramResponse CalcHistogram(string expression, AcademicModelOptions model, string attributes = "", int count = 10, int offset = 0)
        {
            var qs        = GetCalcQuerystring(attributes, count, offset);
            var modelName = GetModelName(model);
            var response  = RepositoryClient.SendGet(ApiKeys.Academic, $"{ApiKeys.AcademicEndpoint}{calcUrl}?expr={expression}&model={modelName}{qs}");

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

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

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

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

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

            return(obj);
        }
        public virtual VideoOperationResult GetOperationResult(VideoOperation operation)
        {
            var response = RepositoryClient.SendGet(ApiKeys.Video, operation.Url);

            return(JsonConvert.DeserializeObject <VideoOperationResult>(response));
        }
示例#7
0
        public virtual Profile GetProfile(Guid id)
        {
            var response = RepositoryClient.SendGet(ApiKeys.SpeakerRecognition, $"{ApiKeys.SpeakerRecognition}identificationProfiles/{id.ToString("D")}");

            return(JsonConvert.DeserializeObject <Profile>(response));
        }
        public virtual string DownloadKnowledgeBase(Guid knowledgeBaseId)
        {
            var response = RepositoryClient.SendGet(ApiKeys.QnA, $"{ApiKeys.QnAEndpoint}{knowledgeBaseId}");

            return(response);
        }
示例#9
0
        public virtual GetImagesResponse GetAllImageIds(string listId)
        {
            var response = RepositoryClient.SendGet(ApiKeys.ContentModerator, $"{ApiKeys.ContentModeratorEndpoint}{listUrl}{listId}/images");

            return(JsonConvert.DeserializeObject <GetImagesResponse>(response));
        }
        public virtual string DownloadUsageFile(string modelId, string fileId)
        {
            var response = RepositoryClient.SendGet(ApiKeys.Recommendations, $"{ApiKeys.RecommendationsEndpoint}{modelsUrl}{modelId}/usage/{fileId}");

            return(response);
        }
示例#11
0
        public virtual ModelResult ListModels()
        {
            var response = RepositoryClient.SendGet(ApiKeys.ComputerVision, $"{ApiKeys.ComputerVisionEndpoint}models");

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

            return(JsonConvert.DeserializeObject <AutoSuggestResponse>(response));
        }
示例#13
0
        public AzureService GetServiceConfiguration()
        {
            var response = RepositoryClient.SendGet(ApiKeys.Personalizer, $"{ApiKeys.PersonalizerEndpoint}configurations/service");

            return(JsonConvert.DeserializeObject <AzureService>(response));
        }
示例#14
0
        public virtual PersonGroup GetPersonGroup(string personGroupId)
        {
            var response = RepositoryClient.SendGet(ApiKeys.Face, $"{ApiKeys.FaceEndpoint}persongroups{personGroupId}");

            return(JsonConvert.DeserializeObject <PersonGroup>(response));
        }
        public virtual WebLMModelResponse ListAvailableModels()
        {
            var response = RepositoryClient.SendGet(ApiKeys.WebLM, $"{ApiKeys.WebLMEndpoint}models");

            return(JsonConvert.DeserializeObject <WebLMModelResponse>(response));
        }
示例#16
0
        public virtual FaceList GetFaceList(string faceListId)
        {
            var response = RepositoryClient.SendGet(ApiKeys.Face, $"{ApiKeys.FaceEndpoint}facelists/{faceListId}");

            return(JsonConvert.DeserializeObject <FaceList>(response));
        }
示例#17
0
        public virtual VerificationPhrase[] GetPhrases(string locale)
        {
            var response = RepositoryClient.SendGet(ApiKeys.SpeakerRecognition, $"{ApiKeys.SpeakerRecognition}verificationPhrases?locale={locale}");

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