Skip to content

Commit 1aeace8

Browse files
committed
Added a $folderId option to getMailItems() and getUnreadMailItems(). Upgrading version number
1 parent 1715509 commit 1aeace8

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.6.0 - 2015-11-16
4+
* Added a `FolderIdType $folderId` option to `MailAPI::getMailItems()` and `MailAPI::getUnreadMailItems()`. Because this
5+
is a minor BC breaking change, it gets a new new minor version, since this is a pre-1.0 release.
6+
37
## 0.5.11 - 2015-11-16
48
* Added an `API::getMailbox(string $folderName = null)` function
59
* Added a `MailAPI::setFolderId(FolderIdType $folderId)` function

src/Mail/MailAPI.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,23 @@ public function pickMailFolder($displayName = null, $parentFolder = 'inbox')
5252
/**
5353
* Get all mail items in the inbox
5454
*
55+
* @param Type\FolderIdType
5556
* @param array $options
5657
* @return Type\MessageType[]
5758
*/
58-
public function getMailItems($options = array())
59+
public function getMailItems($folderId = null, $options = array())
5960
{
61+
if (!$folderId) {
62+
$folderId = $this->getFolderId();
63+
}
64+
6065
$request = array(
6166
'Traversal' => 'Shallow',
6267
'ItemShape' => array(
6368
'BaseShape' => 'AllProperties'
6469
),
6570
'ParentFolderIds' => array(
66-
'FolderId' => $this->getFolderId()->toXmlObject()
71+
'FolderId' => $folderId->toXmlObject()
6772
)
6873
);
6974

@@ -97,7 +102,12 @@ public function getMailItems($options = array())
97102
return $messages;
98103
}
99104

100-
public function getUnreadMailItems($options = array())
105+
/**
106+
* @param Type\FolderIdType $folderId
107+
* @param array $options
108+
* @return Type\MessageType[]
109+
*/
110+
public function getUnreadMailItems($folderId = null, $options = array())
101111
{
102112
$unReadOption = array(
103113
'Restriction' => array(
@@ -109,7 +119,7 @@ public function getUnreadMailItems($options = array())
109119

110120
$options = array_replace_recursive($unReadOption, $options);
111121

112-
return $this->getMailItems($options);
122+
return $this->getMailItems($folderId, $options);
113123
}
114124

115125
/**

0 commit comments

Comments
 (0)