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"]],["上次更新時間: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."]]],[]]