コード例 #1
0
ファイル: ServerClient.cs プロジェクト: tysmithnet/mcfly
        /// <inheritdoc />
        public IEnumerable <Tag> GetRecentTags(int numTags)
        {
            var ub = new UriBuilder(Settings.ServerUrl)
            {
                Path = $"api/tag"
            };
            var request = new RecentTagsRequest(10);
            var headers = new HttpHeaders
            {
                ["X-Project-Name"] = Settings.ProjectName
            };
            var result = HttpFacade.PostJsonAsync(ub.Uri, request, headers).GetAwaiter().GetResult();
            var json   = result.Content.ReadAsStringAsync().GetAwaiter().GetResult();

            return(JsonConvert.DeserializeObject <IEnumerable <Tag> >(json));
        }