From 0ca083f5e9e6cd6413297f9650d70a967b1a70d3 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Fri, 3 Nov 2017 14:40:38 -0400 Subject: [PATCH] Team Drive Theme support --- src/gam.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/gam.py b/src/gam.py index bcba5855..ffa5b2d3 100755 --- a/src/gam.py +++ b/src/gam.py @@ -3791,6 +3791,18 @@ def printDriveSettings(users): csvRows.append(row) writeCSVfile(csvRows, titles, u'User Drive Settings', todrive) +def getTeamDriveThemes(users): + for user in users: + user, drive = buildDrive3GAPIObject(user) + if not drive: + continue + themes = callGAPI(drive.about(), u'get', fields=u'teamDriveThemes', soft_errors=True) + if themes is None or u'teamDriveThemes' not in themes: + continue + print u'theme' + for theme in themes[u'teamDriveThemes']: + print theme[u'id'] + def printDriveActivity(users): drive_ancestorId = u'root' drive_fileId = None @@ -7283,6 +7295,15 @@ and accept the Terms of Service (ToS). As soon as you've accepted the ToS popup, def doCreateTeamDrive(users): body = {u'name': sys.argv[5]} + i = 6 + while i < len(sys.argv): + if sys.argv[i].lower() == u'theme': + body[u'themeId'] = sys.argv[i+1] + i += 2 + else: + print u'ERROR: %s is not a valid argument to "gam create teamdrive"' % sys.argv[i] + print sys.argv + sys.exit(3) for user in users: drive = buildGAPIServiceObject(u'drive3', user) requestId = unicode(uuid.uuid4()) @@ -7297,6 +7318,9 @@ def doUpdateTeamDrive(users): if sys.argv[i].lower() == u'name': body[u'name'] = sys.argv[i+1] i += 2 + elif sys.argv[i].lower() == u'theme': + body[u'themeId'] = sys.argv[i+1] + i += 2 else: print u'ERROR: %s is not a valid argument for "gam update drivefile"' sys.exit(3) @@ -12069,6 +12093,8 @@ def ProcessGAMCommand(args): showCalSettings(users) elif showWhat == u'drivesettings': printDriveSettings(users) + elif showWhat == u'teamdrivethemes': + getTeamDriveThemes(users) elif showWhat == u'drivefileacl': showDriveFileACL(users) elif showWhat == u'filelist':