Mailspring/docs/Message.html
2015-10-03 12:05:22 -07:00

182 lines
7.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
layout: docs
title: Message
edit_url: "https://github.com/nylas/N1/blob/master/src/flux/models/message.coffee"
---
<h2>Summary</h2>
<div class="markdown-from-sourecode">
<p><p>The Message model represents a Message object served by the Nylas Platform API.
For more information about Messages on the Nylas Platform, read the
<a href="https://nylas.com/docs/api#messages">Messages API Documentation</a></p>
<p>Messages are a sub-object of threads. The content of a message is immutable (with the
exception being drafts). Nylas does not support operations such as move or delete on
individual messages; those operations should be performed on the messages thread.
All messages are part of a thread, even if that thread has only one message.</p>
<h2 id="attributes">Attributes</h2>
<p><code>to</code>: <a href='attributecollection.html'>AttributeCollection</a> A collection of <a href='contact.html'>Contact</a> objects</p>
<p><code>cc</code>: <a href='attributecollection.html'>AttributeCollection</a> A collection of <a href='contact.html'>Contact</a> objects</p>
<p><code>bcc</code>: <a href='attributecollection.html'>AttributeCollection</a> A collection of <a href='contact.html'>Contact</a> objects</p>
<p><code>from</code>: <a href='attributecollection.html'>AttributeCollection</a> A collection of <a href='contact.html'>Contact</a> objects.</p>
<p><code>replyTo</code>: <a href='attributecollection.html'>AttributeCollection</a> A collection of <a href='contact.html'>Contact</a> objects.</p>
<p><code>date</code>: <a href='attributedatetime.html'>AttributeDateTime</a> When the message was delivered. Queryable.</p>
<p><code>subject</code>: <a href='attributestring.html'>AttributeString</a> The subject of the thread. Queryable.</p>
<p><code>snippet</code>: <a href='attributestring.html'>AttributeString</a> A short, 140-character plain-text summary of the message body.</p>
<p><code>unread</code>: <a href='attributeboolean.html'>AttributeBoolean</a> True if the message is unread. Queryable.</p>
<p><code>starred</code>: <a href='attributeboolean.html'>AttributeBoolean</a> True if the message is starred. Queryable.</p>
<p><code>draft</code>: <a href='attributeboolean.html'>AttributeBoolean</a> True if the message is a draft. Queryable.</p>
<p><code>version</code>: <a href='attributenumber.html'>AttributeNumber</a> The version number of the message. Message
versions are used for drafts, and increment when attributes are changed.</p>
<p><code>files</code>: <a href='attributecollection.html'>AttributeCollection</a> A set of <a href='file.html'>File</a> models representing
the attachments on this thread.</p>
<p><code>body</code>: <a href='attributejoineddata.html'>AttributeJoinedData</a> The HTML body of the message. You must specifically
request this attribute when querying for a Message using the {<a href='AttributeJoinedData.html#include'>AttributeJoinedData::include</a>}
method.</p>
<p><code>pristine</code>: <a href='attributeboolean.html'>AttributeBoolean</a> True if the message is a draft which has not been
edited since it was created.</p>
<p><code>threadId</code>: <a href='attributestring.html'>AttributeString</a> The ID of the Message&#39;s parent <a href='thread.html'>Thread</a>. Queryable.</p>
<p><code>replyToMessageId</code>: <a href='attributestring.html'>AttributeString</a> The ID of a <a href='message.html'>Message</a> that this message
is in reply to.</p>
<p>This class also inherits attributes from <a href='model.html'>Model</a></p>
</p>
</div>
<ul>
</ul>
<h3>Instance Methods</h3>
<h4 id=participants class="function-name">
participants(<span class="args"></span>) <a href="#participants" class="link"></a>
</h4>
<div class="function-description markdown-from-sourecode">
<p></p>
</div>
<strong>Returns</strong>
<table class="arguments">
<tr>
<th>Return Values</th>
</tr>
<tr><td class="markdown-from-sourecode"><p>Returns a set of uniqued message participants by combining the
<code>to</code>, <code>cc</code>, and <code>from</code> fields.</p>
</td></tr>
</table>
<h4 id=participantsForReplyAll class="function-name">
participantsForReplyAll(<span class="args"></span>) <a href="#participantsForReplyAll" class="link"></a>
</h4>
<div class="function-description markdown-from-sourecode">
<p></p>
</div>
<strong>Returns</strong>
<table class="arguments">
<tr>
<th>Return Values</th>
</tr>
<tr><td class="markdown-from-sourecode"><p>Returns a hash with <code>to</code> and <code>cc</code> keys for authoring a new draft in
&quot;reply all&quot; to this message. This method takes into account whether the
message is from the current user, and also looks at the replyTo field.</p>
</td></tr>
</table>
<h4 id=participantsForReply class="function-name">
participantsForReply(<span class="args"></span>) <a href="#participantsForReply" class="link"></a>
</h4>
<div class="function-description markdown-from-sourecode">
<p></p>
</div>
<strong>Returns</strong>
<table class="arguments">
<tr>
<th>Return Values</th>
</tr>
<tr><td class="markdown-from-sourecode"><p>Returns a hash with <code>to</code> and <code>cc</code> keys for authoring a new draft in
&quot;reply&quot; to this message. This method takes into account whether the
message is from the current user, and also looks at the replyTo field.</p>
</td></tr>
</table>
<h4 id=fileIds class="function-name">
fileIds(<span class="args"></span>) <a href="#fileIds" class="link"></a>
</h4>
<div class="function-description markdown-from-sourecode">
<p></p>
</div>
<strong>Returns</strong>
<table class="arguments">
<tr>
<th>Return Values</th>
</tr>
<tr><td class="markdown-from-sourecode"><p>Returns an <a href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/array'>Array</a> of <a href='file.html'>File</a> IDs</p>
</td></tr>
</table>
<h4 id=isFromMe class="function-name">
isFromMe(<span class="args"></span>) <a href="#isFromMe" class="link"></a>
</h4>
<div class="function-description markdown-from-sourecode">
<p></p>
</div>
<strong>Returns</strong>
<table class="arguments">
<tr>
<th>Return Values</th>
</tr>
<tr><td class="markdown-from-sourecode"><p>Returns true if this message is from the current user&#39;s email
address. In the future, this method will take into account all of the
user&#39;s email addresses and accounts.</p>
</td></tr>
</table>
<h4 id=plainTextBody class="function-name">
plainTextBody(<span class="args"></span>) <a href="#plainTextBody" class="link"></a>
</h4>
<div class="function-description markdown-from-sourecode">
<p></p>
</div>
<strong>Returns</strong>
<table class="arguments">
<tr>
<th>Return Values</th>
</tr>
<tr><td class="markdown-from-sourecode"><p>Returns a plaintext version of the message body using Chromium&#39;s
DOMParser. Use with care.</p>
</td></tr>
</table>
<h4 id=replyAttributionLine class="function-name">
replyAttributionLine(<span class="args"></span>) <a href="#replyAttributionLine" class="link"></a>
</h4>
<div class="function-description markdown-from-sourecode">
<p></p>
</div>
<strong>Returns</strong>
<table class="arguments">
<tr>
<th>Return Values</th>
</tr>
<tr><td class="markdown-from-sourecode"><p>Returns the standard attribution line for this message,
localized for the current user.
ie &quot;On Dec. 12th, 2015 at 4:00PM, Ben Gotow wrote:&quot;</p>
</td></tr>
</table>