Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/AdminResources/Emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function get(array $params = []): array
/**
* @throws Exception
*/
public function find(string $id): MsGraphAdmin
public function find(string $id): array
{
if ($this->userId == null) {
throw new Exception('userid is required.');
Expand All @@ -154,7 +154,7 @@ public function find(string $id): MsGraphAdmin
return MsGraphAdmin::get('users/'.$this->userId.'/messages/'.$id);
}

public function findAttachments(string $id): MsGraphAdmin
public function findAttachments(string $id): array
{
return MsGraphAdmin::get('users/'.$this->userId.'/messages/'.$id.'/attachments');
}
Expand Down Expand Up @@ -193,7 +193,7 @@ function (array $m) use ($attachments) {
/**
* @throws Exception
*/
public function send(): MsGraphAdmin
public function send(): void
{
if (strlen($this->userId) === 0) {
throw new Exception('userId is required.');
Expand All @@ -211,13 +211,13 @@ public function send(): MsGraphAdmin
throw new Exception('Comment is only used for replies and forwarding, please use body instead.');
}

return MsGraphAdmin::post('users/'.$this->userId.'/sendMail', self::prepareEmail());
MsGraphAdmin::post('users/'.$this->userId.'/sendMail', self::prepareEmail());
}

/**
* @throws Exception
*/
public function reply(): MsGraphAdmin
public function reply()
{
if (strlen($this->userId) === 0) {
throw new Exception('userId is required.');
Expand All @@ -231,13 +231,13 @@ public function reply(): MsGraphAdmin
throw new Exception('Body is only used for sending new emails, please use comment instead.');
}

return MsGraphAdmin::post('users/'.$this->userId.'/messages/'.$this->id.'/replyAll', self::prepareEmail());
MsGraphAdmin::post('users/'.$this->userId.'/messages/'.$this->id.'/replyAll', self::prepareEmail());
}

/**
* @throws Exception
*/
public function forward(): MsGraphAdmin
public function forward()
{
if (strlen($this->userId) === 0) {
throw new Exception('userId is required.');
Expand All @@ -251,19 +251,19 @@ public function forward(): MsGraphAdmin
throw new Exception('Body is only used for sending new emails, please use comment instead.');
}

return MsGraphAdmin::post('users/'.$this->userId.'/messages/'.$this->id.'/forward', self::prepareEmail());
MsGraphAdmin::post('users/'.$this->userId.'/messages/'.$this->id.'/forward', self::prepareEmail());
}

/**
* @throws Exception
*/
public function delete(string $id): MsGraphAdmin
public function delete(string $id)
{
if ($this->userId == null) {
throw new Exception('userId is required.');
}

return MsGraphAdmin::delete('users/'.$this->userId.'/messages/'.$id);
MsGraphAdmin::delete('users/'.$this->userId.'/messages/'.$id);
}

protected function prepareEmail(): array
Expand Down