@@ -138,22 +138,26 @@ def get(self, uri, params: dict = None):
138138
139139 return r .json ()
140140
141- def update_unit (self , unit_id , params : dict ):
141+ def update_unit (self , unit_id , params : dict = None , amenities_map : dict = None ):
142142 """
143143 Update a unit via connect.
144144 https://vacasa.docs.stoplight.io/reference/v1-units-id/update-unit
145145
146146 Args:
147147 unit_id: ID of the unit to update
148148 params: A dict of key value pairs to update.
149+ amenities_map: Map of beds to update
149150
150151 Returns: dict
151152 updated unit
152153
153154 """
155+ if amenities_map is None :
156+ amenities_map = {}
154157
155158 url = f"{ self .endpoint } /v1/units/{ unit_id } "
156- return self ._patch (url , json = {'data' : {'attributes' : params }}, headers = self ._headers ()).json ()
159+ return self ._patch (url , json = {'data' : {'attributes' : params , 'meta' : {'amenities_map' : amenities_map }}},
160+ headers = self ._headers ()).json ()
157161
158162 def create_unit (self ,
159163 housing_type : str ,
@@ -231,7 +235,7 @@ def create_unit(self,
231235 payload ["code" ] = code
232236 if name :
233237 payload ["name" ] = name
234-
238+
235239 amenities_map = {
236240 "KingBeds" : king_beds ,
237241 "QueenBeds" : queen_beds ,
@@ -1062,7 +1066,7 @@ def create_contract(self,
10621066 owners : list ,
10631067 created_by : int ,
10641068 start_date : str ,
1065- end_date : str = '01/01/2099 ' ,
1069+ end_date : str = '2099-01-01 ' ,
10661070 monthly_rent : int = 0 ,
10671071 template_version_id : int = 1 ,
10681072 form_id : int = 1 ,
@@ -1078,7 +1082,7 @@ def create_contract(self,
10781082 owners: List of objects that contain three properties 'percentage_ownership', 'tax_ownership', 'contact_id'
10791083 created_by: ID of logged in user
10801084 start_date: Start date of the contract
1081- end_date: End date of a contract (By default will be '01/01/2099 '
1085+ end_date: End date of a contract (By default will be '2099-01-01 '
10821086 monthly_rent: Fixed monthly rent per contract
10831087 template_version_id: Foreign key to table contract_template_version, corresponds to “Template Version” on Contract page in Admin
10841088 form_id: Foreign key to table contract_form, corresponds to “Contract Form” on Contract page in Admin
@@ -1147,7 +1151,9 @@ def create_contact(self,
11471151 country_code : str = '' ,
11481152 phone : str = '' ,
11491153 phone_notes : str = '' ,
1150- language_id : int = None
1154+ language_id : int = None ,
1155+ created_by : int = None ,
1156+ tax_entity_name : str = None ,
11511157 ):
11521158 """
11531159 https://vacasa.docs.stoplight.io/contacts/postv1contacts
@@ -1165,6 +1171,8 @@ def create_contact(self,
11651171 phone: Phone Number of contact
11661172 phone_notes: Corresponds to “Phone Notes” on Contact page in Admin
11671173 language_id: Foreign key to table languages
1174+ created_by: ID of logged in user
1175+ tax_entity_name: If the contact is a business, put the business name here
11681176
11691177 Returns: dict
11701178 Created Contact
@@ -1184,6 +1192,8 @@ def create_contact(self,
11841192 "phone" : phone ,
11851193 "phone_notes" : phone_notes ,
11861194 "language_id" : language_id ,
1195+ "created_by" : created_by ,
1196+ "tax_entity_name" : tax_entity_name ,
11871197 }
11881198
11891199 url = f"{ self .endpoint } /v1/contacts"
@@ -1194,6 +1204,24 @@ def create_contact(self,
11941204 headers = headers
11951205 ).json ()
11961206
1207+ def update_contact (self , contact_id , params : dict ):
1208+
1209+ """
1210+ Update a unit via connect.
1211+ https://vacasa.docs.stoplight.io/contacts/patchv1contactsid
1212+
1213+ Args:
1214+ contact_id: ID of the contact to update
1215+ params: A dict of key value pairs to update.
1216+
1217+ Returns: dict
1218+ updated unit
1219+
1220+ """
1221+
1222+ url = f"{ self .endpoint } /v1/contacts/{ contact_id } "
1223+ return self ._patch (url , json = {'data' : {'attributes' : params }}, headers = self ._headers ()).json ()
1224+
11971225
11981226def _trip_protection_to_integer (trip_protection : bool ) -> int :
11991227 """Convert from True/False/None to 1/0/-1"""
0 commit comments