File tree Expand file tree Collapse file tree 3 files changed +24
-4
lines changed
Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public static void Example()
3333 * Get all deals
3434 */
3535 var deals = api . Deal . List < DealHubSpotModel > ( false ,
36- new ListRequestOptions { PropertiesToInclude = new List < string > { "dealname" , "amount" } } ) ;
36+ new ListRequestOptions ( 250 ) { PropertiesToInclude = new List < string > { "dealname" , "amount" } } ) ;
3737
3838 /**
3939 * Get all deals
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ public HubSpotDealApi(IHubSpotClient client)
7373 {
7474 if ( opts == null )
7575 {
76- opts = new ListRequestOptions ( ) ;
76+ opts = new ListRequestOptions ( 250 ) ;
7777 }
7878
7979 var path = $ "{ new DealListHubSpotModel < T > ( ) . RouteBasePath } /deal/paged"
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ namespace HubSpot.NET.Core
99 public class ListRequestOptions
1010 {
1111 private int _limit = 20 ;
12+ private readonly int _upperLimit ;
1213
1314 /// <summary>
1415 /// Gets or sets the number of items to return.
@@ -24,15 +25,34 @@ public int Limit
2425 get => _limit ;
2526 set
2627 {
27- if ( value < 1 || value > 100 )
28+ if ( value < 1 || value > _upperLimit )
2829 {
2930 throw new ArgumentException (
30- $ "Number of items to return must be a positive ingeteger greater than 0, and less than 100 - you provided { value } ") ;
31+ $ "Number of items to return must be a positive integer greater than 0, and less than { _upperLimit } - you provided { value } ") ;
3132 }
3233 _limit = value ;
3334 }
3435 }
3536
37+ /// <summary>
38+ /// Initializes a new instance of the <see cref="T:HubSpot.NET.Core.ListRequestOptions"/> class.
39+ /// </summary>
40+ /// <param name="upperLimit">Upper limit for the amount of items to request for the list.</param>
41+ public ListRequestOptions ( int upperLimit )
42+ {
43+ _upperLimit = upperLimit ;
44+ }
45+
46+ /// <summary>
47+ /// Initializes a new instance of the <see cref="T:HubSpot.NET.Core.ListRequestOptions"/> class.
48+ /// Sets the upper limit to 100
49+ /// </summary>
50+ public ListRequestOptions ( )
51+ : this ( 100 )
52+ {
53+
54+ }
55+
3656 /// <summary>
3757 /// Get or set the continuation offset when calling list many times to enumerate all your items
3858 /// </summary>
You can’t perform that action at this time.
0 commit comments