9f1d0d69aaa49413a3ec2859d74ff6b01e5e3069
[plcapi.git] / PLC / Methods / GetTagTypes.py
1 # $Id$
2 #
3 # Thierry Parmentelat - INRIA
4 #
5 # $Revision: 9423 $
6 #
7 from PLC.Method import Method
8 from PLC.Parameter import Parameter, Mixed
9 from PLC.Filter import Filter
10 from PLC.Auth import Auth
11 from PLC.TagTypes import TagType, TagTypes
12
13 class GetTagTypes(Method):
14     """
15     Returns an array of structs containing details about
16     node tag types.
17
18     The usual filtering scheme applies on this method.
19     """
20
21     roles = ['admin', 'pi', 'user', 'tech', 'node']
22
23     accepts = [
24         Auth(),
25         Mixed([Mixed(TagType.fields['tag_type_id'],
26                      TagType.fields['tagname'])],
27               Filter(TagType.fields)),
28         Parameter([str], "List of fields to return", nullok = True)
29         ]
30
31     returns = [TagType.fields]
32
33     def call(self, auth, tag_type_filter = None, return_fields = None):
34         return TagTypes(self.api, tag_type_filter, return_fields)