অনুমোদন প্রয়োজন
কোনও পরিচিতি আপডেট করে। একটি উদাহরণ দেখুন।
অনুরোধ করুন
HTTP অনুরোধ
PUT https://www.googleapis.com/mirror/v1/contacts/id
প্যারামিটারগুলি
| প্যারামিটারের নাম | ভ্যালু | বিবরণ |
|---|---|---|
| পাথ প্যারামিটার | ||
id |
string |
পরিচিতির আইডি। |
অনুমোদন
এই অনুরোধের জন্য নিম্নলিখিত স্কোপ সহ অনুমোদনের প্রয়োজন (যাচাইকরণ ও অনুমোদন সম্পর্কে আরও পড়ুন)।
| সুযোগ |
|---|
https://www.googleapis.com/auth/glass.timeline |
অনুরোধের বডি
অনুরোধের প্রধান অংশে, নিম্নলিখিত প্রপার্টি সহ একটি পরিচিতি রিসোর্স প্রদান করুন:
| প্রপার্টির নাম | ভ্যালু | বিবরণ | নোট |
|---|---|---|---|
| প্রয়োজনীয় প্রপার্টি | |||
acceptCommands[].type |
string |
এই কমান্ড যে ধরনের অপারেশনের সাথে সম্পর্কিত। অনুমোদিত মান হল:
|
রাইট করা যাবে |
displayName |
string |
এই পরিচিতির জন্য দেখানোর নাম। | রাইট করা যাবে |
id |
string |
এই পরিচিতির জন্য একটি আইডি। এটি অ্যাপ্লিকেশন দ্বারা তৈরি করা হয় এবং একটি অস্বচ্ছ টোকেন হিসাবে বিবেচিত হয়। | রাইট করা যাবে |
imageUrls[] |
list |
কোনও পরিচিতির জন্য দেখানোর জন্য ছবির URL-এর সেট। বেশিরভাগ পরিচিতির একটিই ছবি থাকবে, তবে "গ্রুপ" পরিচিতিতে সর্বাধিক ৮টি ছবির URL থাকতে পারে এবং ক্লায়েন্টে সেগুলি ছোট বড় করে মোজাইক হিসেবে ক্রপ করা হবে। | রাইট করা যাবে |
| ঐচ্ছিক প্রপার্টি | |||
acceptCommands[] |
list |
ভয়েস মেনু কমান্ডের তালিকা যা কোনও পরিচিতি ম্যানেজ করতে পারে। প্রতিটি ভয়েস মেনু কমান্ডের জন্য Glass সর্বাধিক তিনটি পরিচিতি দেখায়। এর থেকে বেশি থাকলে, সেই নির্দিষ্ট কমান্ডের জন্য সবচেয়ে বেশি priority সহ তিনটি পরিচিতি দেখানো হয়। |
রাইট করা যাবে |
acceptTypes[] |
list |
কোনও পরিচিতি যে MIME-এর প্রকার সমর্থন করে তার তালিকা। আইটেমের অ্যাটাচমেন্টের যেকোনও ধরনের সাথে পরিচিতির যেকোনও acceptTypes মিললে, ব্যবহারকারীকে পরিচিতি দেখানো হবে। কোনও acceptTypes দেওয়া না থাকলে, সব আইটেমের জন্য পরিচিতি দেখানো হবে। | রাইট করা যাবে |
phoneNumber |
string |
পরিচিতির প্রাথমিক ফোন নম্বর। এটি দেশের কলিং কোড ও এলাকার কোড সহ সম্পূর্ণ নম্বর অথবা স্থানীয় নম্বর হতে পারে। | রাইট করা যাবে |
priority |
unsigned integer |
পরিচিতির তালিকায় ক্রম নির্ধারণ করার জন্য পরিচিতির অগ্রাধিকার। কম অগ্রাধিকারের পরিচিতির আগে বেশি অগ্রাধিকারের পরিচিতি দেখানো হবে। | রাইট করা যাবে |
speakableName |
string |
এই পরিচিতির নাম যেভাবে উচ্চারণ করা উচিত। ভয়েস দ্ব্যর্থতা নিরসন মেনুর অংশ হিসেবে এই পরিচিতির নাম বলতে হলে, এই নামটি প্রত্যাশিত উচ্চারণ হিসেবে ব্যবহার করা হয়। এটি এমন পরিচিতির নামের ক্ষেত্রে উপযোগী যেগুলি উচ্চারণ করা যায় না বা যেগুলির ডিসপ্লে বানান ফোনেটিক নয়। | রাইট করা যাবে |
type |
string |
এই পরিচিতির ধরন। এটি UI-তে সাজানোর জন্য ব্যবহার করা হয়। অনুমোদিত মান হল:
|
রাইট করা যাবে |
রেসপন্স
সফল হলে, এই পদ্ধতি রেসপন্স বডিতে একটি Contacts রিসোর্স ফেরত দেয়।
উদাহরণ
মনে রাখবেন: এই পদ্ধতির উদাহরণ হিসেবে যে কোড উপলভ্য রয়েছে তা সব কার্যকরী প্রোগ্রামিং ল্যাঙ্গোয়েজের বর্ণনা করে না (কোন কোন ল্যাঙ্গোয়েজ এতে কাজ করে তার সম্পূর্ণ তালিকা দেখার জন্য ক্লায়েন্ট লাইব্রেরি পৃষ্ঠা দেখুন)।
Java
Java ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।
import com.google.api.services.mirror.Mirror; import com.google.api.services.mirror.model.Contact; import java.io.IOException; public class MyClass { // ... /** * Rename an existing contact for the current user. * * @param service Authorized Mirror service. * @param contactId ID of the contact to rename. * @param newDisplayName New displayName for the contact. * @return Patched contact on success, {@code null} otherwise. */ public static Contact renameContact(Mirror service, String contactId, String newDisplayName) { try { // Get the latest version of the contact from the API. Contact contact = service.contacts().get(contactId).execute(); contact.setDisplayName(newDisplayName); // Send an update request to the API. return service. contacts().update(contactId, contact).execute(); } catch (IOException e) { System.err.println("An error occurred: " + e); return null; } } // ... }
.NET
.NET ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।
using System; using Google.Apis.Mirror.v1; using Google.Apis.Mirror.v1.Data; public class MyClass { // ... /// <summary> /// Rename an existing contact for the current user. /// </summary> /// <param name='service'>Authorized Mirror service.</param> /// <param name='contactId'>ID of the contact to rename.</param> /// <param name='newDisplayName'> /// New displayName for the contact. /// </param> /// <returns> /// Updated contact on success, null otherwise. /// </returns> public static Contact RRenameContact(MirrorService service, String contactId, String newDisplayName) { try { Contact contact = service.Contacts.Get(contactId).Fetch(); contact.DisplayName = newDisplayName; return service.Contacts.Update(contact, contactId).Fetch(); } catch (Exception e) { Console.WriteLine("An error occurred: " + e.Message); return null; } } // ... }
PHP
PHP ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।
/** * Rename an existing contact for the current user. * * @param Google_MirrorService $service Authorized Mirror service. * @param string $contactId ID of the contact to rename. * @param string $newDisplayName New displayName for the contact. * @return Google_Contact Updated contact on success, null otherwise. */ function renameContact($service, $contactId, $newDisplayName) { try { $updatedContact = $service->contacts->get($contactId); $updatedContact->setDisplayName($newDisplayName); return $service->contacts->update($contactId, $updatedContact); } catch (Exception $e) { print 'An error occurred: ' . $e->getMessage(); return null; } }
Python
Python ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।
from apiclient import errors # ... def rename_contact(service, contact_id, new_display_name): """Rename an existing contact for the current user. Args: service: Authorized Mirror service. contact_id: ID of the contact to rename. new_display_name: New displayName for the contact. Returns: return Patched contact on success, None otherwise. """ try: # Get the latest version of the contact from the API. contact = service.contacts().get(contact_id).execute() contact['displayName'] = new_display_name return service. contacts().update( id=contact_id, body=contact).execute() except errors.HttpError, e: print 'An error occurred: %s' % error return None
Ruby
Ruby ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।
## # Rename an existing contact for the current user. # # @param [Google::APIClient] client # Authorized client instance. # @param [String] contact_id # ID of the contact to rename. # @param [String] new_display_name # New displayName for the contact. # @return [Google::APIClient::Schema::Mirror::V1::Contact] # Updated contact on success, nil otherwise. def rename_contact(client, contact_id, new_display_name) mirror = client.discovered_api('mirror', 'v1') # Get the latest version of the contact from the API. result = client.execute( :api_method => mirror.contacts.get, :parameters => { 'id' => contact_id }) if result.success? contact = result.data contact.display_name = new_display_name result = client.execute( :api_method => mirror.contacts.update, :parameters => { 'id' => contact_id }, :body_object => contact) if result.success? return result.data end end puts "An error occurred: #{result.data['error']['message']}" end
খুলুন
Go ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।
import ( "code.google.com/p/google-api-go-client/mirror/v1" "fmt" ) // RenameContact renames an existing contact for the current user. func RenameContact(g *mirror.Service, contactId string, newDisplayName string) (*mirror.Contact, error) { s, err := g. Contacts.Get(contactId).Do() if err != nil { fmt.Printf("An error occurred: %v\n", err) return nil, err } s.DisplayName = newDisplayName r, err := g.Contacts.Patch(contactId, s).Do() if err != nil { fmt.Printf("An error occurred: %v\n", err) return nil, err } return r, nil }
Raw HTTP
ক্লায়েন্ট লাইব্রেরি ব্যবহার করে না।
PUT /mirror/v1/contacts/harold HTTP/1.1 Authorization: Bearer auth token Content-Type: application/json Content-Length: length { "displayName": "Harold Penguin", "imageUrls": ["https://developers.google.com/glass/images/harold.jpg"] }