Skip to content

Commit 4ac9e96

Browse files
GROW-871: Name and Code are no longer required. (#58)
* GROW-871: Name and Code are no longer required. Connect API will auto-create a code if it is not provided. * Update vacasa/connect/connect.py Co-Authored-By: bijan-vacasa <33635269+bijan-vacasa@users.noreply.github.com> * Update vacasa/connect/connect.py Co-Authored-By: bijan-vacasa <33635269+bijan-vacasa@users.noreply.github.com>
1 parent d7230d4 commit 4ac9e96

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='VacasaConnect',
5-
version='1.0.11',
5+
version='1.0.12',
66
description='A Python 3.6+ SDK for the connect.vacasa.com API.',
77
packages=['vacasa.connect'],
88
url='https://github.com/Vacasa/python-vacasa-connect-sdk',

vacasa/connect/connect.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ def create_unit(self,
159159
housing_type: str,
160160
secured_by,
161161
turnover_day: int = 0,
162-
code: str = '',
163-
name: str = '',
162+
code: str = None,
163+
name: str = None,
164164
bedrooms: int = 0,
165165
full_baths: int = 0,
166166
half_baths: int = 0,
@@ -185,8 +185,8 @@ def create_unit(self,
185185
housing_type: Effective foreign key to table Codes with CodeTypeId = 2, corresponds to “Housing Type” on Listing tab for a unit
186186
secured_by: An int id of a user/process that signed up the unit
187187
turnover_day: Corresponds to “Fixed Turnover” on Rates tab for a unit
188-
code: Unit code, alternate unique identifier for a unit
189-
name: Unique name for the unit
188+
code: Unit code, alternate unique identifier for a unit. If not provided the Connect API will assign a temp code
189+
name: Unique name for the unit. Can be empty
190190
bedrooms:
191191
full_baths:
192192
half_baths:
@@ -211,8 +211,6 @@ def create_unit(self,
211211
headers = self._headers()
212212

213213
payload = {
214-
"code": code,
215-
"name": name,
216214
"housing_type": housing_type,
217215
"bedrooms": bedrooms,
218216
"bathrooms": {
@@ -229,6 +227,11 @@ def create_unit(self,
229227
"secured_by": secured_by,
230228
}
231229

230+
if code:
231+
payload["code"] = code
232+
if name:
233+
payload["name"] = name
234+
232235
amenities_map = {
233236
"KingBeds": king_beds,
234237
"QueenBeds": queen_beds,

0 commit comments

Comments
 (0)