Class: HighLevel::Resources::KnowledgeBase

Inherits:
Base
  • Object
show all
Defined in:
lib/high_level/resources/knowledge_base.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from HighLevel::Resources::Base

Instance Method Details

#create(body:, authorization: nil, **_opts) ⇒ Object

Create a new FAQ inside knowledge base



23
24
25
26
27
28
29
30
31
# File 'lib/high_level/resources/knowledge_base.rb', line 23

def create(body:, authorization: nil, **_opts)
  request(
    method: :post,
    path: "/knowledge-bases/faqs",
    security: ["Location-Access"],
    headers: { "Authorization" => authorization }.compact,
    body: body
  )
end

#create_knowledge_base(body:, authorization: nil, **_opts) ⇒ Object

Create a new knowledge base (max 15 knowledge bases per location)



152
153
154
155
156
157
158
159
160
# File 'lib/high_level/resources/knowledge_base.rb', line 152

def create_knowledge_base(body:, authorization: nil, **_opts)
  request(
    method: :post,
    path: "/knowledge-bases/",
    security: ["Location-Access"],
    headers: { "Authorization" => authorization }.compact,
    body: body
  )
end

#delete(id:, authorization: nil, **_opts) ⇒ Object

Delete an existing knowledge base FAQ



45
46
47
48
49
50
51
52
# File 'lib/high_level/resources/knowledge_base.rb', line 45

def delete(id:, authorization: nil, **_opts)
  request(
    method: :delete,
    path: "/knowledge-bases/faqs/#{id}",
    security: ["Location-Access"],
    headers: { "Authorization" => authorization }.compact
  )
end

#delete_knowledge_base(knowledge_base_id:, authorization: nil, **_opts) ⇒ Object

Delete a knowledge base



120
121
122
123
124
125
126
127
# File 'lib/high_level/resources/knowledge_base.rb', line 120

def delete_knowledge_base(knowledge_base_id:, authorization: nil, **_opts)
  request(
    method: :delete,
    path: "/knowledge-bases/#{knowledge_base_id}",
    security: ["Location-Access"],
    headers: { "Authorization" => authorization }.compact
  )
end

#delete_trained_urls_for_knowledge_base(body:, authorization: nil, **_opts) ⇒ Object

Delete trained pages



77
78
79
80
81
82
83
84
85
# File 'lib/high_level/resources/knowledge_base.rb', line 77

def delete_trained_urls_for_knowledge_base(body:, authorization: nil, **_opts)
  request(
    method: :delete,
    path: "/knowledge-bases/crawler",
    security: ["Location-Access"],
    headers: { "Authorization" => authorization }.compact,
    body: body
  )
end

#discover_website(body:, authorization: nil, **_opts) ⇒ Object

Start crawling and discover pages for training



66
67
68
69
70
71
72
73
74
# File 'lib/high_level/resources/knowledge_base.rb', line 66

def discover_website(body:, authorization: nil, **_opts)
  request(
    method: :post,
    path: "/knowledge-bases/crawler",
    security: ["Location-Access"],
    headers: { "Authorization" => authorization }.compact,
    body: body
  )
end

#get_all_website_urls_data_by_knowledge_base(knowledge_base_id: nil, location_id: nil, page: nil, page_length: nil, query: nil, authorization: nil, **_opts) ⇒ Object

Get all trained page links by knowledge base



55
56
57
58
59
60
61
62
63
# File 'lib/high_level/resources/knowledge_base.rb', line 55

def get_all_website_urls_data_by_knowledge_base(knowledge_base_id: nil, location_id: nil, page: nil, page_length: nil, query: nil, authorization: nil, **_opts)
  request(
    method: :get,
    path: "/knowledge-bases/crawler",
    security: ["Location-Access"],
    params: { "knowledgeBaseId" => knowledge_base_id, "locationId" => location_id, "page" => page, "pageLength" => page_length, "query" => query }.compact,
    headers: { "Authorization" => authorization }.compact
  )
end

#get_crawling_status_for_latest_operation(location_id: nil, operation_id: nil, knowledge_base_id: nil, authorization: nil, **_opts) ⇒ Object

Get crawling status for the latest operation



88
89
90
91
92
93
94
95
96
# File 'lib/high_level/resources/knowledge_base.rb', line 88

def get_crawling_status_for_latest_operation(location_id: nil, operation_id: nil, knowledge_base_id: nil, authorization: nil, **_opts)
  request(
    method: :get,
    path: "/knowledge-bases/crawler/status",
    security: ["Location-Access"],
    params: { "locationId" => location_id, "operationId" => operation_id, "knowledgeBaseId" => knowledge_base_id }.compact,
    headers: { "Authorization" => authorization }.compact
  )
end

#get_knowledge_base_by_id(knowledge_base_id:, authorization: nil, **_opts) ⇒ Object

Get knowledge base by ID



110
111
112
113
114
115
116
117
# File 'lib/high_level/resources/knowledge_base.rb', line 110

def get_knowledge_base_by_id(knowledge_base_id:, authorization: nil, **_opts)
  request(
    method: :get,
    path: "/knowledge-bases/#{knowledge_base_id}",
    security: ["Location-Access"],
    headers: { "Authorization" => authorization }.compact
  )
end

#list(knowledge_base_id: nil, location_id: nil, limit: nil, last_faq_id: nil, authorization: nil, **_opts) ⇒ Object

Get all FAQs by knowledge base with pagination support

Retrieves FAQs for a knowledge base. Supports pagination using limit and lastFaqId parameters.



12
13
14
15
16
17
18
19
20
# File 'lib/high_level/resources/knowledge_base.rb', line 12

def list(knowledge_base_id: nil, location_id: nil, limit: nil, last_faq_id: nil, authorization: nil, **_opts)
  request(
    method: :get,
    path: "/knowledge-bases/faqs",
    security: ["Location-Access"],
    params: { "knowledgeBaseId" => knowledge_base_id, "locationId" => location_id, "limit" => limit, "lastFaqId" => last_faq_id }.compact,
    headers: { "Authorization" => authorization }.compact
  )
end

#list_all_knowledge_bases_paginated(location_id: nil, query: nil, limit: nil, last_knowledge_base_id: nil, authorization: nil, **_opts) ⇒ Object

Get all knowledge bases for a location by location Id (paginated)



141
142
143
144
145
146
147
148
149
# File 'lib/high_level/resources/knowledge_base.rb', line 141

def list_all_knowledge_bases_paginated(location_id: nil, query: nil, limit: nil, last_knowledge_base_id: nil, authorization: nil, **_opts)
  request(
    method: :get,
    path: "/knowledge-bases/",
    security: ["Location-Access"],
    params: { "locationId" => location_id, "query" => query, "limit" => limit, "lastKnowledgeBaseId" => last_knowledge_base_id }.compact,
    headers: { "Authorization" => authorization }.compact
  )
end

#train_discovered_urls(body:, authorization: nil, **_opts) ⇒ Object

Train discovered website pages and ingest into the knowledge base



99
100
101
102
103
104
105
106
107
# File 'lib/high_level/resources/knowledge_base.rb', line 99

def train_discovered_urls(body:, authorization: nil, **_opts)
  request(
    method: :post,
    path: "/knowledge-bases/crawler/train",
    security: ["Location-Access"],
    headers: { "Authorization" => authorization }.compact,
    body: body
  )
end

#update(id:, body:, authorization: nil, **_opts) ⇒ Object

Update an existing knowledge base FAQ



34
35
36
37
38
39
40
41
42
# File 'lib/high_level/resources/knowledge_base.rb', line 34

def update(id:, body:, authorization: nil, **_opts)
  request(
    method: :put,
    path: "/knowledge-bases/faqs/#{id}",
    security: ["Location-Access"],
    headers: { "Authorization" => authorization }.compact,
    body: body
  )
end

#update_knowledge_base(id:, body:, authorization: nil, **_opts) ⇒ Object

Update a knowledge base



130
131
132
133
134
135
136
137
138
# File 'lib/high_level/resources/knowledge_base.rb', line 130

def update_knowledge_base(id:, body:, authorization: nil, **_opts)
  request(
    method: :put,
    path: "/knowledge-bases/#{id}",
    security: ["Location-Access"],
    headers: { "Authorization" => authorization }.compact,
    body: body
  )
end