import{createClientWithUserCredentials}from'./authentication-utils.js';constUSER_AUTH_OAUTH_SCOPES=['https://www.googleapis.com/auth/chat.users.readstate.readonly'];// This sample shows how to get the space read state for the calling userasyncfunctionmain(){// Create a clientconstchatClient=awaitcreateClientWithUserCredentials(USER_AUTH_OAUTH_SCOPES);// Initialize request argument(s)constrequest={// Replace SPACE_NAME herename:'users/me/spaces/SPACE_NAME/spaceReadState'};// Make the requestconstresponse=awaitchatClient.getSpaceReadState(request);// Handle the responseconsole.log(response);}main().catch(console.error);
如需运行此示例,请将 SPACE_NAME 替换为聊天室的 name 中的 ID。您可以通过调用 ListSpaces() 方法或从聊天室的网址获取该 ID。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-11-10。"],[[["This guide explains how to use the `get()` method to retrieve a user's read state within a Google Chat space using the Google Chat API."],["You need a Google Workspace account and a configured Google Cloud project with the Google Chat API enabled to use this functionality."],["The guide provides instructions and code samples (Node.js) to retrieve the calling user's space read state using the `GetSpaceReadState()` method."],["To get the read state, you need to specify the appropriate authorization scope and provide the space name in the request."],["For message-specific read states within a thread, refer to the separate guide on getting thread read states."]]],[]]