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 ideas. Additional information can
20 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 objects import Idea
31 from diagnostic import MindException
32
33
35 '''
36 Adds an attachment to a node.
37
38 Arguments:
39 file
40 idea_id
41 map_id
42 Optional (keyword) Arguments:
43
44 This function calls mm.ideas.addAttachment MindMeister API method
45 More documentation can be found by this URL:
46 http://www.mindmeister.com/developers/explore_method?method=mm.ideas.addAttachment
47 '''
48 rawResult = common.performRequest ("rest", token, method="mm.ideas.addAttachment", file = file, idea_id = idea_id, map_id = map_id)
49 root = parser.parse (rawResult)
50 if root.attrib['stat'] != "ok":
51 raise MindException('mm.ideas.addAttachment', root[0])
52 return Idea(root[0])
53
54 -def change (token, idea_id, map_id, **args):
55 '''
56 Changes an idea on a given map.
57
58 Arguments:
59 idea_id
60 map_id
61 Optional (keyword) Arguments:
62 icon
63 link
64 note
65 style
66 task
67 title
68 x_pos
69 y_pos
70
71 This function calls mm.ideas.change MindMeister API method
72 More documentation can be found by this URL:
73 http://www.mindmeister.com/developers/explore_method?method=mm.ideas.change
74 '''
75 rawResult = common.performRequest ("rest", token, method="mm.ideas.change", idea_id = idea_id, map_id = map_id, **args)
76
77 root = parser.parse (rawResult)
78 if root.attrib['stat'] != "ok":
79 raise MindException('mm.ideas.change', root[0])
80 return Idea(root[0])
81
83 '''
84 Deletes an attachment.
85
86 Arguments:
87 attachment_id
88 idea_id
89 map_id
90 Optional (keyword) Arguments:
91
92 This function calls mm.ideas.deleteAttachment MindMeister API method
93 More documentation can be found by this URL:
94 http://www.mindmeister.com/developers/explore_method?method=mm.ideas.deleteAttachment
95 '''
96 rawResult = common.performRequest ("rest", token, method="mm.ideas.deleteAttachment", attachment_id = attachment_id, idea_id = idea_id, map_id = map_id)
97
98 root = parser.parse (rawResult)
99 if root.attrib['stat'] != "ok":
100 raise MindException('mm.ideas.deleteAttachment', root[0])
101
102 -def delete (token, idea_id, map_id):
103 '''
104 Deletes an idea on a given map.
105
106 Arguments:
107 idea_id
108 map_id
109 Optional (keyword) Arguments:
110
111 This function calls mm.ideas.delete MindMeister API method
112 More documentation can be found by this URL:
113 http://www.mindmeister.com/developers/explore_method?method=mm.ideas.delete
114 '''
115 rawResult = common.performRequest ("rest", token, method="mm.ideas.delete", idea_id = idea_id, map_id = map_id)
116 root = parser.parse (rawResult)
117 if root.attrib['stat'] != "ok":
118 raise MindException('mm.ideas.delete', root[0])
119 return Idea(root[0])
120
121 -def insert (token, map_id, parent_id, title, **args):
122 '''
123 Inserts a new idea on a given map.
124
125 Arguments:
126 map_id
127 parent_id
128 title
129 Optional (keyword) Arguments:
130 icon
131 link
132 note
133 rank
134 style
135 task
136 x_pos
137 y_pos
138
139 This function calls mm.ideas.insert MindMeister API method
140 More documentation can be found by this URL:
141 http://www.mindmeister.com/developers/explore_method?method=mm.ideas.insert
142 '''
143 rawResult = common.performRequest ("rest", token, method="mm.ideas.insert", map_id = map_id, parent_id = parent_id, title = title, **args)
144
145 root = parser.parse (rawResult)
146 if root.attrib['stat'] != "ok":
147 raise MindException('mm.ideas.insert', root[0])
148 return Idea(root[0])
149
150 -def move (token, idea_id, map_id, parent_id, rank, **args):
151 '''
152 Moves an idea on a given map.
153
154 Arguments:
155 idea_id
156 map_id
157 parent_id
158 rank
159 Optional (keyword) Arguments:
160 x_pos
161 y_pos
162
163 This function calls mm.ideas.move MindMeister API method
164 More documentation can be found by this URL:
165 http://www.mindmeister.com/developers/explore_method?method=mm.ideas.move
166 '''
167 rawResult = common.performRequest ("rest", token, method="mm.ideas.move", idea_id = idea_id, map_id = map_id, parent_id = parent_id, rank = rank, **args)
168
169 root = parser.parse (rawResult)
170 if root.attrib['stat'] != "ok":
171 raise MindException('mm.ideas.move', root[0])
172 return Idea(root[0])
173
175 '''
176 Toggles (or sets) the open/closed status of a branch.
177
178 Arguments:
179 idea_id
180 map_id
181 Optional (keyword) Arguments:
182 closed
183
184 This function calls mm.ideas.toggleClosed MindMeister API method
185 More documentation can be found by this URL:
186 http://www.mindmeister.com/developers/explore_method?method=mm.ideas.toggleClosed
187 '''
188 rawResult = common.performRequest ("rest", token, method="mm.ideas.toggleClosed", idea_id = idea_id, map_id = map_id, closed = closed)
189
190 root = parser.parse (rawResult)
191 if root.attrib['stat'] != "ok":
192 raise MindException('mm.ideas.toggleClosed', root[0])
193