WebAPI/LogAPI

< WebAPI
Revision as of 15:43, 25 April 2012 by Jmcf (talk | contribs)

Use Cases: To record the history of user activity with the device, particularly with communication services (Phone Calls, Messages, Social Networks, etc.) Consumers of this API

interface LogManager : EventTarget {
    DOMRequest add(LogEntry entry);
    DOMRequest remove(DOMString entryId);
    DOMRequest removeOld(DOMTimestamp to,optional DOMString contactId)
    DOMRequest getLast(LogOptions options);

   attribute Function onentryadded;

   attribute unsigned long maxEntriesPerDay;
   attribute unsigned long maxEntriesPerUser;
};

dictionary LogOptions {
  attribute unsigned long maxRecords;
  attribute DOMString contactId;
  attribute Date from;
  attribute Date to;
  attribute DOMString service;
};

interface LogEntryProperties {
   attribute DOMString type;                       // oneOf ['incoming', 'outgoing']
   attribute DOMString[] contactId;             // ContactId
   attribute DOMString[] tel;                       // Tel number if not already in contacts
   attribute DOMString objectId;                // Object id (for example SMS message)
   attribute DOMString service;                  // oneOf ['SMS', 'Telephony', 'Facebook', 'Twitter'] 
   attribute DOMString title;             
   attribute DOMString description;
   attribute any extra;
};

[Constructor(in LogEntryProperties properties)]
interface LogEntry : LogEntryProperties {
   readonly attribute DOMString id;
   readonly attribute DOMTimestamp timestamp;                  // When this happened
};