পরিচিতি পরিষেবা থেকে মানুষ API উন্নত পরিষেবাতে স্থানান্তর করুন৷

অ্যাপস স্ক্রিপ্ট ১৬ ডিসেম্বর, ২০২২ তারিখে কন্টাক্টস পরিষেবাটি বন্ধ করে দিয়েছে। পরিবর্তে, পিপল এপিআই অ্যাডভান্সড পরিষেবাটি ব্যবহার করুন। পিপল এপিআই একটি নতুন JSON প্রোটোকল ব্যবহার করে এবং প্রোফাইলের সাথে কন্টাক্ট মার্জ করার মতো উন্নত বৈশিষ্ট্যগুলি প্রদান করে।

পিপল এপিআই অ্যাডভান্সড সার্ভিসে কোন কোন কন্টাক্টস সার্ভিস মেথডের সমতুল্য নেই তা জানতে, এর পরিবর্তে আপনি কী ব্যবহার করতে পারেন তা জানতে এবং সাধারণ কাজগুলি মাইগ্রেট করার জন্য কোড নমুনা খুঁজে পেতে এই নির্দেশিকাটি ব্যবহার করুন। আরও তথ্যের জন্য, কন্টাক্টস এপিআই মাইগ্রেশন গাইড দেখুন।

পিপল এপিআই সমতুল্য ছাড়া পদ্ধতি

নিম্নলিখিত তালিকায় Contacts পরিষেবার getContacts পদ্ধতিগুলি দেওয়া হয়েছে, যেগুলির People API advanced পরিষেবাতে Contacts অনুসন্ধান করার সমতুল্য উপায় নেই। People API advanced পরিষেবার সাহায্যে, আপনি CONTACT উৎস থেকে আসা কোনও পরিচিতির names , nickNames , emailAddresses , phoneNumbers এবং organizations ক্ষেত্রগুলি ব্যবহার করে অনুসন্ধান করতে পারেন।

সমতুল্য ছাড়া পদ্ধতি
  • getContactsByAddress(query)
  • getContactsByAddress(query, label)
  • getContactsByAddress(query, label)
  • getContactsByCustomField(query, label)
  • getContactsByDate(month, day, label)
  • getContactsByDate(month, day, year, label)
  • getContactsByDate(month, day, year, label)
  • getContactsByIM(query)
  • getContactsByIM(query, label)
  • getContactsByJobTitle(query)
  • getContactsByNotes(query)
  • getContactsByUrl(query)
  • getContactsByUrl(query, label)
  • getContactsByGroup(group)

নিম্নলিখিত তালিকায় Contacts পরিষেবা থেকে getContacts পদ্ধতিগুলি দেওয়া হয়েছে যা অতিরিক্ত label প্যারামিটার ব্যবহার করে। আপনি People API অ্যাডভান্সড পরিষেবা থেকে searchContacts ব্যবহার করে সমতুল্য ক্ষেত্র অনুসারে পরিচিতি পেতে পারেন, তবে আপনি অনুসন্ধানকে একটি নির্দিষ্ট লেবেলে সীমাবদ্ধ রাখতে পারবেন না।

আংশিক সমতুল্য পদ্ধতি
  • getContactsByEmailAddress(query, label)
  • getContactsByName(query, label)
  • getContactsByPhone(query, label)

পিপল এপিআই-এর সাথে অতিরিক্ত বৈশিষ্ট্য উপলব্ধ

যখন আপনি People API অ্যাডভান্সড পরিষেবাতে মাইগ্রেট করেন, তখন আপনি নিম্নলিখিত People API বৈশিষ্ট্যগুলি অ্যাক্সেস করতে পারবেন যা Contacts পরিষেবাতে উপলব্ধ নয়:

সাধারণ কাজের জন্য কোড নমুনা

এই বিভাগে পরিচিতি পরিষেবা থেকে সাধারণ কাজগুলি তালিকাভুক্ত করা হয়েছে। কোড নমুনাগুলি দেখায় যে কীভাবে পিপল এপিআই অ্যাডভান্সড পরিষেবা ব্যবহার করে কাজগুলি তৈরি করতে হয়।

নামে একটি পরিচিতি গোষ্ঠী পান

নিচের কোড নমুনাটি দেখায় কিভাবে একটি পরিচিতি গোষ্ঠীকে তার নামের সাথে যুক্ত করতে হয়, যা পরিচিতি পরিষেবাতে getContactGroup(name) এর সমতুল্য।

উন্নত/মানুষ.gs
/**
 * Gets a contact group with the given name
 * @param {string} name The group name.
 * @see https://developers.google.com/people/api/rest/v1/contactGroups/list
 */
function getContactGroup(name) {
  try {
    const people = People.ContactGroups.list();
    // Finds the contact group for the person where the name matches.
    const group = people.contactGroups.find((group) => group.name === name);
    // Prints the contact group
    console.log("Group: %s", JSON.stringify(group, null, 2));
  } catch (err) {
    // TODO (developers) - Handle exception
    console.log(
      "Failed to get the contact group with an error %s",
      err.message,
    );
  }
}

ইমেল ঠিকানার মাধ্যমে একটি যোগাযোগ পান

নিম্নলিখিত কোড নমুনাটি দেখায় কিভাবে একটি পরিচিতিকে তাদের ইমেল ঠিকানা দিয়ে পেতে হয়, যা Contacts পরিষেবাতে getContact(emailAddress) এর সমতুল্য।

উন্নত/মানুষ.gs
/**
 * Gets a contact by the email address.
 * @param {string} email The email address.
 * @see https://developers.google.com/people/api/rest/v1/people.connections/list
 */
function getContactByEmail(email) {
  try {
    // Gets the person with that email address by iterating over all contacts.
    const people = People.People.Connections.list("people/me", {
      personFields: "names,emailAddresses",
    });
    const contact = people.connections.find((connection) => {
      return connection.emailAddresses.some(
        (emailAddress) => emailAddress.value === email,
      );
    });
    // Prints the contact.
    console.log("Contact: %s", JSON.stringify(contact, null, 2));
  } catch (err) {
    // TODO (developers) - Handle exception
    console.log("Failed to get the connection with an error %s", err.message);
  }
}

সকল পরিচিতি পান

নিম্নলিখিত কোড নমুনাটি দেখায় কিভাবে একজন ব্যবহারকারীর সমস্ত পরিচিতি পেতে হয়, যা Contacts পরিষেবাতে getContacts() এর সমতুল্য।

উন্নত/মানুষ.gs
/**
 * Gets a list of people in the user's contacts.
 * @see https://developers.google.com/people/api/rest/v1/people.connections/list
 */
function getConnections() {
  try {
    // Get the list of connections/contacts of user's profile
    const people = People.People.Connections.list("people/me", {
      personFields: "names,emailAddresses",
    });
    // Print the connections/contacts
    console.log("Connections: %s", JSON.stringify(people, null, 2));
  } catch (err) {
    // TODO (developers) - Handle exception here
    console.log("Failed to get the connection with an error %s", err.message);
  }
}

একজন পরিচিতির পুরো নাম পান

নিম্নলিখিত কোড নমুনাটি দেখায় কিভাবে একজন পরিচিতির পুরো নাম পেতে হয়, যা Contacts পরিষেবাতে getFullName() এর সমতুল্য।

উন্নত/মানুষ.gs
/**
 * Gets the full name (given name and last name) of the contact as a string.
 * @see https://developers.google.com/people/api/rest/v1/people/get
 */
function getFullName() {
  try {
    // Gets the person by specifying resource name/account ID
    // in the first parameter of People.People.get.
    // This example gets the person for the user running the script.
    const people = People.People.get("people/me", { personFields: "names" });
    // Prints the full name (given name + family name)
    console.log(`${people.names[0].givenName} ${people.names[0].familyName}`);
  } catch (err) {
    // TODO (developers) - Handle exception
    console.log("Failed to get the connection with an error %s", err.message);
  }
}

যোগাযোগের জন্য সমস্ত ফোন নম্বর পান

নিম্নলিখিত কোড নমুনাটি দেখায় কিভাবে একটি পরিচিতির জন্য সমস্ত ফোন নম্বর পেতে হয়, যা Contacts পরিষেবাতে getPhones() এর সমতুল্য।

উন্নত/মানুষ.gs
/**
 * Gets all the phone numbers for this contact.
 * @see https://developers.google.com/people/api/rest/v1/people/get
 */
function getPhoneNumbers() {
  try {
    // Gets the person by specifying resource name/account ID
    // in the first parameter of People.People.get.
    // This example gets the person for the user running the script.
    const people = People.People.get("people/me", {
      personFields: "phoneNumbers",
    });
    // Prints the phone numbers.
    console.log(people.phoneNumbers);
  } catch (err) {
    // TODO (developers) - Handle exception
    console.log("Failed to get the connection with an error %s", err.message);
  }
}

যোগাযোগের জন্য একটি নির্দিষ্ট ফোন নম্বর পান

নিম্নলিখিত কোড নমুনাটি দেখায় কিভাবে একটি পরিচিতির জন্য একটি নির্দিষ্ট ফোন নম্বর পেতে হয়, যা Contacts পরিষেবাতে getPhoneNumber() এর সমতুল্য।

উন্নত/মানুষ.gs
/**
 * Gets a phone number by type, such as work or home.
 * @see https://developers.google.com/people/api/rest/v1/people/get
 */
function getPhone() {
  try {
    // Gets the person by specifying resource name/account ID
    // in the first parameter of People.People.get.
    // This example gets the person for the user running the script.
    const people = People.People.get("people/me", {
      personFields: "phoneNumbers",
    });
    // Gets phone number by type, such as home or work.
    const phoneNumber = people.phoneNumbers.find(
      (phone) => phone.type === "home",
    ).value;
    // Prints the phone numbers.
    console.log(phoneNumber);
  } catch (err) {
    // TODO (developers) - Handle exception
    console.log("Failed to get the connection with an error %s", err.message);
  }
}