Class: Leash::Integration::SliteClient
- Inherits:
-
Object
- Object
- Leash::Integration::SliteClient
- Defined in:
- lib/leash/integration/slite.rb
Instance Method Summary collapse
-
#ask_slite(question, parentnoteid: nil) ⇒ Object
Asks a question to Slite and returns an answer with sources.
-
#create_note(title, parentnoteid: nil, markdown: nil, html: nil) ⇒ Object
Creates a new note in Slite with the specified title and optional content.
-
#get_note(noteid, format: nil) ⇒ Object
Retrieves a specific note from Slite by its ID.
-
#get_note_children(noteid, cursor: nil) ⇒ Object
Retrieves all child notes of a specific note from Slite.
-
#initialize(leash) ⇒ SliteClient
constructor
Create a new Slite integration client.
-
#search_notes(query, parentnoteid: nil, reviewstate: nil, page: nil, hitsperpage: nil, lasteditedafter: nil, includearchived: nil) ⇒ Object
Searches notes in Slite based on a query and returns the top search results.
-
#update_note(noteid, title: nil, markdown: nil, html: nil) ⇒ Object
Updates an existing note in Slite.
Constructor Details
#initialize(leash) ⇒ SliteClient
Create a new Slite integration client.
11 12 13 |
# File 'lib/leash/integration/slite.rb', line 11 def initialize(leash) @leash = leash end |
Instance Method Details
#ask_slite(question, parentnoteid: nil) ⇒ Object
Asks a question to Slite and returns an answer with sources.
43 44 45 46 47 48 49 |
# File 'lib/leash/integration/slite.rb', line 43 def ask_slite(question, parentnoteid: nil) params = { 'question' => question, 'parentNoteId' => parentnoteid }.compact @leash.call('slite', 'ask-slite', params) end |
#create_note(title, parentnoteid: nil, markdown: nil, html: nil) ⇒ Object
Creates a new note in Slite with the specified title and optional content.
84 85 86 87 88 89 90 91 92 |
# File 'lib/leash/integration/slite.rb', line 84 def create_note(title, parentnoteid: nil, markdown: nil, html: nil) params = { 'title' => title, 'parentNoteId' => parentnoteid, 'markdown' => markdown, 'html' => html }.compact @leash.call('slite', 'create-note', params) end |
#get_note(noteid, format: nil) ⇒ Object
Retrieves a specific note from Slite by its ID.
56 57 58 59 60 61 62 |
# File 'lib/leash/integration/slite.rb', line 56 def get_note(noteid, format: nil) params = { 'noteId' => noteid, 'format' => format }.compact @leash.call('slite', 'get-note', params) end |
#get_note_children(noteid, cursor: nil) ⇒ Object
Retrieves all child notes of a specific note from Slite.
69 70 71 72 73 74 75 |
# File 'lib/leash/integration/slite.rb', line 69 def get_note_children(noteid, cursor: nil) params = { 'noteId' => noteid, 'cursor' => cursor }.compact @leash.call('slite', 'get-note-children', params) end |
#search_notes(query, parentnoteid: nil, reviewstate: nil, page: nil, hitsperpage: nil, lasteditedafter: nil, includearchived: nil) ⇒ Object
Searches notes in Slite based on a query and returns the top search results.
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/leash/integration/slite.rb', line 25 def search_notes(query, parentnoteid: nil, reviewstate: nil, page: nil, hitsperpage: nil, lasteditedafter: nil, includearchived: nil) params = { 'query' => query, 'parentNoteId' => parentnoteid, 'reviewState' => reviewstate, 'page' => page, 'hitsPerPage' => hitsperpage, 'lastEditedAfter' => lasteditedafter, 'includeArchived' => includearchived }.compact @leash.call('slite', 'search-notes', params) end |
#update_note(noteid, title: nil, markdown: nil, html: nil) ⇒ Object
Updates an existing note in Slite. Can update the title and/or content.
101 102 103 104 105 106 107 108 109 |
# File 'lib/leash/integration/slite.rb', line 101 def update_note(noteid, title: nil, markdown: nil, html: nil) params = { 'noteId' => noteid, 'title' => title, 'markdown' => markdown, 'html' => html }.compact @leash.call('slite', 'update-note', params) end |