| @@ 68-85 (lines=18) @@ | ||
| 65 | * @param array $options |
|
| 66 | * @return Type\ItemIdType[] |
|
| 67 | */ |
|
| 68 | public function createContacts($contacts, $options = array()) |
|
| 69 | { |
|
| 70 | $request = array('Contact' => $contacts); |
|
| 71 | ||
| 72 | $defaultOptions = array( |
|
| 73 | 'MessageDisposition' => 'SaveOnly', |
|
| 74 | 'SavedItemFolderId' => array('FolderId' => $this->getFolderId()->toArray()) |
|
| 75 | ); |
|
| 76 | $options = array_replace_recursive($defaultOptions, $options); |
|
| 77 | ||
| 78 | $result = $this->createItems($request, $options); |
|
| 79 | ||
| 80 | if (!is_array($result)) { |
|
| 81 | $result = array($result); |
|
| 82 | } |
|
| 83 | ||
| 84 | return $result; |
|
| 85 | } |
|
| 86 | ||
| 87 | public function updateContactItem(Type\ItemIdType $itemId, $changes) |
|
| 88 | { |
|
| @@ 87-108 (lines=22) @@ | ||
| 84 | return $result; |
|
| 85 | } |
|
| 86 | ||
| 87 | public function updateContactItem(Type\ItemIdType $itemId, $changes) |
|
| 88 | { |
|
| 89 | //Create the request |
|
| 90 | $request = array( |
|
| 91 | 'ItemChange' => array( |
|
| 92 | 'ItemId' => $itemId->toArray(), |
|
| 93 | 'Updates' => array( |
|
| 94 | 'SetItemField' => $this->buildUpdateItemChanges('Contact', 'contacts', $changes) |
|
| 95 | ) |
|
| 96 | ) |
|
| 97 | ); |
|
| 98 | ||
| 99 | $options = array(); |
|
| 100 | ||
| 101 | $items = $this->updateItems($request, $options); |
|
| 102 | ||
| 103 | if (!is_array($items)) { |
|
| 104 | $items = array($items); |
|
| 105 | } |
|
| 106 | ||
| 107 | return $items; |
|
| 108 | } |
|
| 109 | } |
|
| 110 | ||