পড়ুন, অনুলিপি করুন এবং অনুসন্ধান করুন "অন্যান্য পরিচিতি"

আপনি Get Ready to Use the People API- এ পদক্ষেপগুলি সম্পূর্ণ করার পরে, আপনি "অন্যান্য পরিচিতি" ডেটা পড়তে, অনুলিপি করতে এবং অনুসন্ধান করতে প্রস্তুত৷

নিম্নলিখিত কোড নমুনাগুলি দেখায় কিভাবে কয়েকটি সহজ অনুরোধ পাঠাতে হয়। পদ্ধতির সম্পূর্ণ তালিকার জন্য, রেফারেন্স ডকুমেন্টেশন দেখুন।

ব্যবহারকারীর "অন্যান্য পরিচিতি" তালিকাভুক্ত করুন

ব্যবহারকারীর "অন্যান্য পরিচিতি" এ থাকা ব্যক্তিদের তালিকা পেতে , নিম্নলিখিত কোডটি ব্যবহার করুন:

GET /v1/otherContacts?readMask=names,emailAddresses HTTP/1.1
Host: people.googleapis.com
ListOtherContactsResponse response = peopleService.otherContacts().list()
   
.setReadMask("metadata,names,emailAddresses")
   
.execute();

List<Person> otherContacts = response.getOtherContacts();

পরিবর্তিত ব্যবহারকারীর "অন্যান্য পরিচিতি" তালিকাভুক্ত করুন

জাভা
// Initial request
ListOtherContactsResponse fullSyncResponse = peopleService.otherContacts().list()
   
.setReadMask("metadata,names,emailAddresses")
   
.setRequestSyncToken(true)
   
.execute();
// Fetch all the pages
while (fullSyncResponse.getNextPageToken() != null) {
  fullSyncResponse
= peopleService.otherContacts().list()
     
.setReadMask("metadata,names,emailAddresses")
     
.setRequestSyncToken(true)
     
.setPageToken(fullSyncResponse.getNextPageToken())
     
.execute();
}

// Some time passes

// Fetch incremental changes using the sync token returned in the last fullSyncResponse.
try {
 
ListOtherContactsResponse incrementalSyncResponse = peopleService.otherContacts().list()
     
.setReadMask("metadata,names,emailAddresses")
     
.setSyncToken(fullSyncResponse.getNextSyncToken())
     
.execute();
 
for (Person person : incrementalSyncResponse.getOtherContacts()) {
    handlePerson
(person);
 
}
 
 
// Fetch all the pages
 
while (!incrementalSyncResponse.getNextPageToken().isEmpty()) {
    incrementalSyncResponse
= peopleService.otherContacts().list()
       
.setReadMask("metadata,names,emailAddresses")
       
.setSyncToken(fullSyncResponse.getNextSyncToken())
       
.setPageToken(incrementalSyncResponse.getNextPageToken())
       
.execute();
   
for (Person person : incrementalSyncResponse.getOtherContacts()) {
      handlePerson
(person);
   
}
 
}
} catch (GoogleJsonResponseException e) {
 
if (e.getStatusCode() == 410) {
   
// Sync token expired. Make full sync request.
 
}
}

void handlePerson(Person person) {
 
if (person.getMetadata().getDeleted()) {
   
// Handle deleted person
 
} else {
   
// Handle changed person
 
}
}

ListOtherContacts- এ সিঙ্ক আচরণ সম্পর্কে আরও বিশদ বিবরণ।

"myContacts" গ্রুপে একটি "অন্যান্য পরিচিতি" কপি করুন

"myContacts" গ্রুপে একটি "অন্যান্য পরিচিতি" কপি করতে , নিম্নলিখিত কোডটি ব্যবহার করুন:

POST /v1/resource_name:copyOtherContactToMyContactsGroup?copyMask=names,emailAddresses,phoneNumbers HTTP/1.1
Host: people.googleapis.com
Person copiedContact = peopleService
   
.otherContacts()
   
.copyOtherContactToMyContactsGroup(
       
"resource_name",
       
new CopyOtherContactToMyContactsGroupRequest()
           
.setCopyMask("names,emailAddresses,phoneNumbers"))
   
.execute();

ব্যবহারকারীর "অন্যান্য পরিচিতি" অনুসন্ধান করুন

ব্যবহারকারীর সমস্ত "অন্যান্য পরিচিতি" অনুসন্ধান করতে, নিম্নলিখিত কোডটি ব্যবহার করুন:

প্রোটোকল জাভা
// Warmup cache
GET
/v1/otherContacts:search?query=&readMask=names,emailAddresses HTTP/1.1
Host: people.googleapis.com

// Send search request after several seconds
GET
/v1/otherContacts:search?query=query&readMask=names,emailAddresses HTTP/1.1
Host: people.googleapis.com
// Warmup cache
SearchResponse response = peopleService.otherContacts().search()
   
.setQuery("")
   
.setReadMask("names,emailAddresses")
   
.execute();

// Wait a few seconds
Thread.sleep(5);

// Send search request
SearchResponse response = peopleService.otherContacts().search()
   
.setQuery("query")
   
.setReadMask("names,emailAddresses")
   
.execute();
,

আপনি Get Ready to Use the People API- এ পদক্ষেপগুলি সম্পূর্ণ করার পরে, আপনি "অন্যান্য পরিচিতি" ডেটা পড়তে, অনুলিপি করতে এবং অনুসন্ধান করতে প্রস্তুত৷

নিম্নলিখিত কোড নমুনাগুলি দেখায় কিভাবে কয়েকটি সহজ অনুরোধ পাঠাতে হয়। পদ্ধতির সম্পূর্ণ তালিকার জন্য, রেফারেন্স ডকুমেন্টেশন দেখুন।

ব্যবহারকারীর "অন্যান্য পরিচিতি" তালিকাভুক্ত করুন

ব্যবহারকারীর "অন্যান্য পরিচিতি" এ থাকা ব্যক্তিদের তালিকা পেতে , নিম্নলিখিত কোডটি ব্যবহার করুন:

GET /v1/otherContacts?readMask=names,emailAddresses HTTP/1.1
Host: people.googleapis.com
ListOtherContactsResponse response = peopleService.otherContacts().list()
   
.setReadMask("metadata,names,emailAddresses")
   
.execute();

List<Person> otherContacts = response.getOtherContacts();

পরিবর্তিত ব্যবহারকারীর "অন্যান্য পরিচিতি" তালিকাভুক্ত করুন

জাভা
// Initial request
ListOtherContactsResponse fullSyncResponse = peopleService.otherContacts().list()
   
.setReadMask("metadata,names,emailAddresses")
   
.setRequestSyncToken(true)
   
.execute();
// Fetch all the pages
while (fullSyncResponse.getNextPageToken() != null) {
  fullSyncResponse
= peopleService.otherContacts().list()
     
.setReadMask("metadata,names,emailAddresses")
     
.setRequestSyncToken(true)
     
.setPageToken(fullSyncResponse.getNextPageToken())
     
.execute();
}

// Some time passes

// Fetch incremental changes using the sync token returned in the last fullSyncResponse.
try {
 
ListOtherContactsResponse incrementalSyncResponse = peopleService.otherContacts().list()
     
.setReadMask("metadata,names,emailAddresses")
     
.setSyncToken(fullSyncResponse.getNextSyncToken())
     
.execute();
 
for (Person person : incrementalSyncResponse.getOtherContacts()) {
    handlePerson
(person);
 
}
 
 
// Fetch all the pages
 
while (!incrementalSyncResponse.getNextPageToken().isEmpty()) {
    incrementalSyncResponse
= peopleService.otherContacts().list()
       
.setReadMask("metadata,names,emailAddresses")
       
.setSyncToken(fullSyncResponse.getNextSyncToken())
       
.setPageToken(incrementalSyncResponse.getNextPageToken())
       
.execute();
   
for (Person person : incrementalSyncResponse.getOtherContacts()) {
      handlePerson
(person);
   
}
 
}
} catch (GoogleJsonResponseException e) {
 
if (e.getStatusCode() == 410) {
   
// Sync token expired. Make full sync request.
 
}
}

void handlePerson(Person person) {
 
if (person.getMetadata().getDeleted()) {
   
// Handle deleted person
 
} else {
   
// Handle changed person
 
}
}

ListOtherContacts- এ সিঙ্ক আচরণ সম্পর্কে আরও বিশদ বিবরণ।

"myContacts" গ্রুপে একটি "অন্যান্য পরিচিতি" কপি করুন

"myContacts" গ্রুপে একটি "অন্যান্য পরিচিতি" কপি করতে , নিম্নলিখিত কোডটি ব্যবহার করুন:

POST /v1/resource_name:copyOtherContactToMyContactsGroup?copyMask=names,emailAddresses,phoneNumbers HTTP/1.1
Host: people.googleapis.com
Person copiedContact = peopleService
   
.otherContacts()
   
.copyOtherContactToMyContactsGroup(
       
"resource_name",
       
new CopyOtherContactToMyContactsGroupRequest()
           
.setCopyMask("names,emailAddresses,phoneNumbers"))
   
.execute();

ব্যবহারকারীর "অন্যান্য পরিচিতি" অনুসন্ধান করুন

ব্যবহারকারীর সমস্ত "অন্যান্য পরিচিতি" অনুসন্ধান করতে, নিম্নলিখিত কোডটি ব্যবহার করুন:

প্রোটোকল জাভা
// Warmup cache
GET
/v1/otherContacts:search?query=&readMask=names,emailAddresses HTTP/1.1
Host: people.googleapis.com

// Send search request after several seconds
GET
/v1/otherContacts:search?query=query&readMask=names,emailAddresses HTTP/1.1
Host: people.googleapis.com
// Warmup cache
SearchResponse response = peopleService.otherContacts().search()
   
.setQuery("")
   
.setReadMask("names,emailAddresses")
   
.execute();

// Wait a few seconds
Thread.sleep(5);

// Send search request
SearchResponse response = peopleService.otherContacts().search()
   
.setQuery("query")
   
.setReadMask("names,emailAddresses")
   
.execute();