Exemplo n.º 1
0
        public static LastResponse CreateSuccessResponse()
        {
            var r = new LastResponse
            {
                Status = LastResponseStatus.Successful
            };

            return(r);
        }
Exemplo n.º 2
0
        public static LastResponse CreateSuccessResponse()
        {
            var r = new LastResponse
            {
                Success = true,
                Error   = LastFmApiError.None
            };

            return(r);
        }
Exemplo n.º 3
0
        public static LastResponse <T> CreateSuccessResponse(T content)
        {
            var r = new LastResponse <T>
            {
                Content = content,
                Status  = LastResponseStatus.Successful
            };

            return(r);
        }
Exemplo n.º 4
0
        public static LastResponse <T> CreateSuccessResponse(T content)
        {
            var r = new LastResponse <T>
            {
                Content = content,
                Success = true,
                Error   = LastFmApiError.None
            };

            return(r);
        }
Exemplo n.º 5
0
        public async static Task <LastResponse> HandleResponse(HttpResponseMessage response)
        {
            string json = await response.Content.ReadAsStringAsync();

            LastFmApiError error;

            if (LastFm.IsResponseValid(json, out error) && response.IsSuccessStatusCode)
            {
                return(LastResponse.CreateSuccessResponse());
            }
            else
            {
                return(LastResponse.CreateErrorResponse <LastResponse>(error));
            }
        }