55from .data import (
66 BugoutJournal ,
77 BugoutJournals ,
8- BugoutScope ,
98 BugoutScopes ,
109 BugoutJournalScopeSpecs ,
1110 BugoutJournalEntry ,
1211 BugoutJournalEntries ,
12+ BugoutJournalEntryContent ,
13+ BugoutJournalEntryTags ,
1314 HolderType ,
1415 Method ,
1516)
@@ -166,7 +167,7 @@ def create_entry(
166167 context_id : Optional [str ] = None ,
167168 context_type : Optional [str ] = None ,
168169 ) -> BugoutJournalEntry :
169- journal_entry_path = f"journals/{ journal_id } /entries"
170+ entry_path = f"journals/{ journal_id } /entries"
170171 json = {
171172 "title" : title ,
172173 "content" : content ,
@@ -179,28 +180,145 @@ def create_entry(
179180 "Authorization" : f"Bearer { token } " ,
180181 }
181182 result = self ._call (
182- method = Method .post , path = journal_entry_path , headers = headers , json = json
183+ method = Method .post , path = entry_path , headers = headers , json = json
183184 )
184185 return BugoutJournalEntry (** result )
185186
186187 def get_entry (
187188 self , token : uuid .UUID , journal_id : uuid .UUID , entry_id : uuid .UUID
188189 ) -> BugoutJournalEntry :
189- journal_entry_id_path = f"journals/{ journal_id } /entries/{ entry_id } "
190+ entry_id_path = f"journals/{ journal_id } /entries/{ entry_id } "
190191 headers = {
191192 "Authorization" : f"Bearer { token } " ,
192193 }
193- result = self ._call (
194- method = Method .get , path = journal_entry_id_path , headers = headers
195- )
194+ result = self ._call (method = Method .get , path = entry_id_path , headers = headers )
196195 return BugoutJournalEntry (** result )
197196
198197 def get_entries (
199198 self , token : uuid .UUID , journal_id : uuid .UUID
200199 ) -> BugoutJournalEntries :
201- journal_entry_path = f"journals/{ journal_id } /entries"
200+ entry_path = f"journals/{ journal_id } /entries"
202201 headers = {
203202 "Authorization" : f"Bearer { token } " ,
204203 }
205- result = self ._call (method = Method .get , path = journal_entry_path , headers = headers )
204+ result = self ._call (method = Method .get , path = entry_path , headers = headers )
206205 return BugoutJournalEntries (** result )
206+
207+ def get_entry_content (
208+ self , token : uuid .UUID , journal_id : uuid .UUID , entry_id : uuid .UUID
209+ ) -> BugoutJournalEntryContent :
210+ entry_id_content_path = f"journals/{ journal_id } /entries/{ entry_id } /content"
211+ headers = {
212+ "Authorization" : f"Bearer { token } " ,
213+ }
214+ result = self ._call (
215+ method = Method .get , path = entry_id_content_path , headers = headers
216+ )
217+ return BugoutJournalEntryContent (** result )
218+
219+ def update_entry_content (
220+ self ,
221+ token : uuid .UUID ,
222+ journal_id : uuid .UUID ,
223+ entry_id : uuid .UUID ,
224+ title : str ,
225+ content : str ,
226+ ) -> BugoutJournalEntryContent :
227+ entry_id_content_path = f"journals/{ journal_id } /entries/{ entry_id } /content"
228+ json = {
229+ "title" : title ,
230+ "content" : content ,
231+ }
232+ headers = {
233+ "Authorization" : f"Bearer { token } " ,
234+ }
235+ result = self ._call (
236+ method = Method .put ,
237+ path = entry_id_content_path ,
238+ headers = headers ,
239+ json = json ,
240+ )
241+ return BugoutJournalEntryContent (** result )
242+
243+ def delete_entry (
244+ self ,
245+ token : uuid .UUID ,
246+ journal_id : uuid .UUID ,
247+ entry_id : uuid .UUID ,
248+ ) -> BugoutJournalEntry :
249+ entry_id_path = f"journals/{ journal_id } /entries/{ entry_id } "
250+ headers = {
251+ "Authorization" : f"Bearer { token } " ,
252+ }
253+ result = self ._call (method = Method .delete , path = entry_id_path , headers = headers )
254+ return BugoutJournalEntry (** result )
255+
256+ # Tags modules
257+ def get_most_used_tags (self , token : uuid .UUID , journal_id : uuid .UUID ) -> List [Any ]:
258+ tags_path = f"journals/{ journal_id } /tags"
259+ headers = {
260+ "Authorization" : f"Bearer { token } " ,
261+ }
262+ result = self ._call (method = Method .get , path = tags_path , headers = headers )
263+ return result
264+
265+ def create_tags (
266+ self ,
267+ token : uuid .UUID ,
268+ journal_id : uuid .UUID ,
269+ entry_id : uuid .UUID ,
270+ tags : List [str ],
271+ ) -> List [Any ]:
272+ tags_path = f"journals/{ journal_id } /entries/{ entry_id } /tags"
273+ json = {"tags" : tags }
274+ headers = {
275+ "Authorization" : f"Bearer { token } " ,
276+ }
277+ result = self ._call (
278+ method = Method .post , path = tags_path , headers = headers , json = json
279+ )
280+ return result
281+
282+ def get_tags (
283+ self , token : uuid .UUID , journal_id : uuid .UUID , entry_id : uuid .UUID
284+ ) -> BugoutJournalEntryTags :
285+ tags_path = f"journals/{ journal_id } /entries/{ entry_id } /tags"
286+ headers = {
287+ "Authorization" : f"Bearer { token } " ,
288+ }
289+ result = self ._call (method = Method .get , path = tags_path , headers = headers )
290+ return BugoutJournalEntryTags (** result )
291+
292+ def update_tags (
293+ self ,
294+ token : uuid .UUID ,
295+ journal_id : uuid .UUID ,
296+ entry_id : uuid .UUID ,
297+ tags : List [str ],
298+ ) -> List [Any ]:
299+ tags_path = f"journals/{ journal_id } /entries/{ entry_id } /tags"
300+ json = {"tags" : tags }
301+ headers = {
302+ "Authorization" : f"Bearer { token } " ,
303+ }
304+ result = self ._call (
305+ method = Method .put , path = tags_path , headers = headers , json = json
306+ )
307+ return result
308+
309+ def delete_tag (
310+ self ,
311+ token : uuid .UUID ,
312+ journal_id : uuid .UUID ,
313+ entry_id : uuid .UUID ,
314+ tag : str ,
315+ ) -> BugoutJournalEntryTags :
316+ tags_path = f"journals/{ journal_id } /entries/{ entry_id } /tags"
317+ json = {"tag" : tag }
318+ headers = {
319+ "Authorization" : f"Bearer { token } " ,
320+ }
321+ result = self ._call (
322+ method = Method .delete , path = tags_path , headers = headers , json = json
323+ )
324+ return BugoutJournalEntryTags (** result )
0 commit comments