allow filters to be specified in most Get() calls
[plcapi.git] / PLC / Methods / GetAddresses.py
index 75b8ad6..567cd98 100644 (file)
@@ -1,24 +1,27 @@
 from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
+from PLC.Filter import Filter
 from PLC.Addresses import Address, Addresses
 from PLC.Auth import Auth
 
 class GetAddresses(Method):
     """
-    Get an array of structs containing details about addresses. If
-    address_id_list is specified, only the specified addresses will be
-    queried.
+    Returns an array of structs containing details about addresses. If
+    address_filter is specified and is an array of address
+    identifiers, or a struct of address attributes, only addresses
+    matching the filter will be returned.
     """
 
     roles = ['admin', 'pi', 'user', 'tech']
 
     accepts = [
         Auth(),
-        [Address.fields['address_id']],
+        Mixed([Address.fields['address_id']],
+              Filter(Address.fields))
         ]
 
     returns = [Address.fields]
 
-    def call(self, auth, address_id_list = None):
-        return Addresses(self.api, address_id_list).values()
+    def call(self, auth, address_filter = None):
+        return Addresses(self.api, address_filter).values()