कैलेंडर और इवेंट के लिए रंग की परिभाषाएं दिखाता है. इसे अभी आज़माएं या उदाहरण देखें.
अनुरोध
एचटीटीपी अनुरोध
GET https://www.googleapis.com/calendar/v3/colors
अनुमति देना
इस अनुरोध में, इनमें से कम से कम एक स्कोप के साथ अनुमति देने की सुविधा है:
दायरा |
---|
https://www.googleapis.com/auth/calendar |
https://www.googleapis.com/auth/calendar.readonly |
https://www.googleapis.com/auth/calendar.app.created |
https://www.googleapis.com/auth/calendar.calendarlist |
https://www.googleapis.com/auth/calendar.calendarlist.readonly |
https://www.googleapis.com/auth/calendar.events.freebusy |
https://www.googleapis.com/auth/calendar.events.owned |
https://www.googleapis.com/auth/calendar.events.owned.readonly |
https://www.googleapis.com/auth/calendar.events.public.readonly |
ज़्यादा जानकारी के लिए, पुष्टि और अनुमति पेज देखें.
अनुरोध का मुख्य भाग
इस तरीके का इस्तेमाल करते समय, अनुरोध का मुख्य हिस्सा न दें.
जवाब
अगर यह तरीका कामयाब होता है, तो यह जवाब के मुख्य हिस्से में Colors रिसॉर्स दिखाता है.
उदाहरण
ध्यान दें: इस तरीके के लिए दिए गए कोड के उदाहरणों में इसके साथ काम करने वाली सभी प्रोग्रामिंग भाषाएं नहीं दिखाई गई हैं (इसके साथ काम करने वाली भाषाओं की सूची के लिए क्लाइंट लाइब्रेरी वाला पेज देखें).
Java क्लाइंट लाइब्रेरी का इस्तेमाल करता है.
import com.google.api.services.calendar.Calendar; import com.google.api.services.calendar.model.Colors; import com.google.api.services.calendar.model.ColorDefinition; import java.util.Map; // ... // Initialize Calendar service with valid OAuth credentials Calendar service = new Calendar.Builder(httpTransport, jsonFactory, credentials) .setApplicationName("applicationName").build(); // Retrieve color definitions for calendars and events Colors colors = service.colors().get().execute(); // Print available calendar list entry colors for (Map.Entry<String, ColorDefinition> color : colors.getCalendar().entrySet()) { System.out.println("ColorId : " + color.getKey()); System.out.println(" Background: " + color.getValue().getBackground()); System.out.println(" Foreground: " + color.getValue().getForeground()); } // Print available event colors for (Map.Entry<String, ColorDefinition> color : colors.getEvent().entrySet()) { System.out.println("ColorId : " + color.getKey()); System.out.println(" Background: " + color.getValue().getBackground()); System.out.println(" Foreground: " + color.getValue().getForeground()); }
Python क्लाइंट लाइब्रेरी का इस्तेमाल करता है.
colors = service.colors().get().execute() # Print available calendarListEntry colors. for id, color in colors['calendar'].iteritem(): print 'colorId: %s' % id print ' Background: %s' % color['background'] print ' Foreground: %s' % color['foreground'] # Print available event colors. for id, color in colors['event'].iteritem(): print 'colorId: %s' % id print ' Background: %s' % color['background'] print ' Foreground: %s' % color['foreground']
PHP क्लाइंट लाइब्रेरी का इस्तेमाल करता है.
$colors = $service->colors->get(); // Print available calendarListEntry colors. foreach ($colors->getCalendar() as $key => $color) { print "colorId : {$key}\n"; print " Background: {$color->getBackground()}\n"; print " Foreground: {$color->getForeground()}\n"; } // Print available event colors. foreach ($colors->getEvent() as $key => $color) { print "colorId : {$key}\n"; print " Background: {$color->getBackground()}\n"; print " Foreground: {$color->getForeground()}\n"; }
Ruby क्लाइंट लाइब्रेरी का इस्तेमाल करता है.
result = client.get_color() # Print available calendarListEntry colors. result.calendar.keys.each do |key| print "colorId: #{key}\n" print " Background: #{result.calendar[key].background}\n" print " Foreground: #{result.calendar[key].foreground}\n" end # Print available event colors. result.event.keys.each do |key| print "colorId: #{key}\n" print " Background: #{result.event[key].background}\n" print " Foreground: #{result.event[key].foreground}\n" end
.NET क्लाइंट लाइब्रेरी का इस्तेमाल करता है.
Colors colors = service.Colors.Get().Fetch(); // Print available calendarListEntry colors. foreach (KeyValuePair<String, ColorDefinition> color in colors.Calendar) { System.out.println("ColorId : " + color.Key); System.out.println(" Background: " + color.Value.Background); System.out.println(" Foreground: " + color.Value.Foreground); } // Print available event colors. foreach (KeyValuePair<String, ColorDefinition> color in colors.Event) { System.out.println("ColorId : " + color.Key); System.out.println(" Background: " + color.Value.Background); System.out.println(" Foreground: " + color.Value.Foreground); }