mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-28 18:01:36 +00:00
Added additional options to gam <UserTypeEntity> print|show youtubechannels.
This commit is contained in:
@@ -59,7 +59,7 @@ If an item contains spaces, it should be surrounded by ".
|
||||
<ColorName> ::= <ColorNameGoogle>|<ColorNameWeb>
|
||||
<ColorValue> ::= <ColorName>|<ColorHex>
|
||||
<DayOfWeek> ::= mon|tue|wed|thu|fri|sat|sun
|
||||
<DriveLabelLanguageCode> ::=
|
||||
<BCP47LanguageCode> ::=
|
||||
ar-sa| # Arabic Saudi Arabia
|
||||
cs-cz| # Czech Czech Republic
|
||||
da-dk| # Danish Denmark
|
||||
@@ -1558,9 +1558,17 @@ gam calendar <CalendarEntity> printacl [todrive <ToDriveAttribute>*]
|
||||
<AttendeeAttendance> ::= optional|required
|
||||
<AttendeeStatus> ::= accepted|declined|needsaction|tentative
|
||||
|
||||
<EventType> ::=
|
||||
default|
|
||||
focustime|
|
||||
outofoffice|
|
||||
workinglocation
|
||||
<EventTypeList> ::= "<EventType>(,<EventType>)*"
|
||||
|
||||
<EventSelectProperty> ::=
|
||||
(after|starttime|timemin <Time>)|
|
||||
(before|endtime|timemax <Time>)|
|
||||
(eventtypes <EventTypeList>)|
|
||||
(query <QueryCalendar>)|
|
||||
(privateextendedproperty <String>)|
|
||||
(sharedextendedproperty <Syting>)|
|
||||
@@ -1635,11 +1643,7 @@ gam calendar <CalendarEntity> printacl [todrive <ToDriveAttribute>*]
|
||||
tentative|
|
||||
(timezone <TimeZone>)|
|
||||
(transparency opaque|transparent)|
|
||||
(visibility default|public|private)|
|
||||
(workinglocation (home|
|
||||
(custom <String>)|
|
||||
(office <String> [building|buildingid <String>] [floor|floorname <String>]
|
||||
[section|floorsection <String>] [desk|deskcode <String>])))
|
||||
(visibility default|public|private)
|
||||
|
||||
The following attributes are equivalent:
|
||||
available - transparency transparent
|
||||
@@ -1719,12 +1723,21 @@ gam calendar|calendars <CalendarEntity> empty calendartrash
|
||||
creator.id|
|
||||
creator.self
|
||||
|
||||
<EventFocusTimePropertiesSubfieldName> ::=
|
||||
focustime.autodeclinemode|
|
||||
focustime.chatstatus|
|
||||
focustime.declinemessage
|
||||
|
||||
<EventOrganizerSubfieldName> ::=
|
||||
organizer.displayname|
|
||||
organizer.email|
|
||||
organizer.id|
|
||||
organizer.self
|
||||
|
||||
<EventOutOfOfficePropertiesSubfieldName> ::=
|
||||
outofoffice.autodeclinemode|
|
||||
outofoffice.declinemessage
|
||||
|
||||
<EventWorkingLocationPropertiesSubfieldName> ::=
|
||||
workinglocationproperties.homeoffice|
|
||||
workinglocationproperties.customlocation|
|
||||
@@ -1748,6 +1761,8 @@ gam calendar|calendars <CalendarEntity> empty calendartrash
|
||||
endtimeunspecified|
|
||||
extendedproperties|
|
||||
eventtype|
|
||||
focustimeproperties|
|
||||
<EventFocusTimePropertiesSubfieldName>|
|
||||
gadget|
|
||||
guestscaninviteothers|
|
||||
guestscanmodify|
|
||||
@@ -1761,6 +1776,8 @@ gam calendar|calendars <CalendarEntity> empty calendartrash
|
||||
organizer|
|
||||
<EventOrganizerSubfieldName>|
|
||||
originalstart|originalstarttime|
|
||||
outofofficeproperties|
|
||||
<EventOutOfOfficePropertiesSubfieldName>
|
||||
privatecopy|
|
||||
recurrence|
|
||||
recurringeventid|
|
||||
@@ -5534,12 +5551,20 @@ gam <UserTypeEntity> transfer seccals <UserItem> [keepuser] [sendnotifications <
|
||||
<AttendeeAttendance> ::= optional|required
|
||||
<AttendeeStatus> ::= accepted|declined|needsaction|tentative
|
||||
|
||||
<EventType> ::=
|
||||
default|
|
||||
focustime|
|
||||
outofoffice|
|
||||
workinglocation
|
||||
<EventTypeList> ::= "<EventType>(,<EventType>)*"
|
||||
|
||||
<EventSelectProperty> ::=
|
||||
(after|starttime|timemin <Time>)|
|
||||
(before|endtime|timemax <Time>)|
|
||||
(eventtypes <EventTypeList>)|
|
||||
(query <QueryCalendar>)|
|
||||
(privateextendedproperty <String>)|
|
||||
(sharedextendedproperty <Syting>)|
|
||||
(sharedextendedproperty <String>)|
|
||||
showdeletedevents|
|
||||
showhiddeninvitations|
|
||||
singleevents|
|
||||
@@ -6129,15 +6154,15 @@ gam <UserTypeEntity> delete permissions <DriveFileEntity> <DriveFilePermissionID
|
||||
<PermissionMatch>* [<PermissionMatchAction>]
|
||||
|
||||
gam [<UserTypeEntity>] info drivelabels <DriveLabelNameEntity>
|
||||
[[basic|full] [languagecode <DriveLabelLanguageCode>]
|
||||
[[basic|full] [languagecode <BCP47LanguageCode>]
|
||||
[formatjson] [adminaccess|asadmin]
|
||||
|
||||
gam [<UserTypeEntity>] print <drivelabels> [todrive <ToDriveAttribute>*]
|
||||
[basic|full] [languagecode <DriveLabelLanguageCode>]
|
||||
[basic|full] [languagecode <BCP47LanguageCode>]
|
||||
[publishedonly [<Boolean>]] [minimumrole applier|editor|organizer|reader]
|
||||
[formatjson [quotechar <Character>]] [adminaccess|asadmin]
|
||||
gam [<UserTypeEntity>] show drivelabels
|
||||
[basic|full] [languagecode <DriveLabelLanguageCode>]
|
||||
[basic|full] [languagecode <BCP47LanguageCode>]
|
||||
[publishedonly [<Boolean>]] [minimumrole applier|editor|organizer|reader]
|
||||
[formatjson] [adminaccess|asadmin]
|
||||
|
||||
@@ -7648,11 +7673,19 @@ gam print tokens|token [todrive <ToDriveAttribute>*] [clientid <ClientID>]
|
||||
<YouTubeChannelFieldNameList> ::= "<YouTubeChannelFieldName>(,<YouTubeChannelFieldName>)*"
|
||||
|
||||
gam <UserTypeEntity> show youtubechannels
|
||||
[channels <YouTubeChannelIDList>]
|
||||
(mine|
|
||||
(ids|channels <YouTubeChannelIDList>)|
|
||||
(forusername <String>)|
|
||||
(managedbyme <String>))
|
||||
[languagecode <BCP47LanguageCode>]
|
||||
[allfields|(fields <YouTubeChannelFieldNameList>)]
|
||||
[formatjson]
|
||||
gam <UserTypeEntity> print youtubechannels [todrive <ToDriveAttribute>*]
|
||||
[channels <YouTubeChannelIDList>]
|
||||
(mine|
|
||||
(ids|channels <YouTubeChannelIDList>)|
|
||||
(forusername <String>)|
|
||||
(managedbyme <String>))
|
||||
[languagecode <BCP47LanguageCode>]
|
||||
[allfields|(fields <YouTubeChannelFieldNameList>)]
|
||||
[formatjson [quotechar <Character>]]
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
Merged GAM-Team version
|
||||
|
||||
6.65.15
|
||||
|
||||
Added additional options to `gam <UserTypeEntity> print|show youtubechannels`.
|
||||
|
||||
6.65.14
|
||||
|
||||
Fixed bug in gam <UserTypeEntity> copy|move drivefile` that caused a trap.
|
||||
|
||||
@@ -48468,7 +48468,7 @@ def createWorkingLocation(users):
|
||||
if not cal:
|
||||
continue
|
||||
jcount = len(dateList)
|
||||
entityPerformAction([Ent.CALENDAR, user, Ent.WORKING_LOCATION, None], i, count)
|
||||
entityPerformAction([Ent.CALENDAR, user, Ent.EVENT_WORKINGLOCATION, None], i, count)
|
||||
Ind.Increment()
|
||||
j = 0
|
||||
for wlDate in dateList:
|
||||
@@ -48536,7 +48536,7 @@ def deleteWorkingLocation(users):
|
||||
if not cal:
|
||||
continue
|
||||
jcount = len(dateList)
|
||||
entityPerformAction([Ent.CALENDAR, user, Ent.WORKING_LOCATION, None], i, count)
|
||||
entityPerformAction([Ent.CALENDAR, user, Ent.EVENT_WORKINGLOCATION, None], i, count)
|
||||
Ind.Increment()
|
||||
j = 0
|
||||
for wlDate in dateList:
|
||||
@@ -48695,33 +48695,51 @@ YOUTUBE_CHANNEL_FIELDS_CHOICE_MAP = {
|
||||
YOUTUBE_CHANNEL_TIME_OBJECTS = {'publishedAt'}
|
||||
|
||||
# gam <UserTypeEntity> show youtubechannels
|
||||
# [channels <YouTubeChannelIDList>]
|
||||
# (mine|
|
||||
# (ids|channels <YouTubeChannelIDList>)|
|
||||
# (forusername <String>)|
|
||||
# (managedbyme <String>))
|
||||
# [languagecode <BCP47LanguageCode>]
|
||||
# [allfields|(fields <YouTubeChannelFieldNameList>)]
|
||||
# [formatjson]
|
||||
# gam <UserTypeEntity> print youtubechannels [todrive <ToDriveAttribute>*]
|
||||
# [channels <YouTubeChannelIDList>]
|
||||
# (mine|
|
||||
# (ids|channels <YouTubeChannelIDList>)|
|
||||
# (forusername <String>)|
|
||||
# (managedbyme <String>))
|
||||
# [languagecode <BCP47LanguageCode>]
|
||||
# [allfields|(fields <YouTubeChannelFieldNameList>)]
|
||||
# [formatjson [quotechar <Character>]]
|
||||
def printShowYouTubeChannel(users):
|
||||
csvPF = CSVPrintFile(['User', 'id'], 'sortall') if Act.csvFormat() else None
|
||||
FJQC = FormatJSONQuoteChar(csvPF)
|
||||
kwargs = {'mine': True}
|
||||
languageCode = ''
|
||||
fieldsList = ['id']
|
||||
while Cmd.ArgumentsRemaining():
|
||||
myarg = getArgument()
|
||||
if csvPF and myarg == 'todrive':
|
||||
csvPF.GetTodriveParameters()
|
||||
elif myarg in {'channel', 'channels'}:
|
||||
kwargs.pop('mine', None)
|
||||
kwargs['id'] = ','.join(getEntityList(Cmd.OB_YOUTUBE_CHANNEL_ID_LIST))
|
||||
elif myarg == 'mine':
|
||||
kwargs = {'mine': True}
|
||||
elif myarg in {'id', 'ids', 'channel', 'channels'}:
|
||||
kwargs = {'id': ','.join(getEntityList(Cmd.OB_YOUTUBE_CHANNEL_ID_LIST))}
|
||||
elif myarg == 'forusername':
|
||||
kwargs = {'forUsername': getString(Cmd.OB_USER_NAME)}
|
||||
elif myarg == 'managedbyme':
|
||||
kwargs = {'managedByMe': True, 'onBehalfOfContentOwner': getString(Cmd.OB_USER_NAME)}
|
||||
elif getFieldsList(myarg, YOUTUBE_CHANNEL_FIELDS_CHOICE_MAP, fieldsList):
|
||||
pass
|
||||
elif myarg == 'allfields':
|
||||
for field in YOUTUBE_CHANNEL_FIELDS_CHOICE_MAP:
|
||||
addFieldToFieldsList(field, YOUTUBE_CHANNEL_FIELDS_CHOICE_MAP, fieldsList)
|
||||
elif myarg in {'languagecode', 'hl'}:
|
||||
languageCode = getLanguageCode(BCP47_LANGUAGE_CODES_MAP)
|
||||
else:
|
||||
FJQC.GetFormatJSONQuoteChar(myarg, True)
|
||||
kwargs['part'] = ','.join(set(fieldsList))
|
||||
if languageCode:
|
||||
kwargs['hl'] = languageCode
|
||||
i, count, users = getEntityArgument(users)
|
||||
for user in users:
|
||||
i += 1
|
||||
@@ -48732,9 +48750,15 @@ def printShowYouTubeChannel(users):
|
||||
channels = callGAPIpages(yt.channels(), 'list', 'items',
|
||||
throwReasons=GAPI.YOUTUBE_THROW_REASONS,
|
||||
fields='nextPageToken,items', **kwargs)
|
||||
except GAPI.unsupportedSupervisedAccount as e:
|
||||
except (GAPI.unsupportedSupervisedAccount, GAPI.unsupportedLanguageCode) as e:
|
||||
entityActionFailedWarning([Ent.USER, user], str(e), i, count)
|
||||
continue
|
||||
except GAPI.contentOwnerAccountNotFound as e:
|
||||
if 'managedByMe' in kwargs:
|
||||
entityActionFailedWarning([Ent.USER, user, Ent.OWNER, kwargs['onBehalfOfContentOwner']], str(e), i, count)
|
||||
else:
|
||||
entityActionFailedWarning([Ent.USER, user], str(e), i, count)
|
||||
continue
|
||||
except (GAPI.serviceNotAvailable, GAPI.authError):
|
||||
entityServiceNotApplicableWarning(Ent.USER, user, i, count)
|
||||
continue
|
||||
@@ -59964,7 +59988,7 @@ def _showDriveLabel(label, j, jcount, FJQC):
|
||||
Ind.Decrement()
|
||||
|
||||
# gam [<UserTypeEntity>] info drivelabels <DriveLabelNameEntity>
|
||||
# [[basic|full] [languagecode <DriveLabelLanguageCode>]
|
||||
# [[basic|full] [languagecode <BCP47LanguageCode>]
|
||||
# [formatjson] [adminaccess|asadmin]
|
||||
def infoDriveLabels(users, useAdminAccess=False):
|
||||
driveLabelNameEntity = getUserObjectEntity(Cmd.OB_DRIVE_LABEL_NAME, Ent.DRIVE_LABEL_NAME, shlexSplit=True)
|
||||
@@ -60009,11 +60033,11 @@ def doInfoDriveLabels():
|
||||
infoDriveLabels([_getAdminEmail()], True)
|
||||
|
||||
# gam [<UserTypeEntity>] print drivelabels> [todrive <ToDriveAttribute>*]
|
||||
# [basic|full] [languagecode <DriveLabelLanguageCode>]
|
||||
# [basic|full] [languagecode <BCP47LanguageCode>]
|
||||
# [publishedonly [<Boolean>]] [minimumrole applier|editor|organizer|reader]
|
||||
# [formatjson [quotechar <Character>]] [adminaccess|asadmin]
|
||||
# gam [<UserTypeEntity>] show drivelabels
|
||||
# [basic|full] [languagecode <DriveLabelLanguageCode>]
|
||||
# [basic|full] [languagecode <BCP47LanguageCode>]
|
||||
# [publishedonly [<Boolean>]] [minimumrole applier|editor|organizer|reader]
|
||||
# [formatjson] [adminaccess|asadmin]
|
||||
def printShowDriveLabels(users, useAdminAccess=False):
|
||||
|
||||
@@ -586,6 +586,8 @@ class GamCLArgs():
|
||||
ARG_FILETREE = 'filetree'
|
||||
ARG_FILTER = 'filter'
|
||||
ARG_FILTERS = 'filters'
|
||||
ARG_FOCUSTIME = 'focustime'
|
||||
ARG_FOCUSTIMES = 'focustimes'
|
||||
ARG_FORM = 'form'
|
||||
ARG_FORMS = 'forms'
|
||||
ARG_FORMRESPONSE = 'formresponse'
|
||||
@@ -667,6 +669,8 @@ class GamCLArgs():
|
||||
ARG_OUS = 'ous'
|
||||
ARG_OUSHAREDDRIVE = 'oushareddrive'
|
||||
ARG_OUSHAREDDRIVES = 'oushareddrives'
|
||||
ARG_OUTOFOFFICE = 'outofoffice'
|
||||
ARG_OUTOFOFFICES = 'outofoffices'
|
||||
ARG_OUTREE = 'outree'
|
||||
ARG_OWNERSHIP = 'ownership'
|
||||
ARG_PARTICIPANTS = 'participants'
|
||||
|
||||
@@ -201,6 +201,9 @@ class GamEntity():
|
||||
END_TIME = 'endt'
|
||||
ENTITY = 'enti'
|
||||
EVENT = 'evnt'
|
||||
EVENT_FOCUSTIME = 'evft'
|
||||
EVENT_OUTOFOFFICE = 'evoo'
|
||||
EVENT_WORKINGLOCATION = 'evwl'
|
||||
FEATURE = 'feat'
|
||||
FIELD = 'fiel'
|
||||
FILE = 'file'
|
||||
@@ -362,7 +365,6 @@ class GamEntity():
|
||||
VAULT_OPERATION = 'vlto'
|
||||
VAULT_QUERY = 'vltq'
|
||||
WEBCLIPS_ENABLED = 'webc'
|
||||
WORKING_LOCATION = 'wrkl'
|
||||
YOUTUBE_CHANNEL = 'ytch'
|
||||
# _NAMES[0] is plural, _NAMES[1] is singular unless the item name is explicitly plural (Calendar Settings)
|
||||
# For items with Boolean values, both entries are singular (Forward, POP)
|
||||
@@ -528,6 +530,9 @@ class GamEntity():
|
||||
END_TIME: ['End Times', 'End Time'],
|
||||
ENTITY: ['Entities', 'Entity'],
|
||||
EVENT: ['Events', 'Event'],
|
||||
EVENT_FOCUSTIME: ['Focus Time Events', 'Focus Time Event'],
|
||||
EVENT_OUTOFOFFICE: ['Out of Office Events', 'Out of Office Event'],
|
||||
EVENT_WORKINGLOCATION: ['Working Location Events', 'Working Location Event'],
|
||||
FEATURE: ['Features', 'Feature'],
|
||||
FIELD: ['Fields', 'Field'],
|
||||
FILE: ['Files', 'File'],
|
||||
@@ -689,7 +694,6 @@ class GamEntity():
|
||||
VAULT_OPERATION: ['Vault Operations', 'Vault Operation'],
|
||||
VAULT_QUERY: ['Vault Queries', 'Vault Query'],
|
||||
WEBCLIPS_ENABLED: ['Web Clips Enabled', 'Web Clips Enabled'],
|
||||
WORKING_LOCATION: ['Working Locations', 'Working Location'],
|
||||
YOUTUBE_CHANNEL: ['YouTube Channels', 'YouTube Channel'],
|
||||
ROLE_MANAGER: ['Managers', 'Manager'],
|
||||
ROLE_MEMBER: ['Members', 'Member'],
|
||||
|
||||
@@ -52,6 +52,7 @@ CANNOT_SHARE_TEAMDRIVE_WITH_NONGOOGLE_ACCOUNTS = 'cannotShareTeamDriveWithNonGoo
|
||||
CANNOT_UPDATE_PERMISSION = 'cannotUpdatePermission'
|
||||
CONDITION_NOT_MET = 'conditionNotMet'
|
||||
CONFLICT = 'conflict'
|
||||
CONTENT_OWNER_ACCOUNT_NOT_FOUND = 'contentOwnerAccountNotFound'
|
||||
CROSS_DOMAIN_MOVE_RESTRICTION = 'crossDomainMoveRestriction'
|
||||
CUSTOMER_EXCEEDED_ROLE_ASSIGNMENTS_LIMIT = 'CUSTOMER_EXCEEDED_ROLE_ASSIGNMENTS_LIMIT'
|
||||
CUSTOMER_NOT_FOUND = 'customerNotFound'
|
||||
@@ -164,6 +165,7 @@ TEAMDRIVES_SHORTCUT_FILE_NOT_SUPPORTED = 'teamDrivesShortcutFileNotSupported'
|
||||
TIME_RANGE_EMPTY = 'timeRangeEmpty'
|
||||
TRANSIENT_ERROR = 'transientError'
|
||||
UNKNOWN_ERROR = 'unknownError'
|
||||
UNSUPPORTED_LANGUAGE_CODE = 'unsupportedLanguageCode'
|
||||
UNSUPPORTED_SUPERVISED_ACCOUNT = 'unsupportedSupervisedAccount'
|
||||
UPLOAD_TOO_LARGE = 'uploadTooLarge'
|
||||
USER_CANNOT_CREATE_TEAMDRIVES = 'userCannotCreateTeamDrives'
|
||||
@@ -263,7 +265,7 @@ SHEETS_ACCESS_THROW_REASONS = DRIVE_USER_THROW_REASONS+[NOT_FOUND, PERMISSION_DE
|
||||
TASK_THROW_REASONS = [SERVICE_NOT_AVAILABLE, BAD_REQUEST, PERMISSION_DENIED, INVALID, NOT_FOUND, ACCESS_NOT_CONFIGURED]
|
||||
TASKLIST_THROW_REASONS = [SERVICE_NOT_AVAILABLE, BAD_REQUEST, PERMISSION_DENIED, INVALID, NOT_FOUND, ACCESS_NOT_CONFIGURED]
|
||||
USER_GET_THROW_REASONS = [USER_NOT_FOUND, DOMAIN_NOT_FOUND, DOMAIN_CANNOT_USE_APIS, FORBIDDEN, BAD_REQUEST, SYSTEM_ERROR]
|
||||
YOUTUBE_THROW_REASONS = [SERVICE_NOT_AVAILABLE, AUTH_ERROR, UNSUPPORTED_SUPERVISED_ACCOUNT]
|
||||
YOUTUBE_THROW_REASONS = [SERVICE_NOT_AVAILABLE, AUTH_ERROR, UNSUPPORTED_SUPERVISED_ACCOUNT, UNSUPPORTED_LANGUAGE_CODE, CONTENT_OWNER_ACCOUNT_NOT_FOUND]
|
||||
|
||||
REASON_MESSAGE_MAP = {
|
||||
ABORTED: [
|
||||
@@ -394,6 +396,8 @@ class conditionNotMet(Exception):
|
||||
pass
|
||||
class conflict(Exception):
|
||||
pass
|
||||
class contentOwnerAccountNotFound(Exception):
|
||||
pass
|
||||
class crossDomainMoveRestriction(Exception):
|
||||
pass
|
||||
class customerExceededRoleAssignmentsLimit(Exception):
|
||||
@@ -614,6 +618,8 @@ class transientError(Exception):
|
||||
pass
|
||||
class unknownError(Exception):
|
||||
pass
|
||||
class unsupportedLanguageCode(Exception):
|
||||
pass
|
||||
class unsupportedSupervisedAccount(Exception):
|
||||
pass
|
||||
class uploadTooLarge(Exception):
|
||||
@@ -659,6 +665,7 @@ REASON_EXCEPTION_MAP = {
|
||||
CANNOT_UPDATE_PERMISSION: cannotUpdatePermission,
|
||||
CONDITION_NOT_MET: conditionNotMet,
|
||||
CONFLICT: conflict,
|
||||
CONTENT_OWNER_ACCOUNT_NOT_FOUND: contentOwnerAccountNotFound,
|
||||
CROSS_DOMAIN_MOVE_RESTRICTION: crossDomainMoveRestriction,
|
||||
CUSTOMER_EXCEEDED_ROLE_ASSIGNMENTS_LIMIT: customerExceededRoleAssignmentsLimit,
|
||||
CUSTOMER_NOT_FOUND: customerNotFound,
|
||||
@@ -769,6 +776,7 @@ REASON_EXCEPTION_MAP = {
|
||||
TIME_RANGE_EMPTY: timeRangeEmpty,
|
||||
TRANSIENT_ERROR: transientError,
|
||||
UNKNOWN_ERROR: unknownError,
|
||||
UNSUPPORTED_LANGUAGE_CODE: unsupportedLanguageCode,
|
||||
UNSUPPORTED_SUPERVISED_ACCOUNT: unsupportedSupervisedAccount,
|
||||
UPLOAD_TOO_LARGE: uploadTooLarge,
|
||||
USER_CANNOT_CREATE_TEAMDRIVES: userCannotCreateTeamDrives,
|
||||
|
||||
Reference in New Issue
Block a user