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 thread read state for a space and calling userasyncfunctionmain(){// Create a clientconstchatClient=awaitcreateClientWithUserCredentials(USER_AUTH_OAUTH_SCOPES);// Initialize request argument(s)constrequest={// Replace SPACE_NAME and THREAD_NAME herename:'users/me/spaces/SPACE_NAME/threads/THREAD_NAME/threadReadState'};// Make the requestconstresponse=awaitchatClient.getThreadReadState(request);// Handle the responseconsole.log(response);}main().catch(console.error);
[[["容易理解","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"]],["上次更新時間:2025-02-14 (世界標準時間)。"],[[["This guide explains how to use the `get()` method to retrieve a user's read state within a Google Chat message thread using the Google Chat API."],["The `ThreadReadState` resource provides details about a user's last read message in a thread."],["To get the thread read state, you need a Google Workspace account, a configured Google Cloud project with the Google Chat API enabled, and the Node.js Cloud Client Library installed."],["You must use the `chat.users.readstate` or `chat.users.readstate.readonly` authorization scope and call the `GetThreadReadState()` method, specifying the thread read state's name."],["The API returns a `ThreadReadState` instance containing the user's read state information."]]],["This guide details retrieving a user's read state within a Google Chat message thread using the `get()` method on the `ThreadReadState` resource. Key actions involve setting up a Google Cloud project, enabling the Chat API, and obtaining OAuth credentials. The process requires specifying either the `chat.users.readstate` or `chat.users.readstate.readonly` authorization scope, then calling `GetThreadReadState()` with the thread read state's `name`, including a user ID/alias and space ID. The method returns a `ThreadReadState` instance.\n"]]