X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FGetAddressTypes.py;h=d10be73905e4cb7ed187c214759f02ec5e5ba5fa;hb=bd0cbf4f7f2e4cf7ceda500bfa6f98c0a700018b;hp=df3a1b6143f87d877667c5b7ecc07459151a87eb;hpb=1f8c38dd1357c93e4be8d94456b7274a591d2db4;p=plcapi.git diff --git a/PLC/Methods/GetAddressTypes.py b/PLC/Methods/GetAddressTypes.py index df3a1b6..d10be73 100644 --- a/PLC/Methods/GetAddressTypes.py +++ b/PLC/Methods/GetAddressTypes.py @@ -1,27 +1,32 @@ from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed +from PLC.Filter import Filter from PLC.AddressTypes import AddressType, AddressTypes from PLC.Auth import Auth class GetAddressTypes(Method): """ - Get an array of structs containing details about valid address - types. If address_type_id_or_name_list is specified, only the - specified address types will be queried. + Returns an array of structs containing details about address + types. If address_type_filter is specified and is an array of + address type identifiers, or a struct of address type attributes, + only address types matching the filter will be returned. If + return_fields is specified, only the specified details will be + returned. """ - roles = ['admin', 'pi', 'user', 'tech'] + roles = ['admin', 'pi', 'user', 'tech', 'node'] accepts = [ Auth(), - [Mixed(AddressType.fields['address_type_id'], - AddressType.fields['name'])] + Mixed([Mixed(AddressType.fields['address_type_id'], + AddressType.fields['name'])], + Filter(AddressType.fields)), + Parameter([str], "List of fields to return", nullok = True) ] returns = [AddressType.fields] - def call(self, auth, address_type_id_or_name_list = None): - address_types = AddressTypes(self.api, address_type_id_or_name_list).values() - return address_types + def call(self, auth, address_type_filter = None, return_fields = None): + return AddressTypes(self.api, address_type_filter, return_fields)