Beispiel #1
0
        public async Task <Result <string> > PostSendAsync(string term)
        {
            var nvc = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("relaxation", term),
                new KeyValuePair <string, string>("tipoCEP", "ALL"),
                new KeyValuePair <string, string>("semelhante", "N")
            };

            var result = await this.PostFormUrlEncodedAsync(_apiUrl, nvc);

            return(await ResultOperations.ReadHttpResult(result));
        }
Beispiel #2
0
        public async Task <Result <string> > PostSliceSendAsync(string term, int lines, int init, int last)
        {
            var nvc = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("relaxation", term),
                new KeyValuePair <string, string>("exata", "S"),
                new KeyValuePair <string, string>("semelhante", "N"),
                new KeyValuePair <string, string>("tipoCEP", "ALL"),
                new KeyValuePair <string, string>("qtdrow", lines.ToString()),
                new KeyValuePair <string, string>("pagini", init.ToString()),
                new KeyValuePair <string, string>("pagfim", last.ToString())
            };

            var result = await this.PostFormUrlEncodedAsync(_apiUrl, nvc);

            return(await ResultOperations.ReadHttpResult(result));
        }
        public async Task <Result <County> > GetCountryByName(string uf, string state)
        {
            var retMessage = await this.GetAsync($"{_baseUrl}{_apiUrl}{uf}/{state}/{_endpointLast}");

            var result = await ResultOperations.ReadHttpResult(retMessage);

            if (result.Status == ResultCode.OK)
            {
                var retCountry = _serviceScrap.GetCountryPage(result.ValueType);

                if (retCountry.Status == ResultCode.OK)
                {
                    return(new Result <County>(retCountry.Status, retCountry.ValueType));
                }
            }

            return(null);
        }
Beispiel #4
0
        public async Task <Result <string> > GetSendAsync(string zipCode)
        {
            var result = await this.GetAsync($@"{_baseUrl}{_apiUrl}{zipCode}/json");

            return(await ResultOperations.ReadHttpResult(result));
        }