コード例 #1
0
        public async Task <string> GetGridSupplyPointByPostcodeAsync(string postcode)
        {
            var uri = ComposeGetGridSupplyPointByPostcodeUri(postcode);

            var result = await GetCollectionAsync <GridSupplyPoint>(uri);

            Debug.Assert(result != null);

            if (!result.Any())
            {
                throw new GspException(Resources.NoGspFound);
            }

            if (result.Count() > 1)
            {
                throw new GspException(Resources.MultipleGspFound);
            }

            var gsp = result.Single().GroupId;

            Assertions.AssertValidGsp(gsp);

            return(gsp);
        }