示例#1
0
            static async private Task <MatrixRequestResult> GetAsync(string uri, string query = "")
            {
                string uri_str;

                if (query != null)
                {
                    query   = (query.Length == 0 ? "" : $"&{query}");
                    uri_str = $"{uri}?t={rand.Next()}{query}";
                }
                else
                {
                    uri_str = $"{uri}";
                }
                var obj = await json_req.GetAsync(new Uri(uri_str));

                var result = new MatrixRequestResult(obj);

                switch (result.status)
                {
                case "UNKNOWN_ERROR":
                    throw new MatrixException.ServerError();

                case "NOT_AUTHORIZED":
                    throw new MatrixException.NotLogin();

                default: break;
                }
                return(result);
            }