exa-ai 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +58 -17
- data/exe/exa-ai +111 -6
- data/exe/exa-ai-enrichment-cancel +107 -0
- data/exe/exa-ai-enrichment-create +235 -0
- data/exe/exa-ai-enrichment-delete +121 -0
- data/exe/exa-ai-enrichment-get +103 -0
- data/exe/exa-ai-enrichment-list +98 -0
- data/exe/exa-ai-enrichment-update +170 -0
- data/exe/exa-ai-find-similar +240 -0
- data/exe/exa-ai-webset-cancel +96 -0
- data/exe/exa-ai-webset-create +192 -0
- data/exe/exa-ai-webset-delete +110 -0
- data/exe/exa-ai-webset-get +92 -0
- data/exe/exa-ai-webset-item-delete +111 -0
- data/exe/exa-ai-webset-item-get +104 -0
- data/exe/exa-ai-webset-item-list +93 -0
- data/exe/exa-ai-webset-list +90 -0
- data/exe/exa-ai-webset-search-cancel +103 -0
- data/exe/exa-ai-webset-search-create +233 -0
- data/exe/exa-ai-webset-search-get +104 -0
- data/exe/exa-ai-webset-update +139 -0
- data/lib/exa/cli/formatters/enrichment_formatter.rb +69 -0
- data/lib/exa/cli/formatters/webset_formatter.rb +68 -0
- data/lib/exa/cli/formatters/webset_item_formatter.rb +69 -0
- data/lib/exa/client.rb +171 -0
- data/lib/exa/resources/webset.rb +74 -0
- data/lib/exa/resources/webset_collection.rb +33 -0
- data/lib/exa/resources/webset_enrichment.rb +71 -0
- data/lib/exa/resources/webset_enrichment_collection.rb +28 -0
- data/lib/exa/resources/webset_search.rb +112 -0
- data/lib/exa/services/parameter_converter.rb +1 -0
- data/lib/exa/services/websets/cancel.rb +36 -0
- data/lib/exa/services/websets/cancel_enrichment.rb +35 -0
- data/lib/exa/services/websets/cancel_search.rb +44 -0
- data/lib/exa/services/websets/create.rb +45 -0
- data/lib/exa/services/websets/create_enrichment.rb +35 -0
- data/lib/exa/services/websets/create_search.rb +48 -0
- data/lib/exa/services/websets/create_search_validator.rb +128 -0
- data/lib/exa/services/websets/create_validator.rb +189 -0
- data/lib/exa/services/websets/delete.rb +36 -0
- data/lib/exa/services/websets/delete_enrichment.rb +35 -0
- data/lib/exa/services/websets/delete_item.rb +20 -0
- data/lib/exa/services/websets/get_item.rb +20 -0
- data/lib/exa/services/websets/get_search.rb +43 -0
- data/lib/exa/services/websets/list.rb +25 -0
- data/lib/exa/services/websets/list_items.rb +20 -0
- data/lib/exa/services/websets/retrieve.rb +47 -0
- data/lib/exa/services/websets/retrieve_enrichment.rb +35 -0
- data/lib/exa/services/websets/update.rb +37 -0
- data/lib/exa/services/websets/update_enrichment.rb +36 -0
- data/lib/exa/services/websets_parameter_converter.rb +45 -0
- data/lib/exa/version.rb +1 -1
- data/lib/exa.rb +25 -0
- metadata +64 -3
data/lib/exa/client.rb
CHANGED
|
@@ -148,6 +148,177 @@ module Exa
|
|
|
148
148
|
search(query, type: "keyword", includeDomains: ["linkedin.com/in"], **params)
|
|
149
149
|
end
|
|
150
150
|
|
|
151
|
+
# List all websets
|
|
152
|
+
#
|
|
153
|
+
# @param params [Hash] Pagination parameters
|
|
154
|
+
# @option params [String] :cursor Cursor for pagination
|
|
155
|
+
# @option params [Integer] :limit Maximum number of websets to return
|
|
156
|
+
# @return [Resources::WebsetCollection] Paginated list of websets
|
|
157
|
+
def list_websets(**params)
|
|
158
|
+
Services::Websets::List.new(connection, **params).call
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Get a specific webset by ID
|
|
162
|
+
#
|
|
163
|
+
# @param id [String] Webset ID
|
|
164
|
+
# @param params [Hash] Optional parameters
|
|
165
|
+
# @option params [Array<String>] :expand Resources to expand in response (e.g., ['items'])
|
|
166
|
+
# @return [Resources::Webset] The requested webset
|
|
167
|
+
def get_webset(id, **params)
|
|
168
|
+
Services::Websets::Retrieve.new(connection, id: id, **params).call
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Delete a webset
|
|
172
|
+
#
|
|
173
|
+
# @param id [String] Webset ID
|
|
174
|
+
# @return [Resources::Webset] The deleted webset
|
|
175
|
+
def delete_webset(id)
|
|
176
|
+
Services::Websets::Delete.new(connection, id: id).call
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Cancel in-progress operations on a webset
|
|
180
|
+
#
|
|
181
|
+
# @param id [String] Webset ID
|
|
182
|
+
# @return [Resources::Webset] The webset with cancelled operations
|
|
183
|
+
def cancel_webset(id)
|
|
184
|
+
Services::Websets::Cancel.new(connection, id: id).call
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Update a webset's metadata
|
|
188
|
+
#
|
|
189
|
+
# @param id [String] Webset ID
|
|
190
|
+
# @param params [Hash] Update parameters
|
|
191
|
+
# @option params [Hash] :metadata Metadata to update
|
|
192
|
+
# @return [Resources::Webset] The updated webset
|
|
193
|
+
def update_webset(id, **params)
|
|
194
|
+
Services::Websets::Update.new(connection, id: id, **params).call
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Create a new webset
|
|
198
|
+
#
|
|
199
|
+
# @param params [Hash] Creation parameters
|
|
200
|
+
# @option params [Hash] :search Search configuration
|
|
201
|
+
# @return [Resources::Webset] The newly created webset
|
|
202
|
+
def create_webset(**params)
|
|
203
|
+
Services::Websets::Create.new(connection, **params).call
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Create a new enrichment for a webset
|
|
207
|
+
#
|
|
208
|
+
# @param webset_id [String] Webset ID
|
|
209
|
+
# @param params [Hash] Enrichment parameters
|
|
210
|
+
# @option params [String] :description Description of data to extract
|
|
211
|
+
# @option params [String] :format Format type (text, url, options, etc.)
|
|
212
|
+
# @option params [Array<Hash>] :options Options for enrichment
|
|
213
|
+
# @option params [Hash] :metadata Custom metadata
|
|
214
|
+
# @return [Resources::WebsetEnrichment] The newly created enrichment
|
|
215
|
+
def create_enrichment(webset_id:, **params)
|
|
216
|
+
Services::Websets::CreateEnrichment.new(connection, webset_id: webset_id, **params).call
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Get a specific enrichment by ID
|
|
220
|
+
#
|
|
221
|
+
# @param webset_id [String] Webset ID
|
|
222
|
+
# @param id [String] Enrichment ID
|
|
223
|
+
# @return [Resources::WebsetEnrichment] The requested enrichment
|
|
224
|
+
def get_enrichment(webset_id:, id:)
|
|
225
|
+
Services::Websets::RetrieveEnrichment.new(connection, webset_id: webset_id, id: id).call
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Update an enrichment
|
|
229
|
+
#
|
|
230
|
+
# @param webset_id [String] Webset ID
|
|
231
|
+
# @param id [String] Enrichment ID
|
|
232
|
+
# @param params [Hash] Update parameters
|
|
233
|
+
# @option params [String] :description Updated description
|
|
234
|
+
# @option params [String] :format Updated format
|
|
235
|
+
# @option params [Array<Hash>] :options Updated options
|
|
236
|
+
# @option params [Hash] :metadata Updated metadata
|
|
237
|
+
# @return [Resources::WebsetEnrichment] The updated enrichment
|
|
238
|
+
def update_enrichment(webset_id:, id:, **params)
|
|
239
|
+
Services::Websets::UpdateEnrichment.new(connection, webset_id: webset_id, id: id, **params).call
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# Delete an enrichment
|
|
243
|
+
#
|
|
244
|
+
# @param webset_id [String] Webset ID
|
|
245
|
+
# @param id [String] Enrichment ID
|
|
246
|
+
# @return [Resources::WebsetEnrichment] The deleted enrichment
|
|
247
|
+
def delete_enrichment(webset_id:, id:)
|
|
248
|
+
Services::Websets::DeleteEnrichment.new(connection, webset_id: webset_id, id: id).call
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Cancel a running enrichment
|
|
252
|
+
#
|
|
253
|
+
# @param webset_id [String] Webset ID
|
|
254
|
+
# @param id [String] Enrichment ID
|
|
255
|
+
# @return [Resources::WebsetEnrichment] The cancelled enrichment
|
|
256
|
+
def cancel_enrichment(webset_id:, id:)
|
|
257
|
+
Services::Websets::CancelEnrichment.new(connection, webset_id: webset_id, id: id).call
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# Create a new search within a webset
|
|
261
|
+
#
|
|
262
|
+
# @param webset_id [String] Webset ID
|
|
263
|
+
# @param params [Hash] Search parameters
|
|
264
|
+
# @option params [String] :query The search query (required)
|
|
265
|
+
# @option params [Integer] :count Number of results to find
|
|
266
|
+
# @option params [Hash] :entity Entity type specification
|
|
267
|
+
# @option params [Array<Hash>] :criteria Search criteria
|
|
268
|
+
# @option params [Array<Hash>] :exclude Items to exclude from results
|
|
269
|
+
# @option params [Array<Hash>] :scope Limit search to specific sources
|
|
270
|
+
# @option params [Boolean] :recall Whether to estimate total available results
|
|
271
|
+
# @option params [String] :behavior "override" or "append" (default: "override")
|
|
272
|
+
# @option params [Hash] :metadata Custom metadata
|
|
273
|
+
# @return [Resources::WebsetSearch] The newly created search
|
|
274
|
+
def create_webset_search(webset_id:, **params)
|
|
275
|
+
Services::Websets::CreateSearch.new(connection, webset_id: webset_id, **params).call
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
# Get a webset search by ID
|
|
279
|
+
#
|
|
280
|
+
# @param webset_id [String] Webset ID
|
|
281
|
+
# @param id [String] Search ID
|
|
282
|
+
# @return [Resources::WebsetSearch] The requested search
|
|
283
|
+
def get_webset_search(webset_id:, id:)
|
|
284
|
+
Services::Websets::GetSearch.new(connection, webset_id: webset_id, id: id).call
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Cancel a webset search
|
|
288
|
+
#
|
|
289
|
+
# @param webset_id [String] Webset ID
|
|
290
|
+
# @param id [String] Search ID
|
|
291
|
+
# @return [Resources::WebsetSearch] The cancelled search
|
|
292
|
+
def cancel_webset_search(webset_id:, id:)
|
|
293
|
+
Services::Websets::CancelSearch.new(connection, webset_id: webset_id, id: id).call
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# Get a webset item by ID
|
|
297
|
+
#
|
|
298
|
+
# @param webset_id [String] Webset ID
|
|
299
|
+
# @param id [String] Item ID
|
|
300
|
+
# @return [Hash] The requested item
|
|
301
|
+
def get_item(webset_id:, id:)
|
|
302
|
+
Services::Websets::GetItem.new(connection, webset_id: webset_id, id: id).call
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# Delete a webset item by ID
|
|
306
|
+
#
|
|
307
|
+
# @param webset_id [String] Webset ID
|
|
308
|
+
# @param id [String] Item ID
|
|
309
|
+
# @return [Boolean] True if deletion was successful
|
|
310
|
+
def delete_item(webset_id:, id:)
|
|
311
|
+
Services::Websets::DeleteItem.new(connection, webset_id: webset_id, id: id).call
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
# List all items in a webset
|
|
315
|
+
#
|
|
316
|
+
# @param webset_id [String] Webset ID
|
|
317
|
+
# @return [Array<Hash>] Array of items
|
|
318
|
+
def list_items(webset_id:)
|
|
319
|
+
Services::Websets::ListItems.new(connection, webset_id: webset_id).call
|
|
320
|
+
end
|
|
321
|
+
|
|
151
322
|
private
|
|
152
323
|
|
|
153
324
|
def connection
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Exa
|
|
4
|
+
module Resources
|
|
5
|
+
# Represents a webset from the Exa API
|
|
6
|
+
#
|
|
7
|
+
# A webset is a collection of web entities (companies, people, etc.)
|
|
8
|
+
# discovered through searches, imports, and enrichments.
|
|
9
|
+
class Webset < Struct.new(
|
|
10
|
+
:id,
|
|
11
|
+
:object,
|
|
12
|
+
:status,
|
|
13
|
+
:external_id,
|
|
14
|
+
:title,
|
|
15
|
+
:searches,
|
|
16
|
+
:imports,
|
|
17
|
+
:enrichments,
|
|
18
|
+
:monitors,
|
|
19
|
+
:excludes,
|
|
20
|
+
:metadata,
|
|
21
|
+
:created_at,
|
|
22
|
+
:updated_at,
|
|
23
|
+
:items,
|
|
24
|
+
keyword_init: true
|
|
25
|
+
)
|
|
26
|
+
def initialize(
|
|
27
|
+
id:,
|
|
28
|
+
object:,
|
|
29
|
+
status:,
|
|
30
|
+
external_id: nil,
|
|
31
|
+
title: nil,
|
|
32
|
+
searches: nil,
|
|
33
|
+
imports: nil,
|
|
34
|
+
enrichments: nil,
|
|
35
|
+
monitors: nil,
|
|
36
|
+
excludes: nil,
|
|
37
|
+
metadata: nil,
|
|
38
|
+
created_at: nil,
|
|
39
|
+
updated_at: nil,
|
|
40
|
+
items: nil
|
|
41
|
+
)
|
|
42
|
+
super
|
|
43
|
+
freeze
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def idle?
|
|
47
|
+
status == "idle"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def processing?
|
|
51
|
+
status == "processing"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def to_h
|
|
55
|
+
{
|
|
56
|
+
id: id,
|
|
57
|
+
object: object,
|
|
58
|
+
status: status,
|
|
59
|
+
external_id: external_id,
|
|
60
|
+
title: title,
|
|
61
|
+
searches: searches,
|
|
62
|
+
imports: imports,
|
|
63
|
+
enrichments: enrichments,
|
|
64
|
+
monitors: monitors,
|
|
65
|
+
excludes: excludes,
|
|
66
|
+
metadata: metadata,
|
|
67
|
+
created_at: created_at,
|
|
68
|
+
updated_at: updated_at,
|
|
69
|
+
items: items
|
|
70
|
+
}.compact
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Exa
|
|
4
|
+
module Resources
|
|
5
|
+
# Represents a paginated list of websets from the Exa API
|
|
6
|
+
#
|
|
7
|
+
# This class wraps the JSON response from the GET /websets/v0/websets endpoint
|
|
8
|
+
# and provides pagination support.
|
|
9
|
+
class WebsetCollection < Struct.new(
|
|
10
|
+
:data,
|
|
11
|
+
:has_more,
|
|
12
|
+
:next_cursor,
|
|
13
|
+
keyword_init: true
|
|
14
|
+
)
|
|
15
|
+
def initialize(data:, has_more: false, next_cursor: nil)
|
|
16
|
+
super
|
|
17
|
+
freeze
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def empty?
|
|
21
|
+
data.empty?
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def to_h
|
|
25
|
+
{
|
|
26
|
+
data: data,
|
|
27
|
+
has_more: has_more,
|
|
28
|
+
next_cursor: next_cursor
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Exa
|
|
4
|
+
module Resources
|
|
5
|
+
# Represents a webset enrichment from the Exa API
|
|
6
|
+
#
|
|
7
|
+
# An enrichment extracts specific data from web entities in a webset.
|
|
8
|
+
class WebsetEnrichment < Struct.new(
|
|
9
|
+
:id,
|
|
10
|
+
:object,
|
|
11
|
+
:status,
|
|
12
|
+
:webset_id,
|
|
13
|
+
:title,
|
|
14
|
+
:description,
|
|
15
|
+
:format,
|
|
16
|
+
:options,
|
|
17
|
+
:instructions,
|
|
18
|
+
:metadata,
|
|
19
|
+
:created_at,
|
|
20
|
+
:updated_at,
|
|
21
|
+
keyword_init: true
|
|
22
|
+
)
|
|
23
|
+
def initialize(
|
|
24
|
+
id:,
|
|
25
|
+
object:,
|
|
26
|
+
status:,
|
|
27
|
+
webset_id: nil,
|
|
28
|
+
title: nil,
|
|
29
|
+
description: nil,
|
|
30
|
+
format: nil,
|
|
31
|
+
options: nil,
|
|
32
|
+
instructions: nil,
|
|
33
|
+
metadata: nil,
|
|
34
|
+
created_at: nil,
|
|
35
|
+
updated_at: nil
|
|
36
|
+
)
|
|
37
|
+
super
|
|
38
|
+
freeze
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def pending?
|
|
42
|
+
status == "pending"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def running?
|
|
46
|
+
status == "running"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def completed?
|
|
50
|
+
status == "completed"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def to_h
|
|
54
|
+
{
|
|
55
|
+
id: id,
|
|
56
|
+
object: object,
|
|
57
|
+
status: status,
|
|
58
|
+
webset_id: webset_id,
|
|
59
|
+
title: title,
|
|
60
|
+
description: description,
|
|
61
|
+
format: format,
|
|
62
|
+
options: options,
|
|
63
|
+
instructions: instructions,
|
|
64
|
+
metadata: metadata,
|
|
65
|
+
created_at: created_at,
|
|
66
|
+
updated_at: updated_at
|
|
67
|
+
}.compact
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Exa
|
|
4
|
+
module Resources
|
|
5
|
+
# Represents a list of enrichments for a webset from the Exa API
|
|
6
|
+
#
|
|
7
|
+
# This class wraps the JSON response from the GET /websets/v0/websets/{id}/enrichments endpoint
|
|
8
|
+
class WebsetEnrichmentCollection < Struct.new(
|
|
9
|
+
:data,
|
|
10
|
+
keyword_init: true
|
|
11
|
+
)
|
|
12
|
+
def initialize(data:)
|
|
13
|
+
super
|
|
14
|
+
freeze
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def empty?
|
|
18
|
+
data.empty?
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def to_h
|
|
22
|
+
{
|
|
23
|
+
data: data
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Exa
|
|
4
|
+
module Resources
|
|
5
|
+
# Represents a search operation within a webset
|
|
6
|
+
#
|
|
7
|
+
# A search finds entities matching specific criteria and can either
|
|
8
|
+
# override existing webset items or append to them.
|
|
9
|
+
class WebsetSearch < Struct.new(
|
|
10
|
+
:id,
|
|
11
|
+
:object,
|
|
12
|
+
:status,
|
|
13
|
+
:webset_id,
|
|
14
|
+
:query,
|
|
15
|
+
:entity,
|
|
16
|
+
:criteria,
|
|
17
|
+
:count,
|
|
18
|
+
:behavior,
|
|
19
|
+
:exclude,
|
|
20
|
+
:scope,
|
|
21
|
+
:progress,
|
|
22
|
+
:recall,
|
|
23
|
+
:metadata,
|
|
24
|
+
:canceled_at,
|
|
25
|
+
:canceled_reason,
|
|
26
|
+
:created_at,
|
|
27
|
+
:updated_at,
|
|
28
|
+
keyword_init: true
|
|
29
|
+
)
|
|
30
|
+
def initialize(
|
|
31
|
+
id:,
|
|
32
|
+
object:,
|
|
33
|
+
status:,
|
|
34
|
+
webset_id: nil,
|
|
35
|
+
query: nil,
|
|
36
|
+
entity: nil,
|
|
37
|
+
criteria: nil,
|
|
38
|
+
count: nil,
|
|
39
|
+
behavior: nil,
|
|
40
|
+
exclude: nil,
|
|
41
|
+
scope: nil,
|
|
42
|
+
progress: nil,
|
|
43
|
+
recall: nil,
|
|
44
|
+
metadata: nil,
|
|
45
|
+
canceled_at: nil,
|
|
46
|
+
canceled_reason: nil,
|
|
47
|
+
created_at: nil,
|
|
48
|
+
updated_at: nil
|
|
49
|
+
)
|
|
50
|
+
super
|
|
51
|
+
freeze
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Status helper methods
|
|
55
|
+
def created?
|
|
56
|
+
status == "created"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def running?
|
|
60
|
+
status == "running"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def completed?
|
|
64
|
+
status == "completed"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def failed?
|
|
68
|
+
status == "failed"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def canceled?
|
|
72
|
+
status == "canceled"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def in_progress?
|
|
76
|
+
created? || running?
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Behavior helper methods
|
|
80
|
+
def override?
|
|
81
|
+
behavior == "override"
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def append?
|
|
85
|
+
behavior == "append"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def to_h
|
|
89
|
+
{
|
|
90
|
+
id: id,
|
|
91
|
+
object: object,
|
|
92
|
+
status: status,
|
|
93
|
+
webset_id: webset_id,
|
|
94
|
+
query: query,
|
|
95
|
+
entity: entity,
|
|
96
|
+
criteria: criteria,
|
|
97
|
+
count: count,
|
|
98
|
+
behavior: behavior,
|
|
99
|
+
exclude: exclude,
|
|
100
|
+
scope: scope,
|
|
101
|
+
progress: progress,
|
|
102
|
+
recall: recall,
|
|
103
|
+
metadata: metadata,
|
|
104
|
+
canceled_at: canceled_at,
|
|
105
|
+
canceled_reason: canceled_reason,
|
|
106
|
+
created_at: created_at,
|
|
107
|
+
updated_at: updated_at
|
|
108
|
+
}.compact
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Exa
|
|
4
|
+
module Services
|
|
5
|
+
module Websets
|
|
6
|
+
class Cancel
|
|
7
|
+
def initialize(connection, id:)
|
|
8
|
+
@connection = connection
|
|
9
|
+
@id = id
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def call
|
|
13
|
+
response = @connection.post("/websets/v0/websets/#{@id}/cancel", {})
|
|
14
|
+
body = response.body
|
|
15
|
+
|
|
16
|
+
Resources::Webset.new(
|
|
17
|
+
id: body["id"],
|
|
18
|
+
object: body["object"],
|
|
19
|
+
status: body["status"],
|
|
20
|
+
external_id: body["externalId"],
|
|
21
|
+
title: body["title"],
|
|
22
|
+
searches: body["searches"],
|
|
23
|
+
imports: body["imports"],
|
|
24
|
+
enrichments: body["enrichments"],
|
|
25
|
+
monitors: body["monitors"],
|
|
26
|
+
excludes: body["excludes"],
|
|
27
|
+
metadata: body["metadata"],
|
|
28
|
+
created_at: body["createdAt"],
|
|
29
|
+
updated_at: body["updatedAt"],
|
|
30
|
+
items: body["items"]
|
|
31
|
+
)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Exa
|
|
4
|
+
module Services
|
|
5
|
+
module Websets
|
|
6
|
+
class CancelEnrichment
|
|
7
|
+
def initialize(connection, webset_id:, id:)
|
|
8
|
+
@connection = connection
|
|
9
|
+
@webset_id = webset_id
|
|
10
|
+
@id = id
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def call
|
|
14
|
+
response = @connection.post("/websets/v0/websets/#{@webset_id}/enrichments/#{@id}/cancel", {})
|
|
15
|
+
body = response.body
|
|
16
|
+
|
|
17
|
+
Resources::WebsetEnrichment.new(
|
|
18
|
+
id: body["id"],
|
|
19
|
+
object: body["object"],
|
|
20
|
+
status: body["status"],
|
|
21
|
+
webset_id: body["websetId"],
|
|
22
|
+
title: body["title"],
|
|
23
|
+
description: body["description"],
|
|
24
|
+
format: body["format"],
|
|
25
|
+
options: body["options"],
|
|
26
|
+
instructions: body["instructions"],
|
|
27
|
+
metadata: body["metadata"],
|
|
28
|
+
created_at: body["createdAt"],
|
|
29
|
+
updated_at: body["updatedAt"]
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Exa
|
|
4
|
+
module Services
|
|
5
|
+
module Websets
|
|
6
|
+
class CancelSearch
|
|
7
|
+
def initialize(connection, webset_id:, id:)
|
|
8
|
+
@connection = connection
|
|
9
|
+
@webset_id = webset_id
|
|
10
|
+
@id = id
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def call
|
|
14
|
+
response = @connection.post(
|
|
15
|
+
"/websets/v0/websets/#{@webset_id}/searches/#{@id}/cancel",
|
|
16
|
+
{}
|
|
17
|
+
)
|
|
18
|
+
body = response.body
|
|
19
|
+
|
|
20
|
+
Resources::WebsetSearch.new(
|
|
21
|
+
id: body["id"],
|
|
22
|
+
object: body["object"],
|
|
23
|
+
status: body["status"],
|
|
24
|
+
webset_id: body["websetId"],
|
|
25
|
+
query: body["query"],
|
|
26
|
+
entity: body["entity"],
|
|
27
|
+
criteria: body["criteria"],
|
|
28
|
+
count: body["count"],
|
|
29
|
+
behavior: body["behavior"],
|
|
30
|
+
exclude: body["exclude"],
|
|
31
|
+
scope: body["scope"],
|
|
32
|
+
progress: body["progress"],
|
|
33
|
+
recall: body["recall"],
|
|
34
|
+
metadata: body["metadata"],
|
|
35
|
+
canceled_at: body["canceledAt"],
|
|
36
|
+
canceled_reason: body["canceledReason"],
|
|
37
|
+
created_at: body["createdAt"],
|
|
38
|
+
updated_at: body["updatedAt"]
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "create_validator"
|
|
4
|
+
require_relative "../websets_parameter_converter"
|
|
5
|
+
|
|
6
|
+
module Exa
|
|
7
|
+
module Services
|
|
8
|
+
module Websets
|
|
9
|
+
class Create
|
|
10
|
+
def initialize(connection, **params)
|
|
11
|
+
@connection = connection
|
|
12
|
+
@params = params
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def call
|
|
16
|
+
# Validate parameters before making the API call
|
|
17
|
+
CreateValidator.validate!(@params)
|
|
18
|
+
|
|
19
|
+
# Convert Ruby snake_case params to API camelCase
|
|
20
|
+
converted_params = WebsetsParameterConverter.convert(@params)
|
|
21
|
+
|
|
22
|
+
response = @connection.post("/websets/v0/websets", converted_params)
|
|
23
|
+
body = response.body
|
|
24
|
+
|
|
25
|
+
Resources::Webset.new(
|
|
26
|
+
id: body["id"],
|
|
27
|
+
object: body["object"],
|
|
28
|
+
status: body["status"],
|
|
29
|
+
external_id: body["externalId"],
|
|
30
|
+
title: body["title"],
|
|
31
|
+
searches: body["searches"],
|
|
32
|
+
imports: body["imports"],
|
|
33
|
+
enrichments: body["enrichments"],
|
|
34
|
+
monitors: body["monitors"],
|
|
35
|
+
excludes: body["excludes"],
|
|
36
|
+
metadata: body["metadata"],
|
|
37
|
+
created_at: body["createdAt"],
|
|
38
|
+
updated_at: body["updatedAt"],
|
|
39
|
+
items: body["items"]
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Exa
|
|
4
|
+
module Services
|
|
5
|
+
module Websets
|
|
6
|
+
class CreateEnrichment
|
|
7
|
+
def initialize(connection, webset_id:, **params)
|
|
8
|
+
@connection = connection
|
|
9
|
+
@webset_id = webset_id
|
|
10
|
+
@params = params
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def call
|
|
14
|
+
response = @connection.post("/websets/v0/websets/#{@webset_id}/enrichments", @params)
|
|
15
|
+
body = response.body
|
|
16
|
+
|
|
17
|
+
Resources::WebsetEnrichment.new(
|
|
18
|
+
id: body["id"],
|
|
19
|
+
object: body["object"],
|
|
20
|
+
status: body["status"],
|
|
21
|
+
webset_id: body["websetId"],
|
|
22
|
+
title: body["title"],
|
|
23
|
+
description: body["description"],
|
|
24
|
+
format: body["format"],
|
|
25
|
+
options: body["options"],
|
|
26
|
+
instructions: body["instructions"],
|
|
27
|
+
metadata: body["metadata"],
|
|
28
|
+
created_at: body["createdAt"],
|
|
29
|
+
updated_at: body["updatedAt"]
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|