WebAPI/LogAPI: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 18: Line 18:
     DOMRequest clear(LogClearOptions coptions);
     DOMRequest clear(LogClearOptions coptions);
     LogIterator find(LogFindOptions options);
     LogIterator find(LogFindOptions options);
   attribute Function onentryadded;
   attribute Function onentryadded;
};
};
interface LogIterator {
interface LogIterator {
   DOMRequest next(optional unsigned short n);
   DOMRequest next(optional unsigned short n);
   DOMRequest advance(unsigned short count);
   DOMRequest advance(unsigned short count);
};
};
dictionary LogOptions {
dictionary LogOptions {
   attribute unsigned long maxRecords;
   attribute unsigned long maxRecords;
   attribute DOMString contactId;
   attribute DOMString contactId;
};
};
dictionary LogFindOptions : LogOptions {
dictionary LogFindOptions : LogOptions {
   attribute Date from;
   attribute Date from;
Line 37: Line 33:
   attribute DOMString service;
   attribute DOMString service;
};
};
interface LogEntryProperties {
interface LogEntryProperties {
   attribute DOMString type;                      // possible values: ['incoming', 'outgoing', 'missing']
   attribute DOMString type;                      // possible values: ['incoming', 'outgoing', 'missing']
Line 48: Line 43:
   attribute any extra;                                // Any extra data to be used by applications
   attribute any extra;                                // Any extra data to be used by applications
};
};
[Constructor(LogEntryProperties properties)]
[Constructor(LogEntryProperties properties)]
interface LogEntry : LogEntryProperties {
interface LogEntry : LogEntryProperties {

Revision as of 18:42, 25 April 2012

Use Cases

To record the history of user activity with the device, particularly with communication services (Phone Calls, Messages, Social Networks, etc.)

Consumers

  • Comms Log Application (Global for the user and per-contact)

Producers

  • Dialer, SMS, e-mail, Facebook, Twitter, ...

WebIDL

interface LogManager : EventTarget {

   DOMRequest save(LogEntry entry);
   DOMRequest delete(DOMString entryId);
   DOMRequest clear(LogClearOptions coptions);
   LogIterator find(LogFindOptions options);
  attribute Function onentryadded;

}; interface LogIterator {

 DOMRequest next(optional unsigned short n);
 DOMRequest advance(unsigned short count);

}; dictionary LogOptions {

 attribute unsigned long maxRecords;
 attribute DOMString contactId;

}; dictionary LogFindOptions : LogOptions {

  attribute Date from;
  attribute Date to;
  attribute DOMString service;

}; interface LogEntryProperties {

  attribute DOMString type;                       // possible values: ['incoming', 'outgoing', 'missing']
  attribute DOMString[] contactId;             // ContactId
  attribute DOMString[] tel;                       // Tel number if not already in contacts
  attribute DOMString objectId;                // Object id (for example SMS message on the SMS database)
  attribute DOMString service;                  // oneOf ['SMS', 'Telephony', 'Facebook', 'Twitter'] 
  attribute DOMString title;             
  attribute DOMString description;
  attribute any extra;                                // Any extra data to be used by applications

}; [Constructor(LogEntryProperties properties)] interface LogEntry : LogEntryProperties {

  readonly attribute DOMString id;
  readonly attribute DOMTimestamp timestamp;                  // When this happened

};