এই ডকুমেন্টে পুনরাবৃত্তিমূলক ইভেন্ট এবং সেগুলোর ইনস্ট্যান্স নিয়ে কীভাবে কাজ করতে হয় তা বর্ণনা করা হয়েছে।
পুনরাবৃত্তিমূলক ইভেন্ট তৈরি করুন
পুনরাবৃত্তিমূলক ইভেন্ট তৈরি করা, ইভেন্ট রিসোর্সের recurrence ফিল্ড সেট করে একটি সাধারণ (একক) ইভেন্ট তৈরি করার মতোই।
প্রোটোকল
POST /calendar/v3/calendars/primary/events ... { "summary": "Appointment", "location": "Somewhere", "start": { "dateTime": "2011-06-03T10:00:00.000-07:00", "timeZone": "America/Los_Angeles" }, "end": { "dateTime": "2011-06-03T10:25:00.000-07:00", "timeZone": "America/Los_Angeles" }, "recurrence": [ "RRULE:FREQ=WEEKLY;UNTIL=20110701T170000Z", ], "attendees": [ { "email": "attendeeEmail", # Other attendee's data... }, # ... ], }
জাভা
Event event = new Event(); event.setSummary("Appointment"); event.setLocation("Somewhere"); ArrayList<EventAttendee> attendees = new ArrayList<EventAttendee>(); attendees.add(new EventAttendee().setEmail("attendeeEmail")); // ... event.setAttendees(attendees); DateTime start = DateTime.parseRfc3339("2011-06-03T10:00:00.000-07:00"); DateTime end = DateTime.parseRfc3339("2011-06-03T10:25:00.000-07:00"); event.setStart(new EventDateTime().setDateTime(start).setTimeZone("America/Los_Angeles")); event.setEnd(new EventDateTime().setDateTime(end).setTimeZone("America/Los_Angeles")); event.setRecurrence(Arrays.asList("RRULE:FREQ=WEEKLY;UNTIL=20110701T170000Z")); Event recurringEvent = service.events().insert("primary", event).execute(); System.out.println(createdEvent.getId());
.NET
Event event = new Event() { Summary = "Appointment", Location = "Somewhere", Start = new EventDateTime() { DateTime = new DateTime("2011-06-03T10:00:00.000:-07:00") TimeZone = "America/Los_Angeles" }, End = new EventDateTime() { DateTime = new DateTime("2011-06-03T10:25:00.000:-07:00") TimeZone = "America/Los_Angeles" }, Recurrence = new String[] { "RRULE:FREQ=WEEKLY;UNTIL=20110701T170000Z" }, Attendees = new List<EventAttendee>() { new EventAttendee() { Email: "attendeeEmail" }, // ... } }; Event recurringEvent = service.Events.Insert(event, "primary").Fetch(); Console.WriteLine(recurringEvent.Id);
পাইথন
event = { 'summary': 'Appointment', 'location': 'Somewhere', 'start': { 'dateTime': '2011-06-03T10:00:00.000-07:00', 'timeZone': 'America/Los_Angeles' }, 'end': { 'dateTime': '2011-06-03T10:25:00.000-07:00', 'timeZone': 'America/Los_Angeles' }, 'recurrence': [ 'RRULE:FREQ=WEEKLY;UNTIL=20110701T170000Z', ], 'attendees': [ { 'email': 'attendeeEmail', # Other attendee's data... }, # ... ], } recurring_event = service.events().insert(calendarId='primary', body=event).execute() print recurring_event['id']
পিএইচপি
$event = new Google_Service_Calendar_Event(); $event->setSummary('Appointment'); $event->setLocation('Somewhere'); $start = new Google_Service_Calendar_EventDateTime(); $start->setDateTime('2011-06-03T10:00:00.000-07:00'); $start->setTimeZone('America/Los_Angeles'); $event->setStart($start); $end = new Google_Service_Calendar_EventDateTime(); $end->setDateTime('2011-06-03T10:25:00.000-07:00'); $end->setTimeZone('America/Los_Angeles'); $event->setEnd($end); $event->setRecurrence(array('RRULE:FREQ=WEEKLY;UNTIL=20110701T170000Z')); $attendee1 = new Google_Service_Calendar_EventAttendee(); $attendee1->setEmail('attendeeEmail'); // ... $attendees = array($attendee1, // ... ); $event->attendees = $attendees; $recurringEvent = $service->events->insert('primary', $event); echo $recurringEvent->getId();
রুবি
event = Google::Apis::CalendarV3::Event.new( summary: 'Appointment', location: 'Somewhere', start: { date_time: '2011-06-03T10:00:00.000-07:00', time_zone: 'America/Los_Angeles' }, end: { date_time: '2011-06-03T10:25:00.000-07:00', time_zone: 'America/Los_Angeles' }, recurrence: ['RRULE:FREQ=WEEKLY;UNTIL=20110701T170000Z'] attendees: [ { email: 'attendeeEmail' }, #... ] ) response = client.insert_event('primary', event) print response.id
ইনস্ট্যান্স অ্যাক্সেস করুন
কোনো একটি পুনরাবৃত্তিমূলক ইভেন্টের সমস্ত দৃষ্টান্ত দেখতে, events.instances মেথডটি ব্যবহার করুন।
ডিফল্টরূপে, events.list মেথডটি একক ইভেন্ট, পুনরাবৃত্তিমূলক ইভেন্ট এবং এক্সেপশন রিটার্ন করে; যে ইনস্ট্যান্সগুলো এক্সেপশন নয়, সেগুলো রিটার্ন করা হয় না। যদি singleEvents প্যারামিটারটি true তে সেট করা থাকে, তাহলে ফলাফলে সমস্ত স্বতন্ত্র ইনস্ট্যান্স দেখা যায়, কিন্তু অন্তর্নিহিত পুনরাবৃত্তিমূলক ইভেন্টগুলো দেখা যায় না। যখন free/busy পারমিশন থাকা কোনো ব্যবহারকারী events.list কোয়েরি করে, তখন এটি এমনভাবে কাজ করে যেন singleEvents মান true । অ্যাক্সেস কন্ট্রোল লিস্টের নিয়ম সম্পর্কে আরও তথ্যের জন্য, ACL দেখুন।
স্বতন্ত্র ইনস্ট্যান্সগুলো একক ইভেন্টের অনুরূপ। তাদের মূল পুনরাবৃত্তিমূলক ইভেন্টের মতো নয়, ইনস্ট্যান্সগুলোতে recurrence ফিল্ড সেট করা থাকে না।
নিম্নলিখিত ইভেন্ট ফিল্ডগুলি ইনস্ট্যান্সের জন্য নির্দিষ্ট:
-
recurringEventId— এই ইনস্ট্যান্সটি যে মূল পুনরাবৃত্তিমূলক ইভেন্টের অন্তর্গত, তার আইডি -
originalStartTime— মূল পুনরাবৃত্তিমূলক ইভেন্টের পুনরাবৃত্তির তথ্য অনুযায়ী এই ইনস্ট্যান্সটি যে সময়ে চালু হয়। ইনস্ট্যান্সটির সময়সূচী পরিবর্তন করা হলে এটি প্রকৃতstartসময় থেকে ভিন্ন হতে পারে। ইনস্ট্যান্সটি স্থানান্তরিত হলেও, এটি পুনরাবৃত্তিমূলক ইভেন্ট সিরিজের মধ্যে ইনস্ট্যান্সটিকে স্বতন্ত্রভাবে শনাক্ত করে।
ইনস্ট্যান্সগুলি পরিবর্তন বা মুছে ফেলুন
একটিমাত্র ইনস্ট্যান্স পরিবর্তন করতে (একটি ব্যতিক্রম তৈরি করতে), ক্লায়েন্ট অ্যাপ্লিকেশনগুলিকে প্রথমে ইনস্ট্যান্সটি পুনরুদ্ধার করতে হবে এবং তারপরে বডিতে আপডেট করা ডেটা সহ ইনস্ট্যান্স সম্পাদনা URL-এ একটি অনুমোদিত PUT অনুরোধ পাঠিয়ে এটি আপডেট করতে হবে। URL-টি এই ধরনের:
https://www.googleapis.com/calendar/v3/calendars/calendarId/events/instanceId
calendarId এবং instanceId এর পরিবর্তে উপযুক্ত মান ব্যবহার করুন।
সফল হলে, সার্ভার আপডেট করা ইনস্ট্যান্স সহ একটি HTTP 200 OK স্ট্যাটাস কোড দিয়ে সাড়া দেয়। নিম্নলিখিত উদাহরণটি দেখায় কিভাবে একটি পুনরাবৃত্তিমূলক ইভেন্টের ইনস্ট্যান্স বাতিল করতে হয়।
প্রোটোকল
PUT /calendar/v3/calendars/primary/events/instanceId
...
{
"kind": "calendar#event",
"id": "instanceId",
"etag": "instanceEtag",
"status": "cancelled",
"htmlLink": "https://www.google.com/calendar/event?eid=instanceEid",
"created": "2011-05-23T22:27:01.000Z",
"updated": "2011-05-23T22:27:01.000Z",
"summary": "Recurring event",
"location": "Somewhere",
"creator": {
"email": "userEmail"
},
"recurringEventId": "recurringEventId",
"originalStartTime": "2011-06-03T10:00:00.000-07:00",
"organizer": {
"email": "userEmail",
"displayName": "userDisplayName"
},
"start": {
"dateTime": "2011-06-03T10:00:00.000-07:00",
"timeZone": "America/Los_Angeles"
},
"end": {
"dateTime": "2011-06-03T10:25:00.000-07:00",
"timeZone": "America/Los_Angeles"
},
"iCalUID": "eventUID",
"sequence": 0,
"attendees": [
{
"email": "attendeeEmail",
"displayName": "attendeeDisplayName",
"responseStatus": "needsAction"
},
# ...
{
"email": "userEmail",
"displayName": "userDisplayName",
"responseStatus": "accepted",
"organizer": true,
"self": true
}
],
"guestsCanInviteOthers": false,
"guestsCanSeeOtherGuests": false,
"reminders": {
"useDefault": true
}
}জাভা
// First retrieve the instances from the API. Events instances = service.events().instances("primary", "recurringEventId").execute(); // Select the instance to cancel. Event instance = instances.getItems().get(0); instance.setStatus("cancelled"); Event updatedInstance = service.events().update("primary", instance.getId(), instance).execute(); // Print the updated date. System.out.println(updatedInstance.getUpdated());
.NET
// First retrieve the instances from the API. Events instances = service.Events.Instances("primary", "recurringEventId").Fetch(); // Select the instance to cancel. Event instance = instances.Items[0]; instance.Status = "cancelled"; Event updatedInstance = service.Events.Update(instance, "primary", instance.Id).Fetch(); // Print the updated date. Console.WriteLine(updatedInstance.Updated);
পাইথন
# First retrieve the instances from the API. instances = service.events().instances(calendarId='primary', eventId='recurringEventId').execute() # Select the instance to cancel. instance = instances['items'][0] instance['status'] = 'cancelled' updated_instance = service.events().update(calendarId='primary', eventId=instance['id'], body=instance).execute() # Print the updated date. print updated_instance['updated']
পিএইচপি
$events = $service->events->instances("primary", "eventId"); // Select the instance to cancel. $instance = $events->getItems()[0]; $instance->setStatus('cancelled'); $updatedInstance = $service->events->update('primary', $instance->getId(), $instance); // Print the updated date. echo $updatedInstance->getUpdated();
রুবি
# First retrieve the instances from the API. instances = client.list_event_instances('primary', 'recurringEventId') # Select the instance to cancel. instance = instances.items[0] instance.status = 'cancelled' response = client.update_event('primary', instance.id, instance) print response.updated
নিম্নলিখিত সমস্ত দৃষ্টান্ত পরিবর্তন করুন
একটি পুনরাবৃত্তিমূলক ইভেন্টের একটি নির্দিষ্ট (টার্গেট) ইনস্ট্যান্সে বা তার পরে সমস্ত ইনস্ট্যান্স পরিবর্তন করতে, দুটি পৃথক API অনুরোধ পাঠান। এই অনুরোধগুলি মূল পুনরাবৃত্তিমূলক ইভেন্টটিকে দুটি ভাগে বিভক্ত করে: মূল ইভেন্টটি, যেখানে পরিবর্তন ছাড়া ইনস্ট্যান্সগুলি অপরিবর্তিত থাকে, এবং নতুন পুনরাবৃত্তিমূলক ইভেন্টটি, যেখানে পরিবর্তন প্রয়োগ করা ইনস্ট্যান্সগুলি থাকে।
- যে ইনস্ট্যান্সগুলো আপডেট করা হবে, সেগুলোর মূল পুনরাবৃত্তিমূলক ইভেন্টটি সংক্ষিপ্ত করতে
events.updateকল করুন। এটি করার জন্য,RRULEএরUNTILকম্পোনেন্টটিকে প্রথম টার্গেট ইনস্ট্যান্সের শুরুর সময়ের আগে সেট করুন। বিকল্পভাবে, আপনিUNTILএর পরিবর্তেCOUNTকম্পোনেন্টটি সেট করতে পারেন। - আপনার করা পরিবর্তনটি ছাড়া, মূল ইভেন্টের সমস্ত ডেটা সহ একটি নতুন পুনরাবৃত্তিমূলক ইভেন্ট তৈরি করতে
events.insertকল করুন। নতুন পুনরাবৃত্তিমূলক ইভেন্টটির শুরুর সময় অবশ্যই টার্গেট ইনস্ট্যান্সের সমান হতে হবে।
এই উদাহরণটি দেখায়, কীভাবে পূর্ববর্তী উদাহরণগুলির পুনরাবৃত্তিমূলক ইভেন্টের তৃতীয় দৃষ্টান্ত থেকে অবস্থানটি "অন্য কোথাও"-তে পরিবর্তন করতে হয়।
প্রোটোকল
# Updating the original recurring event to trim the instance list: PUT /calendar/v3/calendars/primary/events/recurringEventId ... { "summary": "Appointment", "location": "Somewhere", "start": { "dateTime": "2011-06-03T10:00:00.000-07:00", "timeZone": "America/Los_Angeles" }, "end": { "dateTime": "2011-06-03T10:25:00.000-07:00", "timeZone": "America/Los_Angeles" }, "recurrence": [ "RRULE:FREQ=WEEKLY;UNTIL=20110617T065959Z", ], "attendees": [ { "email": "attendeeEmail", # Other attendee's data... }, # ... ], } # Creating a new recurring event with the change applied: POST /calendar/v3/calendars/primary/events ... { "summary": "Appointment", "location": "Somewhere else", "start": { "dateTime": "2011-06-17T10:00:00.000-07:00", "timeZone": "America/Los_Angeles" }, "end": { "dateTime": "2011-06-17T10:25:00.000-07:00", "timeZone": "America/Los_Angeles" }, "recurrence": [ "RRULE:FREQ=WEEKLY", ], "attendees": [ { "email": "attendeeEmail", # Other attendee's data... }, # ... ], }