forked from alchemy-fr/Phlickr
-
Notifications
You must be signed in to change notification settings - Fork 1
/
AuthedCollection.php
76 lines (69 loc) · 2.09 KB
/
AuthedCollection.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* @version $Id$
* @author William O'Beirne <[email protected]>
* @license http://opensource.org/licenses/lgpl-license.php
* GNU Lesser General Public License, Version 2.1
* @package Phlickr
*/
/**
* This class extends Phlickr_Photoset.
*/
require_once dirname(__FILE__) . '/Collection.php';
/**
* Phlickr_AuthedCollection represents a Flickr photoset.
*
* @package Phlickr
* @author William O'Beirne <[email protected]>
* @see Phlickr_Collection
*/
class Phlickr_AuthedCollection extends Phlickr_Collection {
/**
* Constructor.
*
* You can construct a photoset from an Id or XML.
*
* @param object Phlickr_Api $api This object must have valid
* authentication information or an exception will be thrown.
* @param mixed $source integer Id, object SimpleXMLElement
* @throws Phlickr_Exception, Phlickr_ConnectionException,
* Phlickr_XmlParseException
*/
function __construct(Phlickr_Api $api, $source) {
assert($api->isAuthValid());
parent::__construct($api, $source);
}
/**
* Edit sets in the collection.
*
* @param array $ids Array of flickr IDs.
* @throws Phlickr_Exception, Phlickr_ConnectionException,
* Phlickr_XmlParseException
*/
function editSets($ids) {
$resp = $this->getApi()->executeMethod(
'flickr.collections.editSets',
array(
'collection_id' => $this->getId(),
'photoset_ids' => implode(',', $ids),
)
);
$this->refresh();
}
/**
* Removes a set from the collection.
*
* @param int $id ID of set to remove.
* @throws Phlickr_Exception, Phlickr_ConnectionException,
* Phlickr_XmlParseException
*/
function removeSet($id) {
$resp = $this->getApi()->executeMethod(
'flickr.collections.removeSet',
array('collection_id' => $this->getId(),
'photoset_id' => $id
)
);
$this->refresh();
}
}