class
Meilisearch::Crystal::Client
- Meilisearch::Crystal::Client
- Reference
- Object
Overview
Manages a connection to a Meilisearch server and provides the typed request plumbing shared by all resource classes.
Defined in:
meilisearch/crystal/client.crConstant Summary
-
DEFAULT_TIMEOUT =
5.seconds -
DEFAULT_URL =
"http://localhost:7700" -
ENV_API_KEY =
"MEILISEARCH_API_KEY" -
ENV_URL =
"MEILISEARCH_URL" -
Environment variables consulted when
Client.newis called without explicit arguments. -
USER_AGENT =
"meilisearch-crystal/#{VERSION}"
Constructors
- .new(url : String | URI | Nil = nil, api_key : String | Nil = nil, timeout : Time::Span | Nil = nil)
Class Method Summary
Instance Method Summary
- #api_key : String | Nil
- #batches : Batches
-
#build_http_client : HTTP::Client
Builds an
HTTP::Clientbound to this client's URL, with authentication, accept, and user-agent headers injected. -
#close : Nil
Closes the underlying persistent HTTP connection.
- #create_dump : TaskResult
- #create_snapshot : TaskResult
- #delete(path : String, query : HTTP::Params | Nil = nil) : HTTP::Client::Response
- #experimental_features : ExperimentalFeaturesAPI
- #generate_tenant_token(api_key_uid : String, search_rules, expires_at : Time | Nil = nil, api_key : String | Nil = @api_key) : String
- #get(path : String, query : HTTP::Params | Nil = nil) : HTTP::Client::Response
- #health : Health
- #http : HTTP::Client
-
#index(uid : String) : IndexClient
Handle for index-scoped operations (search, documents, settings, ...).
-
#indexes : Indexes
Index lifecycle operations and typed metadata access.
- #keys : Keys
- #network : Network
- #patch(path : String, body : String = "", headers : HTTP::Headers | Nil = nil) : HTTP::Client::Response
- #post(path : String, body : HTTP::Client::BodyType = nil, headers : HTTP::Headers | Nil = nil) : HTTP::Client::Response
- #put(path : String, body : HTTP::Client::BodyType = nil, headers : HTTP::Headers | Nil = nil) : HTTP::Client::Response
-
#search : Search
Search, facet, similar-document, and multi-index operations.
-
#settings : SettingsAPI
Index settings operations.
- #stats : Stats
-
#tasks : Tasks
Task lookup and listing operations.
- #timeout : Time::Span
- #url : URI
- #version : Version
-
#wait_for_task(uid : Int32 | Int64, timeout : Time::Span | Nil = nil, poll_interval : Time::Span = 100.milliseconds) : BasicTask
Fetches a task by uid, polling until it reaches a terminal status (succeeded / failed / canceled).
- #wait_for_task(task : BasicTask, timeout : Time::Span | Nil = nil, poll_interval : Time::Span = 100.milliseconds) : BasicTask
- #wait_for_task(task : TaskResult, timeout : Time::Span | Nil = nil, poll_interval : Time::Span = 100.milliseconds) : BasicTask
Constructor Detail
Builds a client against #url with optional #api_key and #timeout.
When #url/#api_key are omitted, environment variables
(MEILISEARCH_URL, MEILISEARCH_API_KEY) are consulted; #timeout
defaults to 5 seconds.
Class Method Detail
Instance Method Detail
Builds an HTTP::Client bound to this client's URL, with authentication,
accept, and user-agent headers injected.
Handle for index-scoped operations (search, documents, settings, ...).
The returned IndexClient binds uid to this client.
Fetches a task by uid, polling until it reaches a terminal status
(succeeded / failed / canceled). Raises TimeoutError when the task
does not complete within the client's timeout.
task = client.wait_for_task(task_uid, poll_interval: 50.milliseconds)