Multiple updates

This commit is contained in:
Ross Scroggs
2026-01-18 09:27:27 -08:00
parent aa05956d44
commit bb54fd113f
2 changed files with 28 additions and 4 deletions

View File

@@ -6567,8 +6567,10 @@ gam <UserTypeEntity> print chatsections [todrive <ToDriveAttribute>*]
[formatjson [quotechar <Character>]] [formatjson [quotechar <Character>]]
gam <UserTypeEntity> move chatsectionitem <ChatSectionItem> to <ChatSection> gam <UserTypeEntity> move chatsectionitem <ChatSectionItem> to <ChatSection>
gam <UserTypeEntity> show chatsectionitems <ChatSection> gam <UserTypeEntity> show chatsectionitems <ChatSection>
[space <ChatSpace>]
[formatjson] [formatjson]
gam <UserTypeEntity> print chatsectionitems <ChatSection> [todrive <ToDriveAttribute>*] gam <UserTypeEntity> print chatsectionitems <ChatSection> [todrive <ToDriveAttribute>*]
[space <ChatSpace>]
[formatjson [quotechar <Character>]] [formatjson [quotechar <Character>]]
gam <UserTypeEntity> create chatmember <ChatSpace> gam <UserTypeEntity> create chatmember <ChatSpace>

View File

@@ -27163,17 +27163,23 @@ def moveShowChatSectionItem(users):
continue continue
# gam <UserTypeEntity> show chatsectionitems <ChatSection> # gam <UserTypeEntity> show chatsectionitems <ChatSection>
# [space <ChatSpace>]
# [formatjson] # [formatjson]
# gam <UserTypeEntity> print chatsectionitems <ChatSection> [todrive <ToDriveAttribute>*] # gam <UserTypeEntity> print chatsectionitems <ChatSection> [todrive <ToDriveAttribute>*]
# [space <ChatSpace>]
# [formatjson [quotechar <Character>]] # [formatjson [quotechar <Character>]]
def printShowChatSectionItems(users): def printShowChatSectionItems(users):
csvPF = CSVPrintFile(['User', 'name']) if Act.csvFormat() else None cd = buildGAPIObject(API.DIRECTORY)
csvPF = CSVPrintFile(['User', 'name', 'space']) if Act.csvFormat() else None
FJQC = FormatJSONQuoteChar(csvPF) FJQC = FormatJSONQuoteChar(csvPF)
name = getChatSectionName() name = getChatSectionName()
kwargs = {}
while Cmd.ArgumentsRemaining(): while Cmd.ArgumentsRemaining():
myarg = getArgument() myarg = getArgument()
if csvPF and myarg == 'todrive': if csvPF and myarg == 'todrive':
csvPF.GetTodriveParameters() csvPF.GetTodriveParameters()
elif myarg == 'space' or myarg.startswith('spaces/') or myarg.startswith('space/'):
kwargs['filter'] = f'space = {getSpaceName(myarg)}'
else: else:
FJQC.GetFormatJSONQuoteChar(myarg, True) FJQC.GetFormatJSONQuoteChar(myarg, True)
i, count, users = getEntityArgument(users) i, count, users = getEntityArgument(users)
@@ -27185,6 +27191,9 @@ def printShowChatSectionItems(users):
_, chatsp, _ = buildChatServiceObject(API.CHAT_SPACES, user, i, count) _, chatsp, _ = buildChatServiceObject(API.CHAT_SPACES, user, i, count)
if not chatsp: if not chatsp:
continue continue
_, chatme, _ = buildChatServiceObject(API.CHAT_MEMBERSHIPS, user, i, count)
if not chatme:
continue
pname = name pname = name
if not pname.startswith('users/'): if not pname.startswith('users/'):
pname = f'users/{user}/{name}' pname = f'users/{user}/{name}'
@@ -27196,13 +27205,26 @@ def printShowChatSectionItems(users):
throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.INTERNAL_ERROR, throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.INTERNAL_ERROR,
GAPI.PERMISSION_DENIED, GAPI.FAILED_PRECONDITION], GAPI.PERMISSION_DENIED, GAPI.FAILED_PRECONDITION],
retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS, retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS,
parent=pname, pageSize=GC.Values[GC.CHAT_MAX_RESULTS]) parent=pname, pageSize=GC.Values[GC.CHAT_MAX_RESULTS], **kwargs)
for sectionItem in sectionItems: for sectionItem in sectionItems:
space = callGAPI(chatsp.spaces(), 'get', space = callGAPI(chatsp.spaces(), 'get',
throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.PERMISSION_DENIED, GAPI.FAILED_PRECONDITION], bailOnInternalError=True,
throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.INTERNAL_ERROR,
GAPI.PERMISSION_DENIED, GAPI.FAILED_PRECONDITION],
retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS,
name=sectionItem['space'], fields='displayName,spaceType') name=sectionItem['space'], fields='displayName,spaceType')
sectionItem['spaceDetails'] = {'spaceType': space['spaceType']} sectionItem['spaceDetails'] = {'spaceType': space['spaceType']}
if 'displayName' in space: if space['spaceType'] == 'DIRECT_MESSAGE':
members = callGAPIitems(chatme.spaces().members(), 'list', 'memberships',
bailOnInternalError=True,
throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.INTERNAL_ERROR,
GAPI.PERMISSION_DENIED, GAPI.FAILED_PRECONDITION],
retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS,
parent=sectionItem['space'], fields='memberships(member)')
for member in members:
_getChatMemberEmail(cd, member)
sectionItem['spaceDetails']['members'] = ' '.join([member['member']['email'] for member in members])
elif 'displayName' in space:
sectionItem['spaceDetails']['displayName'] = space['displayName'] sectionItem['spaceDetails']['displayName'] = space['displayName']
except (GAPI.notFound, GAPI.invalidArgument, GAPI.internalError, GAPI.permissionDenied) as e: except (GAPI.notFound, GAPI.invalidArgument, GAPI.internalError, GAPI.permissionDenied) as e:
exitIfChatNotConfigured(chat, kvList, str(e), i, count) exitIfChatNotConfigured(chat, kvList, str(e), i, count)