diff --git a/src/GamCommands.txt b/src/GamCommands.txt index e5ccf6a6..05d34eec 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -682,12 +682,19 @@ Specify a collection of Users by directly specifying them or by specifying items ## Item attributes ::= + (address|addresslines )| + (city|locality )| + (country|regioncode )| (description )| (floors )| (id )| + (language|languageCode )| (latitude )| (longitude )| (name ) + (state|administrativearea )| + (sublocality )| + (zipcode|postalcode ) ::= (selected )|(hidden )|(summary )|(colorindex|colorid )|(backgroundcolor )|(foregroundcolor )| diff --git a/src/gam/gapi/directory/resource.py b/src/gam/gapi/directory/resource.py index a7b81f78..eb744934 100644 --- a/src/gam/gapi/directory/resource.py +++ b/src/gam/gapi/directory/resource.py @@ -227,6 +227,22 @@ def printFeatures(): display.write_csv_file(csvRows, titles, 'Features', to_drive) +BUILDING_ADDRESS_FIELD_MAP = { + 'address': 'addressLines', + 'addresslines': 'addressLines', + 'administrativearea': 'administrativeArea', + 'city': 'locality', + 'country': 'regionCode', + 'language': 'languageCode', + 'languagecode': 'languageCode', + 'locality': 'locality', + 'postalcode': 'postalCode', + 'regioncode': 'regionCode', + 'state': 'administrativeArea', + 'sublocality': 'sublocality', + 'zipcode': 'postalCode', + } + def _getBuildingAttributes(args, body={}): i = 0 while i < len(args): @@ -253,6 +269,16 @@ def _getBuildingAttributes(args, body={}): elif myarg == 'floors': body['floorNames'] = args[i + 1].split(',') i += 2 + elif myarg in BUILDING_ADDRESS_FIELD_MAP: + myarg = BUILDING_ADDRESS_FIELD_MAP[myarg] + body.setdefault('address', {}) + if myarg == 'addressLines': + body['address'][myarg] = args[i + 1].split('\n') + elif myarg == 'languageCode': + body['address'][myarg] = LANGUAGE_CODES_MAP.get(args[i + 1].lower(), args[i + 1]) + else: + body['address'][myarg] = args[i + 1] + i += 2 else: controlflow.invalid_argument_exit(myarg, 'gam create|update building')