এমন একটি অ্যাপের কথা ভাবুন যা ব্যবহারকারীদের সেরা হাইকিং রুট খুঁজে পেতে সাহায্য করে। হাইকিং পরিকল্পনাটিকে ক্যালেন্ডার ইভেন্ট হিসেবে যুক্ত করার মাধ্যমে, ব্যবহারকারীরা স্বয়ংক্রিয়ভাবে নিজেদের গুছিয়ে নিতে পারেন। গুগল ক্যালেন্ডার তাদের পরিকল্পনাটি শেয়ার করতে এবং সে সম্পর্কে মনে করিয়ে দিতে সাহায্য করে, যাতে তারা কোনো চাপ ছাড়াই প্রস্তুতি নিতে পারেন। এছাড়াও, গুগল প্রোডাক্টগুলোর নির্বিঘ্ন ইন্টিগ্রেশনের ফলে, গুগল ম্যাপস তাদেরকে ঠিক সময়ে নির্ধারিত মিলনস্থলে পৌঁছে দেয়।
এই নিবন্ধে ব্যাখ্যা করা হয়েছে কীভাবে ক্যালেন্ডার ইভেন্ট তৈরি করতে হয় এবং সেগুলো আপনার ব্যবহারকারীদের ক্যালেন্ডারে যুক্ত করতে হয়।
একটি ইভেন্ট যোগ করুন
একটি ইভেন্ট তৈরি করতে, events.insert মেথডটি কল করুন এবং কমপক্ষে এই প্যারামিটারগুলো প্রদান করুন:
-
calendarIdহলো ক্যালেন্ডার শনাক্তকারী এবং এটি হয় সেই ক্যালেন্ডারের ইমেল ঠিকানা হতে পারে যেখানে ইভেন্টটি তৈরি করা হবে, অথবা একটি বিশেষ কীওয়ার্ড'primary', যা সাইন-ইন করা ব্যবহারকারীর প্রাথমিক ক্যালেন্ডার ব্যবহার করে। আপনি যে ক্যালেন্ডারটি ব্যবহার করতে চান তার ইমেল ঠিকানা যদি আপনার জানা না থাকে, তবে আপনি ক্যালেন্ডার ওয়েব UI-তে ক্যালেন্ডারের সেটিংসে ("Calendar Address" বিভাগে) এটি পরীক্ষা করতে পারেন অথবাcalendarList.listকলের ফলাফলে এটি খুঁজতে পারেন। -
eventহলো এমন একটি ইভেন্ট যা শুরু এবং শেষের মতো সমস্ত প্রয়োজনীয় বিবরণ সহ তৈরি করতে হবে। শুধুমাত্রstartএবংendসময় এই দুটি ফিল্ড আবশ্যক। ইভেন্টের ফিল্ডগুলোর সম্পূর্ণ তালিকার জন্যEventsরিসোর্স রেফারেন্স দেখুন।
ইভেন্ট তৈরি করতে:
- আপনার OAuth স্কোপ
https://www.googleapis.com/auth/calendarএ সেট করুন, যাতে আপনি ব্যবহারকারীর ক্যালেন্ডার সম্পাদনা করার অ্যাক্সেস পান। - নিশ্চিত করুন যে প্রমাণীকৃত ব্যবহারকারীর আপনার দেওয়া
calendarIdসহ ক্যালেন্ডারটিতে লেখার অ্যাক্সেস আছে (উদাহরণস্বরূপ,calendarIdজন্যcalendarList.getকল করে এবংaccessRoleপরীক্ষা করে)।
ইভেন্টের মেটাডেটা যোগ করুন
ক্যালেন্ডার ইভেন্ট তৈরি করার সময় আপনি ঐচ্ছিকভাবে ইভেন্টের মেটাডেটা যোগ করতে পারেন। যদি আপনি তৈরির সময় মেটাডেটা যোগ না করার সিদ্ধান্ত নেন, তাহলে আপনি events.update মেথড ব্যবহার করে অনেক ফিল্ড আপডেট করতে পারবেন; তবে, ইভেন্ট আইডির মতো কিছু ফিল্ড শুধুমাত্র events.insert অপারেশনের সময় সেট করা যায়।
- অবস্থান
- লোকেশন ফিল্ডে ঠিকানা যোগ করলে 'বের হওয়ার সময়' বা দিকনির্দেশনাসহ মানচিত্র প্রদর্শনের মতো ফিচারগুলো চালু হয়।
- ইভেন্ট আইডি
- ইভেন্ট তৈরি করার সময়, আপনি ফরম্যাটের প্রয়োজনীয়তা মেনে আপনার নিজস্ব ইভেন্ট আইডি তৈরি করতে পারেন। এর ফলে আপনি আপনার স্থানীয় ডাটাবেসের এনটিটিগুলোকে ক্যালেন্ডারের ইভেন্টগুলোর সাথে সিঙ্ক করে রাখতে পারবেন। এছাড়াও, ক্যালেন্ডার ব্যাকএন্ডে সফলভাবে সম্পন্ন হওয়ার পর কোনো এক পর্যায়ে অপারেশনটি ব্যর্থ হলে এটি ডুপ্লিকেট ইভেন্ট তৈরি হওয়া প্রতিরোধ করে। আপনি যদি কোনো ইভেন্ট আইডি প্রদান না করেন, তবে সার্ভার একটি তৈরি করে নেয়। আরও তথ্যের জন্য ইভেন্ট আইডি রেফারেন্স দেখুন।
- উপস্থিত ব্যক্তিরা
- আপনার তৈরি করা ইভেন্টটি, একই ইভেন্ট আইডি দিয়ে অন্তর্ভুক্ত করা অংশগ্রহণকারীদের সকল প্রাথমিক ক্যালেন্ডারে প্রদর্শিত হয়। আপনি যদি আপনার ইনসার্ট রিকোয়েস্টে
sendUpdatesকে"all"বা"externalOnly"সেট করেন, তাহলে সংশ্লিষ্ট অংশগ্রহণকারীরা আপনার ইভেন্টের জন্য একটি ইমেল নোটিফিকেশন পাবেন। আরও জানতে, একাধিক অংশগ্রহণকারী সহ ইভেন্টগুলো দেখুন।
নিম্নলিখিত উদাহরণগুলি একটি ইভেন্ট তৈরি করা এবং এর মেটাডেটা সেট করা প্রদর্শন করে:
যান
// Refer to the Go quickstart on how to setup the environment:
// https://developers.google.com/workspace/calendar/quickstart/go
// Change the scope to calendar.CalendarScope and delete any stored credentials.
event := &calendar.Event{
Summary: "Google I/O 2015",
Location: "800 Howard St., San Francisco, CA 94103",
Description: "A chance to hear more about Google's developer products.",
Start: &calendar.EventDateTime{
DateTime: "2015-05-28T09:00:00-07:00",
TimeZone: "America/Los_Angeles",
},
End: &calendar.EventDateTime{
DateTime: "2015-05-28T17:00:00-07:00",
TimeZone: "America/Los_Angeles",
},
Recurrence: []string{"RRULE:FREQ=DAILY;COUNT=2"},
Attendees: []*calendar.EventAttendee{
&calendar.EventAttendee{Email:"lpage@example.com"},
&calendar.EventAttendee{Email:"sbrin@example.com"},
},
}
calendarId := "primary"
event, err = srv.Events.Insert(calendarId, event).Do()
if err != nil {
log.Fatalf("Unable to create event. %v\n", err)
}
fmt.Printf("Event created: %s\n", event.HtmlLink)
জাভা
// Refer to the Java quickstart on how to setup the environment:
// https://developers.google.com/workspace/calendar/quickstart/java
// Change the scope to CalendarScopes.CALENDAR and delete any stored
// credentials.
Event event = new Event()
.setSummary("Google I/O 2015")
.setLocation("800 Howard St., San Francisco, CA 94103")
.setDescription("A chance to hear more about Google's developer products.");
DateTime startDateTime = new DateTime("2015-05-28T09:00:00-07:00");
EventDateTime start = new EventDateTime()
.setDateTime(startDateTime)
.setTimeZone("America/Los_Angeles");
event.setStart(start);
DateTime endDateTime = new DateTime("2015-05-28T17:00:00-07:00");
EventDateTime end = new EventDateTime()
.setDateTime(endDateTime)
.setTimeZone("America/Los_Angeles");
event.setEnd(end);
String[] recurrence = new String[] {"RRULE:FREQ=DAILY;COUNT=2"};
event.setRecurrence(Arrays.asList(recurrence));
EventAttendee[] attendees = new EventAttendee[] {
new EventAttendee().setEmail("lpage@example.com"),
new EventAttendee().setEmail("sbrin@example.com"),
};
event.setAttendees(Arrays.asList(attendees));
EventReminder[] reminderOverrides = new EventReminder[] {
new EventReminder().setMethod("email").setMinutes(24 * 60),
new EventReminder().setMethod("popup").setMinutes(10),
};
Event.Reminders reminders = new Event.Reminders()
.setUseDefault(false)
.setOverrides(Arrays.asList(reminderOverrides));
event.setReminders(reminders);
String calendarId = "primary";
event = service.events().insert(calendarId, event).execute();
System.out.printf("Event created: %s\n", event.getHtmlLink());
জাভাস্ক্রিপ্ট
// Refer to the JavaScript quickstart on how to setup the environment:
// https://developers.google.com/workspace/calendar/quickstart/js
// Change the scope to 'https://www.googleapis.com/auth/calendar' and delete any
// stored credentials.
const event = {
'summary': 'Google I/O 2015',
'location': '800 Howard St., San Francisco, CA 94103',
'description': 'A chance to hear more about Google\'s developer products.',
'start': {
'dateTime': '2015-05-28T09:00:00-07:00',
'timeZone': 'America/Los_Angeles'
},
'end': {
'dateTime': '2015-05-28T17:00:00-07:00',
'timeZone': 'America/Los_Angeles'
},
'recurrence': [
'RRULE:FREQ=DAILY;COUNT=2'
],
'attendees': [
{'email': 'lpage@example.com'},
{'email': 'sbrin@example.com'}
],
'reminders': {
'useDefault': false,
'overrides': [
{'method': 'email', 'minutes': 24 * 60},
{'method': 'popup', 'minutes': 10}
]
}
};
const request = gapi.client.calendar.events.insert({
'calendarId': 'primary',
'resource': event
});
request.execute(function(event) {
appendPre('Event created: ' + event.htmlLink);
});
নোড.জেএস
// Refer to the Node.js quickstart on how to setup the environment:
// https://developers.google.com/workspace/calendar/quickstart/node
// Change the scope to 'https://www.googleapis.com/auth/calendar' and delete any
// stored credentials.
const event = {
'summary': 'Google I/O 2015',
'location': '800 Howard St., San Francisco, CA 94103',
'description': 'A chance to hear more about Google\'s developer products.',
'start': {
'dateTime': '2015-05-28T09:00:00-07:00',
'timeZone': 'America/Los_Angeles',
},
'end': {
'dateTime': '2015-05-28T17:00:00-07:00',
'timeZone': 'America/Los_Angeles',
},
'recurrence': [
'RRULE:FREQ=DAILY;COUNT=2'
],
'attendees': [
{'email': 'lpage@example.com'},
{'email': 'sbrin@example.com'},
],
'reminders': {
'useDefault': false,
'overrides': [
{'method': 'email', 'minutes': 24 * 60},
{'method': 'popup', 'minutes': 10},
],
},
};
calendar.events.insert({
auth: auth,
calendarId: 'primary',
resource: event,
}, function(err, event) {
if (err) {
console.log('There was an error contacting the Calendar service: ' + err);
return;
}
console.log('Event created: %s', event.htmlLink);
});
পিএইচপি
$event = new Google_Service_Calendar_Event(array(
'summary' => 'Google I/O 2015',
'location' => '800 Howard St., San Francisco, CA 94103',
'description' => 'A chance to hear more about Google\'s developer products.',
'start' => array(
'dateTime' => '2015-05-28T09:00:00-07:00',
'timeZone' => 'America/Los_Angeles',
),
'end' => array(
'dateTime' => '2015-05-28T17:00:00-07:00',
'timeZone' => 'America/Los_Angeles',
),
'recurrence' => array(
'RRULE:FREQ=DAILY;COUNT=2'
),
'attendees' => array(
array('email' => 'lpage@example.com'),
array('email' => 'sbrin@example.com'),
),
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 24 * 60),
array('method' => 'popup', 'minutes' => 10),
),
),
));
$calendarId = 'primary';
$event = $service->events->insert($calendarId, $event);
printf('Event created: %s\n', $event->htmlLink);
পাইথন
# Refer to the Python quickstart on how to setup the environment:
# https://developers.google.com/workspace/calendar/quickstart/python
# Change the scope to 'https://www.googleapis.com/auth/calendar' and delete any
# stored credentials.
event = {
'summary': 'Google I/O 2015',
'location': '800 Howard St., San Francisco, CA 94103',
'description': 'A chance to hear more about Google\'s developer products.',
'start': {
'dateTime': '2015-05-28T09:00:00-07:00',
'timeZone': 'America/Los_Angeles',
},
'end': {
'dateTime': '2015-05-28T17:00:00-07:00',
'timeZone': 'America/Los_Angeles',
},
'recurrence': [
'RRULE:FREQ=DAILY;COUNT=2'
],
'attendees': [
{'email': 'lpage@example.com'},
{'email': 'sbrin@example.com'},
],
'reminders': {
'useDefault': False,
'overrides': [
{'method': 'email', 'minutes': 24 * 60},
{'method': 'popup', 'minutes': 10},
],
},
}
event = service.events().insert(calendarId='primary', body=event).execute()
print 'Event created: %s' % (event.get('htmlLink'))
রুবি
event = Google::Apis::CalendarV3::Event.new(
summary: 'Google I/O 2015',
location: '800 Howard St., San Francisco, CA 94103',
description: 'A chance to hear more about Google\'s developer products.',
start: Google::Apis::CalendarV3::EventDateTime.new(
date_time: '2015-05-28T09:00:00-07:00',
time_zone: 'America/Los_Angeles'
),
end: Google::Apis::CalendarV3::EventDateTime.new(
date_time: '2015-05-28T17:00:00-07:00',
time_zone: 'America/Los_Angeles'
),
recurrence: [
'RRULE:FREQ=DAILY;COUNT=2'
],
attendees: [
Google::Apis::CalendarV3::EventAttendee.new(
email: 'lpage@example.com'
),
Google::Apis::CalendarV3::EventAttendee.new(
email: 'sbrin@example.com'
)
],
reminders: Google::Apis::CalendarV3::Event::Reminders.new(
use_default: false,
overrides: [
Google::Apis::CalendarV3::EventReminder.new(
reminder_method: 'email',
minutes: 24 * 60
),
Google::Apis::CalendarV3::EventReminder.new(
reminder_method: 'popup',
minutes: 10
)
]
)
)
result = client.insert_event('primary', event)
puts "Event created: #{result.html_link}"
ইভেন্টগুলিতে ড্রাইভ সংযুক্তি যোগ করুন
আপনি আপনার ক্যালেন্ডার ইভেন্টগুলিতে Google Docs-এর মিটিং নোট, Google Sheets-এর বাজেট, Google Slides-এর প্রেজেন্টেশন বা অন্য যেকোনো প্রাসঙ্গিক Google Drive ফাইল সংযুক্ত করতে পারেন। আপনি events.insert ব্যবহার করে ইভেন্ট তৈরি করার সময় অথবা পরে events.patch এর মতো কোনো আপডেটের অংশ হিসেবে অ্যাটাচমেন্টটি যোগ করতে পারেন।
কোনো ইভেন্টের সাথে ড্রাইভ ফাইল সংযুক্ত করার দুটি অংশ হলো:
- সাধারণত
files.getমেথড ব্যবহার করে গুগল ড্রাইভ এপিআই ফাইলস রিসোর্স থেকে ফাইলটিরalternateLinkURL,title, এবংmimeTypeসংগ্রহ করুন। - রিকোয়েস্ট বডিতে
attachmentsফিল্ডগুলো সেট করে এবংsupportsAttachmentsপ্যারামিটারটিtrueসেট করে একটি ইভেন্ট তৈরি বা আপডেট করুন।
নিম্নলিখিত কোড উদাহরণটি দেখায় কিভাবে একটি সংযুক্তি যোগ করার জন্য একটি বিদ্যমান ইভেন্ট আপডেট করতে হয়:
জাভা
public static void addAttachment(Calendar calendarService, Drive driveService, String calendarId,
String eventId, String fileId) throws IOException {
File file = driveService.files().get(fileId).execute();
Event event = calendarService.events().get(calendarId, eventId).execute();
List<EventAttachment> attachments = event.getAttachments();
if (attachments == null) {
attachments = new ArrayList<EventAttachment>();
}
attachments.add(new EventAttachment()
.setFileUrl(file.getAlternateLink())
.setMimeType(file.getMimeType())
.setTitle(file.getTitle()));
Event changes = new Event()
.setAttachments(attachments);
calendarService.events().patch(calendarId, eventId, changes)
.setSupportsAttachments(true)
.execute();
}
পিএইচপি
function addAttachment($calendarService, $driveService, $calendarId, $eventId, $fileId) {
$file = $driveService->files->get($fileId);
$event = $calendarService->events->get($calendarId, $eventId);
$attachments = $event->attachments;
$attachments[] = array(
'fileUrl' => $file->alternateLink,
'mimeType' => $file->mimeType,
'title' => $file->title
);
$changes = new Google_Service_Calendar_Event(array(
'attachments' => $attachments
));
$calendarService->events->patch($calendarId, $eventId, $changes, array(
'supportsAttachments' => TRUE
));
}
পাইথন
def add_attachment(calendarService, driveService, calendarId, eventId, fileId):
file = driveService.files().get(fileId=fileId).execute()
event = calendarService.events().get(calendarId=calendarId,
eventId=eventId).execute()
attachments = event.get('attachments', [])
attachments.append({
'fileUrl': file['alternateLink'],
'mimeType': file['mimeType'],
'title': file['title']
})
changes = {
'attachments': attachments
}
calendarService.events().patch(calendarId=calendarId, eventId=eventId,
body=changes,
supportsAttachments=True).execute()
ইভেন্টগুলিতে ভিডিও এবং ফোন কনফারেন্স যোগ করুন
আপনার ব্যবহারকারীদের ফোন কল বা ভিডিও কলের মাধ্যমে দূর থেকে মিটিং করার সুযোগ দিতে, আপনি গুগল মিট কনফারেন্সের সাথে ইভেন্ট যুক্ত করতে পারেন।
conferenceData ফিল্ডটি আপনাকে বিদ্যমান কনফারেন্সের বিবরণ পড়তে, কপি করতে ও মুছে ফেলতে, অথবা নতুন কনফারেন্স তৈরির অনুরোধ করতে দেয়। কনফারেন্সের বিবরণ তৈরি ও পরিবর্তনের অনুমতি দিতে, conferenceDataVersion রিকোয়েস্ট প্যারামিটারটির মান ` 1 সেট করুন।
conferenceData.conferenceSolution.key.type দ্বারা নির্দেশিত নিম্নলিখিত কনফারেন্সের ধরণগুলি সমর্থিত:
- গুগল মিট (
hangoutsMeet)
কোনো ব্যবহারকারীর যেকোনো ক্যালেন্ডারের জন্য কোন ধরনের কনফারেন্স সমর্থিত, তা আপনি calendars এবং calendarList কালেকশনে থাকা conferenceProperties.allowedConferenceSolutionTypes দেখে জানতে পারবেন।
type ছাড়াও, conferenceSolution name এবং iconUri ফিল্ডও থাকে, যা আপনি কনফারেন্স সলিউশনটি উপস্থাপন করতে ব্যবহার করতে পারেন, যেমনটি নিচে দেখানো হয়েছে:
জাভাস্ক্রিপ্ট
const solution = event.conferenceData.conferenceSolution;
const content = document.getElementById("content");
const text = document.createTextNode("Join " + solution.name);
const icon = document.createElement("img");
icon.src = solution.iconUri;
content.appendChild(icon);
content.appendChild(text);
একটি ইভেন্টের জন্য নতুন কনফারেন্স তৈরি করতে, আপনাকে একটি createRequest সাথে র্যান্ডম স্ট্রিং হিসেবে একটি নতুন requestId প্রদান করতে হবে। কনফারেন্সগুলো অ্যাসিঙ্ক্রোনাসভাবে তৈরি হয়, কিন্তু কী ঘটছে তা আপনার ব্যবহারকারীদের জানাতে আপনি সর্বদা আপনার অনুরোধের অবস্থা পরীক্ষা করতে পারেন।
উদাহরণস্বরূপ, একটি বিদ্যমান ইভেন্টের জন্য কনফারেন্স তৈরির অনুরোধ করতে:
জাভাস্ক্রিপ্ট
const eventPatch = {
conferenceData: {
createRequest: {requestId: "7qxalsvy0e"}
}
};
gapi.client.calendar.events.patch({
calendarId: "primary",
eventId: "7cbh8rpc10lrc0ckih9tafss99",
resource: eventPatch,
sendUpdates: "all",
conferenceDataVersion: 1
}).execute(function(event) {
console.log("Conference created for event: %s", event.htmlLink);
});
এই কলের তাৎক্ষণিক প্রতিক্রিয়ায় হয়তো এখনও সম্পূর্ণভাবে পূরণ করা conferenceData অন্তর্ভুক্ত নাও থাকতে পারে; status ফিল্ডটিতে pending লেখা থাকে। কনফারেন্সের তথ্য পূরণ হয়ে গেলে স্ট্যাটাস কোডটি success এ পরিবর্তিত হয়। entryPoints ফিল্ডটিতে এই তথ্য থাকে যে আপনার ব্যবহারকারীরা ডায়াল ইন করার জন্য কোন কোন ভিডিও এবং ফোন URI উপলব্ধ আছে।
আপনি যদি একই সম্মেলনের বিবরণ ব্যবহার করে একাধিক ক্যালেন্ডার ইভেন্ট নির্ধারণ করতে চান, তাহলে একটি ইভেন্ট থেকে অন্যটিতে সম্পূর্ণ conferenceData কপি করতে পারেন।
কিছু পরিস্থিতিতে অনুলিপি করা উপকারী। উদাহরণস্বরূপ, ধরুন আপনি এমন একটি নিয়োগ অ্যাপ্লিকেশন তৈরি করছেন যা প্রার্থী এবং সাক্ষাৎকার গ্রহণকারীর জন্য আলাদা ইভেন্ট তৈরি করে—আপনি সাক্ষাৎকার গ্রহণকারীর পরিচয় গোপন রাখতে চান, কিন্তু একই সাথে এটাও নিশ্চিত করতে চান যে সকল অংশগ্রহণকারী যেন একই কনফারেন্স কলে যোগ দেয়।