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

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

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

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

Node.js

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

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

  • chat.users.spacesettings अनुमति पाने का लिंक तय करें.
  • GetSpaceNotificationSetting() तरीके को कॉल करें. साथ ही, स्पेस सूचना सेटिंग का name पास करें. इसमें उपयोगकर्ता का आईडी या एलियस और स्पेस का आईडी शामिल होता है. सिर्फ़ कॉल करने वाले उपयोगकर्ता के लिए, सूचना सेटिंग पाई जा सकती हैं. सेटिंग तय करने के लिए, इनमें से कोई एक विकल्प इस्तेमाल करें:
    • 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);
}

await main();

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

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