public static ListSubaccountResponse CreateFromResponse(Response response)
        {
            var result = new ListSubaccountResponse();

            LeftRight.SetValuesToMatch(result, response);

            var results     = Jsonification.DeserializeObject <dynamic>(response.Content).results;
            var subaccounts = new List <Subaccount>();

            foreach (var r in results)
            {
                subaccounts.Add(ConvertToSubaccount(r));
            }

            result.Subaccounts = subaccounts;
            return(result);
        }
示例#2
0
        public async Task <ListSubaccountResponse> List()
        {
            var request = new Request
            {
                Url    = $"/api/{client.Version}/subaccounts",
                Method = "GET"
            };

            var response = await requestSender.Send(request);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new ResponseException(response);
            }

            return(ListSubaccountResponse.CreateFromResponse(response));
        }