コード例 #1
0
        public static GitHubRepositoryResponse ParseResponse(SocialHttpResponse response)
        {
            // Parse the raw JSON response
            JsonObject obj = response.GetBodyAsJsonObject();

            // Check for any errors
            if (response.StatusCode != HttpStatusCode.OK)
            {
                string message = obj.GetString("message");
                string url     = obj.GetString("documentation_url");
                throw new GitHubHttpException(response.StatusCode, message, url);
            }

            // Initialize the object to be returned
            return(new GitHubRepositoryResponse(response)
            {
                Data = GitHubRepository.Parse(obj)
            });
        }