Beispiel #1
0
        internal AccessorRequestException(HttpResponseMessage response)
            : base(response.ToDisplay())
        {
            if (response != null)
            {
                this.Status  = response.StatusCode;
                this.Reason  = response.ReasonPhrase;
                this.Request = response.RequestMessage.ToString();

                if (LimitationParser.TryParse(response, out Limitation limitation))
                {
                    this.Limitation = limitation;
                }
            }
        }
Beispiel #2
0
        protected void ApplyCommonResults(HttpResponseMessage response, QueryArguments arguments, RequestResult result)
        {
            if (LimitationParser.TryParse(response, out Limitation limitation))
            {
                result.Limitation = limitation;
            }

            if (PaginationParser.TryParse(response, out Pagination pagination))
            {
                // Pagination workaround. Because of the fact that working with pagination
                // is a bit more complicated as actually expected, it becomes necessary to
                // give back the provided "current" page to the caller. For that reason, take
                // requested page and put it into the returned pagination settings.
                pagination.Current = new Paging(arguments.Paging?.Index ?? 1, arguments.Paging.Count);

                result.Pagination = pagination;
            }
        }