Example #1
0
        private static GitHubPaginationLinks ParseLinkHeader(string val)
        {
            var links = new GitHubPaginationLinks();

            foreach (var link in val.Split(','))
            {
                var parts = link.Split(';');
                var rel   = parts[1].Trim();
                var url   = parts[0].Trim().TrimStart('<').TrimEnd('>');
                switch (rel)
                {
                case "rel=\"next\"":
                    links.Next = url;
                    break;

                case "rel=\"prev\"":
                    links.Prev = url;
                    break;

                case "rel=\"first\"":
                    links.First = url;
                    break;

                case "rel=\"last\"":
                    links.Last = url;
                    break;
                }
            }

            return(links);
        }
Example #2
0
        private static GitHubPaginationLinks ParseLinkHeader(string val) {
            var links = new GitHubPaginationLinks();

            foreach (var link in val.Split(',')) {
                var parts = link.Split(';');
                var rel = parts[1].Trim();
                var url = parts[0].Trim().TrimStart('<').TrimEnd('>');
                switch (rel) {
                    case "rel=\"next\"":
                        links.Next = url;
                        break;
                    case "rel=\"prev\"":
                        links.Prev = url;
                        break;
                    case "rel=\"first\"":
                        links.First = url;
                        break;
                    case "rel=\"last\"":
                        links.Last = url;
                        break;
                }
            }

            return links;
        }