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