1 | <?php |
||
8 | class PulseNote extends ApiObject |
||
9 | { |
||
10 | const API_PREFIX = "pulses"; |
||
11 | |||
12 | // ================================================================================================================ |
||
13 | // Instance Variables |
||
14 | // ================================================================================================================ |
||
15 | |||
16 | /** |
||
17 | * The collaboration box type (rich_text, file_list, faq_list). |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $type; |
||
22 | |||
23 | /** |
||
24 | * The note's id. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $id; |
||
29 | |||
30 | /** |
||
31 | * The note's title. |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $title; |
||
36 | |||
37 | /** |
||
38 | * The note's project_id. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $project_id; |
||
43 | |||
44 | /** |
||
45 | * Describes who can edit this note. Can be either 'everyone' or 'owners'. |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $permissions; |
||
50 | |||
51 | /** |
||
52 | * The note's body |
||
53 | * |
||
54 | * @var string |
||
55 | */ |
||
56 | protected $content; |
||
57 | |||
58 | /** |
||
59 | * Creation time. |
||
60 | * |
||
61 | * @var \DateTime |
||
62 | */ |
||
63 | protected $created_at; |
||
64 | |||
65 | /** |
||
66 | * Last update time. |
||
67 | * |
||
68 | * @var \DateTime |
||
69 | */ |
||
70 | protected $updated_at; |
||
71 | |||
72 | public function __construct ($array) |
||
78 | |||
79 | // ================================================================================================================ |
||
80 | // Getter functions |
||
81 | // ================================================================================================================ |
||
82 | |||
83 | /** |
||
84 | * The collaboration box type (rich_text, file_list, faq_list). |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | public function getType() |
||
92 | |||
93 | /** |
||
94 | * The note's id. |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | public function getId() |
||
102 | |||
103 | /** |
||
104 | * The note's title. |
||
105 | * |
||
106 | * @return string |
||
107 | */ |
||
108 | public function getTitle() |
||
112 | |||
113 | /** |
||
114 | * The note's project_id. |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | public function getPulseId() |
||
122 | |||
123 | /** |
||
124 | * Describes who can edit this note. Can be either 'everyone' or 'owners'. |
||
125 | * |
||
126 | * @return string |
||
127 | */ |
||
128 | public function getPermissions() |
||
132 | |||
133 | /** |
||
134 | * The note's body. |
||
135 | * |
||
136 | * @return string |
||
137 | */ |
||
138 | public function getContent() |
||
142 | |||
143 | /** |
||
144 | * Creation time. |
||
145 | * |
||
146 | * @return \DateTime |
||
147 | */ |
||
148 | public function getCreatedAt() |
||
154 | |||
155 | /** |
||
156 | * Last update time. |
||
157 | * |
||
158 | * @return \DateTime |
||
159 | */ |
||
160 | public function getUpdatedAt() |
||
166 | |||
167 | // ================================================================================================================ |
||
168 | // Modification functions |
||
169 | // ================================================================================================================ |
||
170 | |||
171 | /** |
||
172 | * Edit a note's content or information. Set values to NULL in order to not update them |
||
173 | * |
||
174 | * @api |
||
175 | * |
||
176 | * @param null|string $title The new title of the note |
||
177 | * @param null|string $content The new content of the note |
||
178 | * @param null|int|PulseUser $user_id The new author of the note |
||
179 | * @param null|bool $create_update Whether to create an update or not |
||
180 | * |
||
181 | * @since 0.1.0 |
||
182 | * |
||
183 | * @throws InvalidObjectException The object has already been deleted from DaPulse |
||
184 | * @throws \InvalidArgumentException An update was to be created but no author for the update was specified |
||
185 | * |
||
186 | * @return $this |
||
187 | */ |
||
188 | public function editNote ($title = NULL, $content = NULL, $user_id = NULL, $create_update = NULL) |
||
218 | |||
219 | /** |
||
220 | * Edit the title of the note only. |
||
221 | * |
||
222 | * **Note** This is a convenience function that just calls PulseNote->editNote(). In order to change multiple |
||
223 | * values, use PulseNote->editNote() instead of chaining the individual edit functions because each convenience |
||
224 | * function will make their own separate API call making the process significantly slower. |
||
225 | * |
||
226 | * @api |
||
227 | * |
||
228 | * @param string $title The new title of the note |
||
229 | * |
||
230 | * @since 0.1.0 |
||
231 | * |
||
232 | * @return $this |
||
233 | */ |
||
234 | public function editTitle ($title) |
||
238 | |||
239 | /** |
||
240 | * Edit the content of the note only. |
||
241 | * |
||
242 | * **Note** This is a convenience function that just calls PulseNote->editNote(). In order to change multiple |
||
243 | * values, use PulseNote->editNote() instead of chaining the individual edit functions because each convenience |
||
244 | * function will make their own separate API call making the process significantly slower. |
||
245 | * |
||
246 | * @api |
||
247 | * |
||
248 | * @param string $content The new content of the note |
||
249 | * |
||
250 | * @since 0.1.0 |
||
251 | * |
||
252 | * @return $this |
||
253 | */ |
||
254 | public function editContent ($content) |
||
258 | |||
259 | /** |
||
260 | * Edit the author of the note only. |
||
261 | * |
||
262 | * **Note** This is a convenience function that just calls PulseNote->editNote(). In order to change multiple |
||
263 | * values, use PulseNote->editNote() instead of chaining the individual edit functions because each convenience |
||
264 | * function will make their own separate API call making the process significantly slower. |
||
265 | * |
||
266 | * @api |
||
267 | * |
||
268 | * @param string $user_id The new author of the note |
||
269 | * |
||
270 | * @since 0.1.0 |
||
271 | * |
||
272 | * @return $this |
||
273 | */ |
||
274 | public function editAuthor ($user_id) |
||
278 | |||
279 | /** |
||
280 | * Delete this note |
||
281 | * |
||
282 | * @api |
||
283 | * |
||
284 | * @since 0.1.0 |
||
285 | * |
||
286 | * @throws InvalidObjectException The object has already been deleted from DaPulse |
||
287 | */ |
||
288 | public function deleteNote () |
||
296 | |||
297 | private function getNotesUrl () |
||
301 | } |
This check marks property names that have not been written in camelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes
databaseConnectionString
.