1 '''
2 Copyright 2012 Alexey Kravets <mr.kayrick@gmail.com>
3
4 This file is part of PythonMindmeister.
5
6 PythonMindmeister is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 PythonMindmeister is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with PythonMindmeister. If not, see <http://www.gnu.org/licenses/>.
18
19 This file contains MindMeister API calls for connections. Additional
20 information can be found by this URL:
21 http://www.mindmeister.com/developers/explore
22
23 This product uses the MindMeister API but is not endorsed or certified
24 by MindMeister.
25 '''
26
27
28 import common
29 import parser
30 from diagnostic import MindException
31
32
33 -def add (token, from_id, map_id, to_id):
34 '''
35 Adds connection.
36
37 Arguments:
38 from_id
39 map_id
40 to_id
41 Optional (keyword) Arguments:
42
43 This function calls mm.connections.add MindMeister API method
44 More documentation can be found by this URL:
45 http://www.mindmeister.com/developers/explore_method?method=mm.connections.add
46 '''
47 rawResult = common.performRequest ("rest", token, method="mm.connections.add", from_id = from_id, map_id = map_id, to_id = to_id)
48 root = parser.parse ("mm.connections.add", rawResult)
49 if root.attrib['stat'] != "ok":
50 raise MindException ('mm.connections.add', root[0])
51
52
54 '''
55 Changes color of the connection.
56
57 Arguments:
58 color
59 from_id
60 map_id
61 to_id
62 Optional (keyword) Arguments:
63
64 This function calls mm.connections.changeColor MindMeister API method
65 More documentation can be found by this URL:
66 http://www.mindmeister.com/developers/explore_method?method=mm.connections.changeColor
67 '''
68 rawResult = common.performRequest ("rest", token, method="mm.connections.changeColor", color = color, from_id = from_id, map_id = map_id, to_id = to_id)
69 root = parser.parse ("mm.connections.changeColor", rawResult)
70 if root.attrib['stat'] != "ok":
71 raise MindException ('mm.connections.changeColor', root[0])
72
73 -def delete (token, from_id, map_id, to_id):
74 '''
75 Deletes connection.
76
77 Arguments:
78 from_id
79 map_id
80 to_id
81 Optional (keyword) Arguments:
82
83 This function calls mm.connections.delete MindMeister API method
84 More documentation can be found by this URL:
85 http://www.mindmeister.com/developers/explore_method?method=mm.connections.delete
86 '''
87 rawResult = common.performRequest ("rest", token, method="mm.connections.delete", from_id = from_id, map_id = map_id, to_id = to_id)
88 root = parser.parse ("mm.connections.delete", rawResult)
89 if root.attrib['stat'] != "ok":
90 raise MindException ('mm.connections.delete', root[0])
91