Пример #1
0
        internal async Task <List <T> > GetAll <T>(ExecuteParams param) where T : MultipleResultBase
        {
            Uri      uri        = new Uri(param.Uri, UriKind.Relative);
            List <T> resultList = new List <T>();

            do
            {
                param.SetUri(uri.ToString());
                var result = await Get(param);

                var multipleResultBase = result.ConvertToData <MultipleResultBase>();
                resultList.Add(result.ConvertToData <T>());
                var tempUri = multipleResultBase?.next?.ToString();
                if (tempUri == null)
                {
                    uri = null;
                }
                else
                {
                    var index = tempUri.IndexOf("/api");
                    if (index == -1)
                    {
                        break;
                    }
                    uri = new Uri(tempUri.Substring(index), UriKind.Relative);
                }
            } while (uri != null);

            return(resultList);
        }
Пример #2
0
        public async Task <MultipleWebshopsResult> Get(IConnectionCcvShop connection = null, string lan = null)
        {
            //todo: add counter, max 150 per minute

            var uri = "/api/rest/v1/webshops/";
            var p   = new ExecuteParams(connection, lan);

            p.SetUri(uri);

            return(await Get <MultipleWebshopsResult>(p));
        }
Пример #3
0
        public async Task <List <MultipleCategoriesResult> > GetAll(IConnectionCcvShop connection = null, string lan = null)
        {
            //todo: add counter, max 150 per minute

            var uri = "/api/rest/v1/categories/";
            var p   = new ExecuteParams(connection, lan);

            p.SetUri(uri);

            return(await GetAll <MultipleCategoriesResult>(p));
        }
Пример #4
0
        public async Task <List <MultipleProductsResult> > GetAll(IConnectionCcvShop connection = null, Parameters parameters = null, string lan = null)
        {
            //todo: add order by module
            //todo: add counter, max 150 per minute

            var uri = "/api/rest/v1/products/";
            var p   = new ExecuteParams(connection, lan);

            p.SetUri(uri, parameters);

            return(await GetAll <MultipleProductsResult>(p));
        }