किसी उपयोगकर्ता के स्पेस की सूचना सेटिंग देखना

इस गाइड में, उपयोगकर्ता के स्पेस की सूचना सेटिंग पाने के लिए, Google Chat API के SpaceNotificationSetting संसाधन पर get() तरीके का इस्तेमाल करने का तरीका बताया गया है.

SpaceNotificationSetting रिसॉर्स एक सिंगलटन रिसॉर्स है. इसमें किसी उपयोगकर्ता के स्पेस की सूचना सेटिंग की जानकारी दिखती है.

ज़रूरी शर्तें

Node.js

  • आपके पास Google Chat का ऐक्सेस हो और आपके पास Google Workspace का Business या Enterprise वर्शन वाला खाता हो.

कॉल करने वाले व्यक्ति के स्पेस की सूचना सेटिंग देखना

किसी उपयोगकर्ता के स्पेस की सूचना सेटिंग के बारे में जानकारी पाने के लिए, अपने अनुरोध में यह जानकारी शामिल करें:

  • chat.users.spacesettings अनुमति का स्कोप बताएं.
  • स्पेस की सूचना सेटिंग के name को पास करके, GetSpaceNotificationSetting() तरीका कॉल करें. इससे आपको उपयोगकर्ता आईडी या उपनाम और स्पेस आईडी मिलेगा. आपको सिर्फ़ कॉल करने वाले व्यक्ति के लिए सूचना पाने की सेटिंग दिखेंगी. सेटिंग तय करने के लिए, इनमें से किसी एक का इस्तेमाल करें:
    • me का दूसरा ईमेल पता. उदाहरण के लिए, users/me/spaces/SPACE_ID/spaceNotificationSetting.
    • कॉल करने वाले उपयोगकर्ता का Google Workspace ईमेल पता. उदाहरण के लिए, users/user@example.com/spaces/SPACE_ID/spaceNotificationSetting.
    • कॉल करने वाले उपयोगकर्ता का यूज़र आईडी. उदाहरण के लिए, users/USER/spaces/SPACE/spaceNotificationSetting.

इस उदाहरण में, कॉल करने वाले व्यक्ति के स्पेस की सूचना सेटिंग देखी जा रही हैं:

Node.js
chat/client-libraries/cloud/get-space-notification-setting-user-cred.js
import {createClientWithUserCredentials} from './authentication-utils.js';

const USER_AUTH_OAUTH_SCOPES = ['https://www.googleapis.com/auth/chat.users.spacesettings'];

// This sample shows how to get the space notification setting for the calling user
async function main() {
  // Create a client
  const chatClient = await createClientWithUserCredentials(USER_AUTH_OAUTH_SCOPES);

  // Initialize request argument(s), replace the SPACE_NAME with an actual space name.
  const request = {
    name : 'users/me/spaces/SPACE_NAME/spaceNotificationSetting'
  };

  // Make the request
  const response = await chatClient.getSpaceNotificationSetting(request);

  // Handle the response
  console.log(response);
}

main().catch(console.error);

इस सैंपल को चलाने के लिए, SPACE_ID को स्पेस के name से मिले आईडी से बदलें. आईडी पाने के लिए, ListSpaces() तरीका अपनाएं या स्पेस के यूआरएल का इस्तेमाल करें.

Google Chat API, स्पेस की सूचना सेटिंग की जानकारी पाता है और SpaceNotificationSetting का एक इंस्टेंस दिखाता है.