Adobe DPS - Reading SDK 2.32

Class adobeDPS-CalendarService

Extends:
adobeDPS-CalendarService -> adobeDPS-Service -> adobeDPS-Class
Platforms:
iOS

Service for accessing the user's calendar and reminders.
Accessible from adobeDPS.calendarService

Constructor

adobeDPS-CalendarService()
[inner] Create an instance of the CalendarService.

Static Fields

Field Defined By
adobeDPS-CalendarService.instance
The singleton of the CalendarService.
CalendarService

Fields

Field Defined By
Defines error codes for calendar operations.
CalendarService

Methods

Method Defined By
EventItem(summary:String, description:String, location:String, alarms:Number[])
Constructor to create an EventItem object.
CalendarService
CalendarEvent(eventItem:Object, startDate:Number, endDate:Number, allDay:Boolean, eventId:Number)
Constructor to create a CalendarEvent object.
CalendarService
ReminderEvent(eventItem:Object, listTitle:String, dueDate:Number, eventId:Number)
Constructor to create a ReminderEvent object.
CalendarService
EventResult(success:Boolean, eventType:String, eventId:Number, errorCode:Number, errorMessage:String)
Internal constructor to create an EventResult object.
CalendarService
addEvent(event:Object, successCallback:Function, errorCallback:Function)
Function to add one calendar event or reminder event to the user's calendar.
CalendarService
addEvents(events:Array, successCallback:Function, errorCallback:Function)
Function to add one or more calendar events and reminder events to the user's calendar.
CalendarService
Inherited from adobeDPS-Class
Gets the string representation of this instance.
Class Detail
adobeDPS-CalendarService()
[inner] Create an instance of the CalendarService.
- This is an internal constructor and shouldn't be called by regular users.
Static Field Details
adobeDPS-CalendarService.instance
The singleton of the CalendarService.
Platforms:
iOS
Field Details
ErrorType
Defines error codes for calendar operations.

NameValueDescription
Unknown0an error other than the errors defined here has occurred
AccessToCalendarRestricted1the app is not authorized to access the user's calendar
AccessToRemindersRestricted2the app is not authorized to access the user's reminders
AccessToCalendarDenied3the user explicitly denied access to the user's calendar for the app
AccessToRemindersDenied4the user explicitly denied access to the user's reminders for the app


Platforms:
iOS
Method Details
EventItem(summary:String, description:String, location:String, alarms:Number[])
Constructor to create an EventItem object.
An EventItem object represents common properties of calendar events and reminder events.
Parameters
summary String The summary associated with this event item.
description String Optional description associated with this event item.
location String Optional location associated with this event item.
alarms Number[] Optional array of dates for the alarms to be associated with this event item.
Each value is a number of milliseconds such as the value returned by Date.getTime().
Platforms:
iOS
CalendarEvent(eventItem:Object, startDate:Number, endDate:Number, allDay:Boolean, eventId:Number)
Constructor to create a CalendarEvent object.
A CalendarEvent object represents an event to be added to the user's default calendar.
Parameters
eventItem Object An EventItem object containing the common event item properties for this calendar event.
startDate Number The start date for this calendar event.
The value is a number of milliseconds such as the value returned by Date.getTime().
endDate Number The end date for this calendar event.
The value is a number of milliseconds such as the value returned by Date.getTime().
allDay Boolean Indicator if this calendar event is an all-day event.
Default: false
eventId Number A value that uniquely identifies this event.
Default: an automatically generated number
Platforms:
iOS
ReminderEvent(eventItem:Object, listTitle:String, dueDate:Number, eventId:Number)
Constructor to create a ReminderEvent object.
A ReminderEvent object represents a reminder event to be added to one of the user's reminder lists.
Parameters
eventItem Object An EventItem object containing the common event item properties for this reminder event.
listTitle String The title of the list to which this reminder event is to be added. If a reminder list having this title does not already exist, one is created.
Default: the user's default reminder list
dueDate Number The due date for this reminder event.
The value is a number of milliseconds such as the value returned by Date.getTime().
Default: no due date
eventId Number A value that uniquely identifies this event.
Default: an automatically generated number
Platforms:
iOS
EventResult(success:Boolean, eventType:String, eventId:Number, errorCode:Number, errorMessage:String)
Internal constructor to create an EventResult object. This is an internal constructor and shouldn't be called by regular users.
An EventResult object describes the result of attempting to add a calendar event or reminder event to the user's calendar. One EventResult object (for the addEvent method), or an array of EventResult objects (for the addEvents method), is passed as an argument to a successCallback or errorCallback function. Each parameter in the EventResult constructor is also a property of the EventResult object, and the property has the same name and type as the parameter.
Parameters
success Boolean True if the event was successfully added to the user's calendar; otherwise false. Always true in a successCallback function; always false in an errorCallback function.
eventType String "calendar" for a CalendarEvent event, "reminder" for a ReminderEvent event.
eventId Number The eventId, either passed into the CalendarEvent constructor or ReminderEvent constructor, or, if omitted from a constructor, automatically generated, that is associated with this event.
errorCode Number In the errorCallback function, a value defined in the ErrorType enumeration that indicates the type of error that occurred; otherwise undefined.
errorMessage String In the errorCallback function, a string describing the reason for failure; otherwise undefined.
Platforms:
iOS
addEvent(event:Object, successCallback:Function, errorCallback:Function)
Function to add one calendar event or reminder event to the user's calendar.
// Sample code to create an event in the user's calendar
var hourMs = 1000 * 60 * 60;    // milliseconds in an hour for convenience
var gradStartTime = new Date("07/18/2014 13:00:00").getTime();
var gradEndTime = gradStartTime + (4 * hourMs);
var gradAlarmTime = gradStartTime - (1 * hourMs);
var gradEventItem = new adobeDPS.calendarService.EventItem("Bob's College Graduation", "Meet at the Science Center", "International University, New York", [ gradAlarmTime ]);
var gradCalendarEvent = new adobeDPS.calendarService.CalendarEvent(gradEventItem, gradStartTime, gradEndTime);
adobeDPS.calendarService.addEvent(gradCalendarEvent, function (result) {
    alert("Success!\nEvent Type: " + result.eventType + "\nEvent ID: " + result.eventId);
}, function (result) {
    alert("Failure!\nEvent Type: " + result.eventType + "\nEvent ID: " + result.eventId + "\nError Code: " + result.errorCode + "\nError Message: " + result.errorMessage);
});
Parameters
event Object A CalendarEvent or ReminderEvent object to be added to the user's calendar.
successCallback Function A callback function to be called with the result of a successful attempt to add the event to the user's calendar.
If the caller does not need to process a successful result, this argument can be omitted.
Callback Signature: successCallback(result)
result is an EventResult object that describes the result of a successful attempt to add the event to the user's calendar. See the EventResult constructor for a description of the EventResult object properties.
errorCallback Function A callback function to be called with the result of an unsuccessful attempt to add the event to the user's calendar.
If the caller does not need to process an unsuccessful result, this argument can be omitted.
Callback Signature: errorCallback(result)
result is an EventResult object that describes the result of an unsuccessful attempt to add the event to the user's calendar. See the EventResult constructor for a description of the EventResult object properties.
Platforms:
iOS
addEvents(events:Array, successCallback:Function, errorCallback:Function)
Function to add one or more calendar events and reminder events to the user's calendar.
// Sample code to create a reminder list of ingredients to make chocolate chip cookies
var groceryListName = "Chocolate Chip Cookie Ingredients";
var groceryList = [
    "2 1/4 cups all-purpose flour", "1 cup butter", "1 teaspoon baking soda", "1/2 teaspoon salt", "1 cup granulated sugar",
    "2/3 cup brown sugar", "1/2 teaspoon vanilla extract", "2 large eggs", "2 1/2 cups chocolate chips"
];
var groceryEventItem = new adobeDPS.calendarService.EventItem();
var groceryReminders = [];
var i;
for (i = 0; i < groceryList.length; i++) {
    groceryEventItem.summary = groceryList[i];
    groceryReminders[i] = new adobeDPS.calendarService.ReminderEvent(groceryEventItem, groceryListName);
}
adobeDPS.calendarService.addEvents(groceryReminders, function (results) {
    var i;
    for (i = 0; i < results.length; i++) {
        var result = results[i];
        alert("Event ID: " + result.eventId + " was successfully added." );
    }
}, function (results) {
    var i;
    for (i = 0; i < results.length; i++) {
        var result = results[i];
        alert("Event ID: " + result.eventId + " was not successfully added.  Error Code: " + result.errorCode +
              " Error Message: " + result.errorMessage);
    }
});
Parameters
events Array An array of CalendarEvent and ReminderEvent objects for the calendar events and reminder events to be added to the user's calendar.
successCallback Function A callback function to be called with the results of the successful attempts to add calendar events and reminder events to the user's calendar.
If the caller does not need to process successful results, this argument can be omitted.
Callback Signature: successCallback(results)
results is an array of EventResult objects. Each object describes the result of a successful attempt to add a calendar event or reminder event to the user's calendar. See the EventResult constructor for a description of the EventResult object properties.
errorCallback Function A callback function to be called with the results of the unsuccessful attempts to add calendar events and reminder events to the user's calendar.
If the caller does not need to process unsuccessful results, this argument can be omitted.
Callback Signature: errorCallback(results)
results is an array of EventResult objects. Each object describes the result of an unsuccessful attempt to add a calendar event or reminder event to the user's calendar. See the EventResult constructor for a description of the EventResult object properties.
Platforms:
iOS
©2012-2013 Adobe Systems, inc
Documentation generated by JsDoc Toolkit 2.4.0 on Mon Aug 31 2015 09:23:39 GMT-0700 (PDT)