Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Similar methods should be merged #37

@marcoscaceres

Description

@marcoscaceres

The spec defines the following methods that all practically do the same thing - the only different is in the method name:

    MessagingRequest findMessages (MessagingFilter filter, FilterOptions options);
    MessagingRequest findConversations (DOMString groupBy, MessagingFilter filter, FilterOptions options);
    MessagingRequest deleteMessage (DOMString messageID);
    MessagingRequest deleteConversation (DOMString conversationID);
    MessagingRequest markMessageRead (DOMString messageID, boolean value);
    MessagingRequest markConversationRead (DOMString conversationID, boolean value);

findMessages could just become "find" if we added an "enum CommunicationType { "message", "conversation" } ".

So:

messaging.find("message", ...);
messaging.find("conversation", ...);

The groupBy can just be added to FilterOption because fileterOptions is required (and just give groupBy a sensible default like "subject"). Also, it looks like groupBy needs it's own enum!

For messaging.delete(), the API should just guarantee that message and conversation and conversations have unique ids. If it can't do that for whatever reason, then again just use the enum:

messaging.delete( "message", id); 
messaging.delete( "conversation", id); 

The same with markAsRead():

messaging.markAsRead( "message", id); 
messaging.markAsRead( "conversation", id); 

And, like I said, if we make the id's unique for conversations and messages, then it makes the API even simpler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions