public void CanDetermineNextRequestFromCurrent()
		{
			PageRequest first = new PageRequest (1, 10);

			Assert.AreEqual (11, first.Next.From);
			Assert.AreEqual (21, first.Next.Next.From);
		}
Beispiel #2
0
        /// <summary>
        /// Get a list of layouts (DocumentPackages).
        /// </summary>
        /// <returns>The list of layouts.</returns>
        /// <param name="direction">Retrieved list to be sorted in ascending or descending order by name.</param>
        /// <param name="request">Identifying which page of results to return.</param>
        public IList<DocumentPackage> GetLayouts(Direction direction, PageRequest request)
        {
            Result<Package> results = apiClient.GetLayouts(direction, request);

            IList<DocumentPackage> layouts = new List<DocumentPackage>();
            foreach (Package layout in results.Results)
            {
                layouts.Add(new DocumentPackageConverter(layout).ToSDKPackage());
            }

            return layouts;
        }
Beispiel #3
0
		public void KnowsIfMorePagesAreAvailable()
		{
			PageRequest initial = new PageRequest (1);
			Page<object> page = new Page<object> (null, 23, initial);

			Assert.IsTrue (page.HasNextPage());

			page = new Page<object> (null, 23, initial.Next);
			Assert.IsTrue (page.HasNextPage());

			page = new Page<object> (null, 23, initial.Next.Next);
			Assert.IsFalse (page.HasNextPage());
		}
 public Silanis.ESL.API.Result<Silanis.ESL.API.Sender> GetSenders(Direction direction, PageRequest request) {
     string path = template.UrlFor(UrlTemplate.ACCOUNT_MEMBER_LIST_PATH)
         .Replace("{dir}", DirectionUtility.getDirection(direction))
         .Replace("{from}", request.From.ToString())
         .Replace("{to}", request.To.ToString())
         .Build();
     try {
         string response = restClient.Get(path);
         Silanis.ESL.API.Result<Silanis.ESL.API.Sender> apiResponse = 
             JsonConvert.DeserializeObject<Silanis.ESL.API.Result<Silanis.ESL.API.Sender>> (response, jsonSettings );
        
         return apiResponse;
     }
     catch (EslServerException e) {
         throw new EslServerException("Failed to retrieve Account Members List.\t" + " Exception: " + e.Message, e.ServerError, e);
     }
     catch (Exception e) {
         throw new EslException("Failed to retrieve Account Members List.\t" + " Exception: " + e.Message, e);
     }
 }
        public Result<Package> GetLayouts(Direction direction, PageRequest request)
        {
            string path = template.UrlFor(UrlTemplate.LAYOUT_LIST_PATH)
                .Replace("{dir}", DirectionUtility.getDirection(direction))
                .Replace("{from}", request.From.ToString())
                .Replace("{to}", request.To.ToString())
                .Build();

            try
            {
                string response = restClient.Get(path);
                return JsonConvert.DeserializeObject<Result<Silanis.ESL.API.Package>>(response, settings);
            }
            catch (EslServerException e)
            {
                throw new EslServerException("Could not get list of layouts." + " Exception: " + e.Message, e.ServerError, e);
            }
            catch (Exception e)
            {
                throw new EslException("Could not get list of layouts." + " Exception: " + e.Message, e);
            }
        }
        public IList<Silanis.ESL.API.CustomField> GetCustomFields(Direction direction, PageRequest request)
        {
            string path = template.UrlFor(UrlTemplate.ACCOUNT_CUSTOMFIELD_LIST_PATH)
                .Replace("{dir}", DirectionUtility.getDirection(direction))
                .Replace("{from}", request.From.ToString())
                .Replace("{to}", request.To.ToString())
                .Build();

            try 
            {
                string response = client.Get(path);
                return JsonConvert.DeserializeObject<IList<Silanis.ESL.API.CustomField>> (response, settings);
            }
            catch (EslServerException e)
            {
                throw new EslServerException("Could not get the list of custom fields from account." + " Exception: " + e.Message, e.ServerError, e);
            }
            catch (Exception e)
            {
                throw new EslException("Could not get the list of custom fields from account." + " Exception: " + e.Message, e);
            }
        }