示例#1
0
        public static async Task <CommunityCommandsSearchResult> Create(HttpResponseMessage response)
        {
            CommunityCommandsSearchResult result = new CommunityCommandsSearchResult();

            if (response.IsSuccessStatusCode)
            {
                result.Results.AddRange(await response.ProcessResponse <IEnumerable <CommunityCommandModel> >());

                if (int.TryParse(response.GetHeaderValue(PageNumberHeader), out int pageNumber))
                {
                    result.PageNumber = pageNumber;
                }
                if (int.TryParse(response.GetHeaderValue(PageSizeHeader), out int pageSize))
                {
                    result.PageSize = pageSize;
                }
                if (int.TryParse(response.GetHeaderValue(TotalElementsHeader), out int totalElements))
                {
                    result.TotalElements = totalElements;
                }
                if (int.TryParse(response.GetHeaderValue(TotalPagesHeader), out int totalPages))
                {
                    result.TotalPages = totalPages;
                }
            }
            return(result);
        }
示例#2
0
        public async Task <CommunityCommandsSearchResult> GetCommandsByUser(Guid userID, int skip, int top)
        {
            await EnsureLogin();

            return(await CommunityCommandsSearchResult.Create(await GetAsync($"community/commands/command/user/{userID}?skip={skip}&top={top}")));
        }
示例#3
0
        public async Task <CommunityCommandsSearchResult> GetMyCommands(int skip, int top)
        {
            await EnsureLogin();

            return(await CommunityCommandsSearchResult.Create(await GetAsync($"community/commands/command/mine?skip={skip}&top={top}")));
        }
示例#4
0
        public async Task <CommunityCommandsSearchResult> SearchCommands(string query, int skip, int top)
        {
            await EnsureLogin();

            return(await CommunityCommandsSearchResult.Create(await this.GetAsync($"community/commands/command/search?query={HttpUtility.UrlEncode(query)}&skip={skip}&top={top}")));
        }