forked from open-networks/go-msgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create the ability to send email messages
- Loading branch information
1 parent
ae385fc
commit 84313f4
Showing
16 changed files
with
231 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package msgraph | ||
|
||
import "time" | ||
|
||
// Attachment represents content related to a event, message, or group post. | ||
// | ||
// See https://docs.microsoft.com/en-us/graph/api/resources/Attachment | ||
type Attachment struct { | ||
ContentType string `json:"contentType,omitempty"` | ||
ID string `json:"id,omitempty"` | ||
IsInline bool `json:"isInline,omitempty"` | ||
LastModifiedDateTime time.Time `json:"lastModifiedDateTime,omitempty"` | ||
Name string `json:"name,omitempty"` | ||
Size int32 `json:"size,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package msgraph | ||
|
||
import "time" | ||
|
||
// DateTimeTimeZone represents the date, time, and timezone for a given time. | ||
// | ||
// See https://docs.microsoft.com/en-us/graph/api/resources/DateTimeTimeZone?view=graph-rest-1.0 | ||
type DateTimeTimeZone struct { | ||
DateTime time.Time `json:"dateTime,omitempty"` | ||
TimeZone *time.Location `json:"timeZone,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package msgraph | ||
|
||
// Extension is an abstract type to represent an open type extension. | ||
// | ||
// See https://docs.microsoft.com/en-us/graph/api/resources/Extension | ||
type Extension struct { | ||
ID string `json:"id,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package msgraph | ||
|
||
// FollowupFlag are flags on a message that display how it should be followed up on. | ||
// | ||
// See https://docs.microsoft.com/en-us/graph/api/resources/FollowupFlag | ||
type FollowupFlag struct { | ||
CompletedDateTime DateTimeTimeZone `json:"completedDateTime,omitempty"` | ||
DueDateTime DateTimeTimeZone `json:"dueDateTime,omitempty"` | ||
FlagStatus string `json:"flagStatus,omitempty"` | ||
StartDateTime DateTimeTimeZone `json:"startDateTime,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package msgraph | ||
|
||
// Structure to reply to messages. | ||
// | ||
// See https://docs.microsoft.com/en-us/graph/api/message-reply | ||
type ForwardMessageOptions struct { | ||
Comment string `json:"comment,omitempty"` // A comment to add. | ||
ToRecipients []Recipient `json:"toRecipients,omitempty"` // Properties to be updated when repling. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package msgraph | ||
|
||
type MessageImportance string | ||
|
||
var ( | ||
MessageImportanceLow MessageImportance = "low" | ||
MessageImportanceNormal MessageImportance = "normal" | ||
MessageImportanceHigh MessageImportance = "high" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package msgraph | ||
|
||
// InternetMessageHeader is a key-value pair that represents an Internet message header that provides details of the network path taken from the message to the recipient. See RFC5322 for the definition. | ||
// | ||
// See https://docs.microsoft.com/en-us/graph/api/resources/InternetMessageHeader | ||
type InternetMessageHeader struct { | ||
Name string `json:"name,omitempty"` | ||
Value string `json:"value,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package msgraph | ||
|
||
// ItemBody represents the body of an item, either a message, event, or group post. | ||
// | ||
// See https://docs.microsoft.com/en-us/graph/api/resources/ItemBody | ||
type ItemBody struct { | ||
Content string `json:"content,omitempty"` | ||
ContentType string `json:"contentType,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package msgraph | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
// Message represents a single email message. | ||
// | ||
// See https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/Message | ||
type Message struct { | ||
BCCRecipients []Recipient `json:"bccRecipients,omitempty"` | ||
Body *ItemBody `json:"body,omitempty"` | ||
BodyPreview string `json:"bodyPreview,omitempty"` | ||
Categories []string `json:"categories,omitempty"` | ||
CCRecipients []Recipient `json:"ccRecipients,omitempty"` | ||
ChangeKey string `json:"changeKey,omitempty"` | ||
ConversationID string `json:"conversationId,omitempty"` | ||
ConversationIndex string `json:"conversationIndex,omitempty"` | ||
CreatedDateTime time.Time `json:"createdDateTime,omitempty"` | ||
Flag *FollowupFlag `json:"flag,omitempty"` | ||
From *Recipient `json:"from,omitempty"` | ||
HasAttachments *bool `json:"hasAttachments,omitempty"` | ||
ID string `json:"id,omitempty"` | ||
Importance MessageImportance `json:"importance,omitempty"` | ||
InferenceClassification MessageClassification `json:"inferenceClassification,omitempty"` | ||
InternetMessageHeaders []InternetMessageHeader `json:"internetMessageHeaders,omitempty"` | ||
InternetMessageID string `json:"internetMessageId,omitempty"` | ||
IsDeliveryReceiptRequested *bool `json:"isDeliveryReceiptRequested,omitempty"` | ||
IsDraft *bool `json:"isDraft,omitempty"` | ||
IsRead *bool `json:"isRead,omitempty"` | ||
IsReadReceiptRequested *bool `json:"isReadReceiptRequested,omitempty"` | ||
LastModifiedDateTime time.Time `json:"lastModifiedDateTime,omitempty"` | ||
ParentFolderId string `json:"parentFolderId,omitempty"` | ||
ReceivedDateTime time.Time `json:"receivedDateTime,omitempty"` | ||
ReplyTo []Recipient `json:"replyTo,omitempty"` | ||
Sender *Recipient `json:"sender,omitempty"` | ||
SentDateTime time.Time `json:"sentDateTime,omitempty"` | ||
Subject string `json:"subject,omitempty"` | ||
ToRecipients []Recipient `json:"toRecipients,omitempty"` | ||
UniqueBody *ItemBody `json:"uniqueBody,omitempty"` | ||
WebLink string `json:"webLink,omitempty"` | ||
Attachments []Attachment `json:"attachments,omitempty"` | ||
Extensions []Extension `json:"extensions,omitempty"` | ||
MultiValueExtendedProperties []MultiValueLegacyExtendedProperty `json:"multiValueExtendedProperties,omitempty"` | ||
SingleValueExtendedProperties []SingleValueLegacyExtendedProperty `json:"singleValueExtendedProperties,omitempty"` | ||
|
||
graphClient *GraphClient | ||
} | ||
|
||
// setGraphClient sets the graphClient instance in this instance and all child-instances (if any) | ||
func (m *Message) setGraphClient(graphClient *GraphClient) { | ||
m.graphClient = graphClient | ||
|
||
for _, bccRecipient := range m.BCCRecipients { | ||
bccRecipient.setGraphClient(graphClient) | ||
} | ||
|
||
for _, ccRecipient := range m.CCRecipients { | ||
ccRecipient.setGraphClient(graphClient) | ||
} | ||
|
||
m.From.setGraphClient(graphClient) | ||
|
||
for _, replyToRecipient := range m.ReplyTo { | ||
replyToRecipient.setGraphClient(graphClient) | ||
} | ||
|
||
m.Sender.setGraphClient(graphClient) | ||
|
||
for _, toRecipient := range m.ToRecipients { | ||
toRecipient.setGraphClient(graphClient) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package msgraph | ||
|
||
// MessageClassification is the importance of a user's message either inferred or overridden. | ||
type MessageClassification string | ||
|
||
var ( | ||
MessageClassificationFocused MessageClassification = "focused" | ||
MessageClassificationOther MessageClassification = "other" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package msgraph | ||
|
||
// Structure to reply to messages. | ||
// | ||
// See https://docs.microsoft.com/en-us/graph/api/message-reply | ||
type MessageReply struct { | ||
Comment string `json:"comment,omitempty"` // A comment to add. | ||
Message Message `json:"message,omitempty"` // Properties to be updated when repling. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package msgraph | ||
|
||
type Messages []Message | ||
|
||
func (m Messages) setGraphClient(graphClient *GraphClient) { | ||
for _, message := range m { | ||
message.setGraphClient(graphClient) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package msgraph | ||
|
||
// MultiValueLegacyExtendedProperty is an extended value that contains a slice of values. | ||
type MultiValueLegacyExtendedProperty struct { | ||
ID string `json:"id,omitempty"` | ||
Value []string `json:"value,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package msgraph | ||
|
||
// Represents a user that has sent or been sent an event, message, or group post. | ||
// | ||
// See https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/Recipient | ||
type Recipient struct { | ||
EmailAddress `json:"emailAddress,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package msgraph | ||
|
||
// SingleValueLegacyExtendedProperty is an extended that contains a single value. | ||
// | ||
// See https://docs.microsoft.com/en-us/graph/api/resources/SingleValueLegacyExtendedProperty | ||
type SingleValueLegacyExtendedProperty struct { | ||
ID string `json:"id,omitempty"` | ||
Value string `json:"value,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters