@@ -47,12 +47,16 @@ class InvalidPassenger(Exception):
4747 class InvalidSlice (Exception ):
4848 """Invalid slice data provided"""
4949
50+ class InvalidMaxConnectionValue (Exception ):
51+ """Invalid max connection value provided"""
52+
5053 def __init__ (self , client ):
5154 self ._client = client
5255 self ._return_offers = "false"
5356 self ._cabin_class = "economy"
5457 self ._passengers = []
5558 self ._slices = []
59+ self ._max_connections = 1
5660
5761 @staticmethod
5862 def _validate_cabin_class (cabin_class ):
@@ -85,6 +89,12 @@ def _validate_slices(slices):
8589 ):
8690 raise OfferRequestCreate .InvalidSlice (travel_slice )
8791
92+ @staticmethod
93+ def _validate_max_connections (max_connections ):
94+ """Validate the max connection number"""
95+ if max_connections < 0 :
96+ raise OfferRequestCreate .InvalidMaxConnectionValue (max_connections )
97+
8898 def return_offers (self ):
8999 """Set return_offers to 'true'"""
90100 self ._return_offers = "true"
@@ -108,6 +118,12 @@ def slices(self, slices):
108118 self ._slices = slices
109119 return self
110120
121+ def max_connections (self , max_connections ):
122+ """Set the max_connections for the journey we want to travel"""
123+ OfferRequestCreate ._validate_max_connections (max_connections )
124+ self ._max_connections = max_connections
125+ return self
126+
111127 def execute (self ):
112128 """POST /air/offer_requests - trigger the call to create the offer_request"""
113129 OfferRequestCreate ._validate_passengers (self ._passengers )
@@ -119,6 +135,7 @@ def execute(self):
119135 "data" : {
120136 "cabin_class" : self ._cabin_class ,
121137 "passengers" : self ._passengers ,
138+ "max_connections" : self ._max_connections ,
122139 "slices" : self ._slices ,
123140 }
124141 },
0 commit comments