rename IlinkType into LinkType as these types will be used for Nlinks as well
[plcapi.git] / PLC / Methods / GetLinkTypes.py
1 #
2 # Thierry Parmentelat - INRIA
3 #
4 # $Revision: 9423 $
5 #
6 from PLC.Method import Method
7 from PLC.Parameter import Parameter, Mixed
8 from PLC.Filter import Filter
9 from PLC.Auth import Auth
10 from PLC.LinkTypes import LinkType, LinkTypes
11
12 class GetLinkTypes(Method):
13     """
14     Returns an array of structs containing details about
15     ilink types.
16
17     The usual filtering scheme applies on this method.
18     """
19
20     roles = ['admin', 'pi', 'user', 'tech', 'node']
21
22     accepts = [
23         Auth(),
24         Mixed([Mixed(LinkType.fields['link_type_id'],
25                      LinkType.fields['name'])],
26               Filter(LinkType.fields)),
27         Parameter([str], "List of fields to return", nullok = True)
28         ]
29
30     returns = [LinkType.fields]
31
32     def call(self, auth, link_type_filter = None, return_fields = None):
33         return LinkTypes(self.api, link_type_filter, return_fields)