পুনরাবৃত্তি ঘটনা

এই দস্তাবেজটি বর্ণনা করে কিভাবে পুনরাবৃত্ত ঘটনা এবং তাদের দৃষ্টান্তগুলির সাথে কাজ করতে হয়৷

পুনরাবৃত্ত ঘটনা তৈরি করুন

পুনরাবৃত্ত ইভেন্ট তৈরি করা event রিসোর্সের 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());

.নেট

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 সেট করা হয় তাহলে ফলাফলে সমস্ত পৃথক দৃষ্টান্ত প্রদর্শিত হবে, কিন্তু অন্তর্নিহিত পুনরাবৃত্ত ঘটনাগুলি তা নয়। যখন একজন ব্যবহারকারী যার কাছে মুক্ত/ব্যস্ত অনুমতি আছে তারা events.list() কে জিজ্ঞাসা করে, এটি এমন আচরণ করে যেন singleEvent true । অ্যাক্সেস নিয়ন্ত্রণ তালিকা নিয়ম সম্পর্কে আরও তথ্যের জন্য, Acl দেখুন।

স্বতন্ত্র দৃষ্টান্ত একক ঘটনা অনুরূপ. তাদের অভিভাবক পুনরাবৃত্ত ইভেন্টের বিপরীতে, দৃষ্টান্তের recurrence ক্ষেত্র সেট নেই।

নিম্নলিখিত ইভেন্ট ক্ষেত্রগুলি দৃষ্টান্তগুলির জন্য নির্দিষ্ট:

  • recurringEventId — প্যারেন্ট পুনরাবৃত্ত ইভেন্টের আইডি এই উদাহরণের অন্তর্গত
  • originalStartTime — যে সময় এই দৃষ্টান্তটি প্যারেন্ট পুনরাবৃত্ত ইভেন্টের পুনরাবৃত্তি ডেটা অনুসারে শুরু হয়। দৃষ্টান্ত পুনঃনির্ধারিত হলে এটি প্রকৃত start সময় থেকে ভিন্ন হতে পারে। দৃষ্টান্তটি সরানো হলেও এটি পুনরাবৃত্ত ইভেন্ট সিরিজের মধ্যে উদাহরণটিকে অনন্যভাবে সনাক্ত করে।

পরিবর্তন বা দৃষ্টান্ত মুছুন

একটি একক দৃষ্টান্ত পরিবর্তন করতে (একটি ব্যতিক্রম তৈরি করা), ক্লায়েন্ট অ্যাপ্লিকেশনগুলিকে অবশ্যই প্রথমে দৃষ্টান্তটি পুনরুদ্ধার করতে হবে এবং তারপরে একটি অনুমোদিত PUT অনুরোধ প্রেরণ করে এটিকে আপডেট করতে হবে। URL হল ফর্মের:

https://www.googleapis.com/calendar/v3/calendars/calendarId/events/instanceId

calendarId এবং instanceId এর জায়গায় উপযুক্ত মান ব্যবহার করুন।

দ্রষ্টব্য: বিশেষ calendarId মান primary প্রমাণীকৃত ব্যবহারকারীর প্রাথমিক ক্যালেন্ডারে উল্লেখ করতে ব্যবহার করা যেতে পারে।

সাফল্যের পরে, সার্ভার আপডেট করা উদাহরণ সহ একটি HTTP 200 ওকে স্ট্যাটাস কোডের সাথে প্রতিক্রিয়া জানায়। নিম্নলিখিত উদাহরণ দেখায় কিভাবে একটি পুনরাবৃত্ত ইভেন্টের একটি উদাহরণ বাতিল করতে হয়।

প্রোটোকল

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());

.নেট

// 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 অনুরোধ করতে হবে। এই অনুরোধগুলি মূল পুনরাবৃত্ত ইভেন্টকে দুটি ভাগে বিভক্ত করে: আসলটি যা পরিবর্তন ছাড়াই দৃষ্টান্তগুলিকে ধরে রাখে এবং নতুন পুনরাবৃত্ত ইভেন্ট যেখানে পরিবর্তনটি প্রয়োগ করা হয়েছে এমন উদাহরণ রয়েছে:
  1. আপডেট করার জন্য ঘটনাগুলির মূল পুনরাবৃত্ত ইভেন্ট ট্রিম করতে events.update() এ কল করুন। RRULE এর UNTIL কম্পোনেন্ট সেট করে প্রথম টার্গেট ইন্সট্যান্সের শুরুর সময়ের আগে পয়েন্ট করে এটি করুন। বিকল্পভাবে, আপনি UNTIL এর পরিবর্তে COUNT উপাদান সেট করতে পারেন।
  2. আপনি যে পরিবর্তন করার চেষ্টা করছেন তা ছাড়া, মূলের মতো একই ডেটা সহ একটি নতুন পুনরাবৃত্ত ইভেন্ট তৈরি করতে 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;UNTIL=20110617T065959Z",
  ],
  "attendees": [
    {
      "email": "attendeeEmail",
      # Other attendee's data...
    },
    # ...
  ],
}