Skip to main content

hotdata/
resources.rs

1//! Ergonomic, hand-written resource handles for the HotData SDK.
2//!
3//! This module is regeneration-immune: it is protected by `.openapi-generator-ignore`
4//! and is never emitted by the OpenAPI generator. The OpenAPI generator emits the
5//! operations as free functions grouped into `apis::*_api` modules; this module
6//! restores a Python-like, resource-oriented surface by wrapping each generated
7//! `*_api` module in a lightweight handle struct that borrows the
8//! [`Configuration`](crate::apis::configuration::Configuration) and forwards each
9//! operation to the matching free function.
10//!
11//! Handles are obtained from [`Client`](crate::Client) accessors, e.g.
12//! `client.connections().list().await?`. They hold only a `&Configuration`, so
13//! they are cheap to construct and never own state.
14
15use crate::apis;
16use crate::apis::configuration::Configuration;
17use crate::apis::Error;
18use crate::models;
19
20/// Connections resource handle. Wraps [`apis::connections_api`](crate::apis::connections_api).
21pub struct ConnectionsApi<'a> {
22    config: &'a Configuration,
23}
24
25impl<'a> ConnectionsApi<'a> {
26    pub(crate) fn new(config: &'a Configuration) -> Self {
27        Self { config }
28    }
29
30    /// Create a new connection.
31    pub async fn create(
32        &self,
33        request: models::CreateConnectionRequest,
34    ) -> Result<models::CreateConnectionResponse, Error<apis::connections_api::CreateConnectionError>>
35    {
36        apis::connections_api::create_connection(self.config, request).await
37    }
38
39    /// Fetch a connection by id.
40    pub async fn get(
41        &self,
42        connection_id: &str,
43    ) -> Result<models::GetConnectionResponse, Error<apis::connections_api::GetConnectionError>>
44    {
45        apis::connections_api::get_connection(self.config, connection_id).await
46    }
47
48    /// List connections.
49    pub async fn list(
50        &self,
51    ) -> Result<models::ListConnectionsResponse, Error<apis::connections_api::ListConnectionsError>>
52    {
53        apis::connections_api::list_connections(self.config).await
54    }
55
56    /// Delete a connection by id.
57    pub async fn delete(
58        &self,
59        connection_id: &str,
60    ) -> Result<(), Error<apis::connections_api::DeleteConnectionError>> {
61        apis::connections_api::delete_connection(self.config, connection_id).await
62    }
63
64    /// Get a profile for an instant database table.
65    pub async fn get_table_profile(
66        &self,
67        connection_id: &str,
68        schema: &str,
69        table: &str,
70    ) -> Result<models::TableProfileResponse, Error<apis::connections_api::GetTableProfileError>>
71    {
72        apis::connections_api::get_table_profile(self.config, connection_id, schema, table).await
73    }
74
75    /// Load (materialize) an instant database table.
76    pub async fn load_managed_table(
77        &self,
78        connection_id: &str,
79        schema: &str,
80        table: &str,
81        request: models::LoadManagedTableRequest,
82    ) -> Result<models::LoadManagedTableResponse, Error<apis::connections_api::LoadManagedTableError>>
83    {
84        apis::connections_api::load_managed_table(
85            self.config,
86            connection_id,
87            schema,
88            table,
89            request,
90        )
91        .await
92    }
93
94    /// Delete an instant database table.
95    pub async fn delete_managed_table(
96        &self,
97        connection_id: &str,
98        schema: &str,
99        table: &str,
100    ) -> Result<(), Error<apis::connections_api::DeleteManagedTableError>> {
101        apis::connections_api::delete_managed_table(self.config, connection_id, schema, table).await
102    }
103}
104
105/// Database-context resource handle. Wraps [`apis::database_context_api`](crate::apis::database_context_api).
106pub struct DatabaseContextApi<'a> {
107    config: &'a Configuration,
108}
109
110impl<'a> DatabaseContextApi<'a> {
111    pub(crate) fn new(config: &'a Configuration) -> Self {
112        Self { config }
113    }
114
115    /// Fetch a named context document for a database.
116    pub async fn get(
117        &self,
118        database_id: &str,
119        name: &str,
120    ) -> Result<
121        models::GetDatabaseContextResponse,
122        Error<apis::database_context_api::GetDatabaseContextError>,
123    > {
124        apis::database_context_api::get_database_context(self.config, database_id, name).await
125    }
126
127    /// List context documents for a database.
128    pub async fn list(
129        &self,
130        database_id: &str,
131    ) -> Result<
132        models::ListDatabaseContextsResponse,
133        Error<apis::database_context_api::ListDatabaseContextsError>,
134    > {
135        apis::database_context_api::list_database_contexts(self.config, database_id).await
136    }
137
138    /// Store (or replace) a named context document for a database.
139    pub async fn upsert(
140        &self,
141        database_id: &str,
142        request: models::UpsertDatabaseContextRequest,
143    ) -> Result<
144        models::UpsertDatabaseContextResponse,
145        Error<apis::database_context_api::UpsertDatabaseContextError>,
146    > {
147        apis::database_context_api::upsert_database_context(self.config, database_id, request).await
148    }
149
150    /// Delete a named context document from a database.
151    pub async fn delete(
152        &self,
153        database_id: &str,
154        name: &str,
155    ) -> Result<(), Error<apis::database_context_api::DeleteDatabaseContextError>> {
156        apis::database_context_api::delete_database_context(self.config, database_id, name).await
157    }
158}
159
160/// Databases resource handle. Wraps [`apis::databases_api`](crate::apis::databases_api).
161pub struct DatabasesApi<'a> {
162    config: &'a Configuration,
163}
164
165impl<'a> DatabasesApi<'a> {
166    pub(crate) fn new(config: &'a Configuration) -> Self {
167        Self { config }
168    }
169
170    /// Create a new database.
171    pub async fn create(
172        &self,
173        request: models::CreateDatabaseRequest,
174    ) -> Result<models::CreateDatabaseResponse, Error<apis::databases_api::CreateDatabaseError>>
175    {
176        apis::databases_api::create_database(self.config, request).await
177    }
178
179    /// Fork a database into a new, independent database.
180    pub async fn fork(
181        &self,
182        database_id: &str,
183        request: models::ForkDatabaseRequest,
184    ) -> Result<models::CreateDatabaseResponse, Error<apis::databases_api::ForkDatabaseError>> {
185        apis::databases_api::fork_database(self.config, database_id, request).await
186    }
187
188    /// Fetch a database by id.
189    pub async fn get(
190        &self,
191        database_id: &str,
192    ) -> Result<models::DatabaseDetailResponse, Error<apis::databases_api::GetDatabaseError>> {
193        apis::databases_api::get_database(self.config, database_id).await
194    }
195
196    /// Fetch a database by its exact name (404 when none, 409 when the name is
197    /// shared by more than one database).
198    pub async fn lookup_by_name(
199        &self,
200        name: &str,
201    ) -> Result<models::DatabaseDetailResponse, Error<apis::databases_api::LookupDatabaseByNameError>>
202    {
203        apis::databases_api::lookup_database_by_name(self.config, name).await
204    }
205
206    /// Trace a database's fork lineage: its ancestor chain and the databases
207    /// forked directly from it. `forks_limit` caps the forks listed;
208    /// `fork_count` in the response always reports the true total.
209    pub async fn lineage(
210        &self,
211        database_id: &str,
212        forks_limit: Option<i32>,
213    ) -> Result<models::DatabaseLineageResponse, Error<apis::databases_api::GetDatabaseLineageError>>
214    {
215        apis::databases_api::get_database_lineage(self.config, database_id, forks_limit).await
216    }
217
218    /// List databases, newest first, one keyset page at a time. Pass `cursor`
219    /// (from a previous response's `next_cursor`) to fetch the next page,
220    /// `search` to return only databases whose name contains that text
221    /// (case-insensitive), and `batch` to list only the databases belonging to
222    /// one bulk-creation batch.
223    pub async fn list(
224        &self,
225        limit: Option<i32>,
226        cursor: Option<&str>,
227        search: Option<&str>,
228        batch: Option<&str>,
229    ) -> Result<models::ListDatabasesResponse, Error<apis::databases_api::ListDatabasesError>> {
230        apis::databases_api::list_databases(self.config, limit, cursor, search, batch).await
231    }
232
233    /// Total number of databases in the workspace, across every page `list`
234    /// would return.
235    ///
236    /// The listing's `count` field is the size of one page; this is the
237    /// whole-workspace total in a single call. `search` and `batch` mean
238    /// exactly what they mean on `list`, so a count and a listing given the
239    /// same filters describe the same set.
240    pub async fn count(
241        &self,
242        search: Option<&str>,
243        batch: Option<&str>,
244    ) -> Result<models::DatabaseCountResponse, Error<apis::databases_api::CountDatabasesError>>
245    {
246        apis::databases_api::count_databases(self.config, search, batch).await
247    }
248
249    /// Delete a database by id.
250    pub async fn delete(
251        &self,
252        database_id: &str,
253    ) -> Result<(), Error<apis::databases_api::DeleteDatabaseError>> {
254        apis::databases_api::delete_database(self.config, database_id).await
255    }
256
257    /// Attach a catalog (connection) to a database.
258    pub async fn attach_catalog(
259        &self,
260        database_id: &str,
261        request: models::AttachDatabaseCatalogRequest,
262    ) -> Result<(), Error<apis::databases_api::AttachDatabaseCatalogError>> {
263        apis::databases_api::attach_database_catalog(self.config, database_id, request).await
264    }
265
266    /// Detach a catalog (connection) from a database.
267    pub async fn detach_catalog(
268        &self,
269        database_id: &str,
270        connection_id: &str,
271    ) -> Result<(), Error<apis::databases_api::DetachDatabaseCatalogError>> {
272        apis::databases_api::detach_database_catalog(self.config, database_id, connection_id).await
273    }
274}
275
276/// Embedding-providers resource handle. Wraps [`apis::embedding_providers_api`](crate::apis::embedding_providers_api).
277pub struct EmbeddingProvidersApi<'a> {
278    config: &'a Configuration,
279}
280
281impl<'a> EmbeddingProvidersApi<'a> {
282    pub(crate) fn new(config: &'a Configuration) -> Self {
283        Self { config }
284    }
285
286    /// Create a new embedding provider.
287    pub async fn create(
288        &self,
289        request: models::CreateEmbeddingProviderRequest,
290    ) -> Result<
291        models::CreateEmbeddingProviderResponse,
292        Error<apis::embedding_providers_api::CreateEmbeddingProviderError>,
293    > {
294        apis::embedding_providers_api::create_embedding_provider(self.config, request).await
295    }
296
297    /// Fetch an embedding provider by id.
298    pub async fn get(
299        &self,
300        id: &str,
301    ) -> Result<
302        models::EmbeddingProviderResponse,
303        Error<apis::embedding_providers_api::GetEmbeddingProviderError>,
304    > {
305        apis::embedding_providers_api::get_embedding_provider(self.config, id).await
306    }
307
308    /// List embedding providers.
309    pub async fn list(
310        &self,
311    ) -> Result<
312        models::ListEmbeddingProvidersResponse,
313        Error<apis::embedding_providers_api::ListEmbeddingProvidersError>,
314    > {
315        apis::embedding_providers_api::list_embedding_providers(self.config).await
316    }
317
318    /// Update an embedding provider by id.
319    pub async fn update(
320        &self,
321        id: &str,
322        request: models::UpdateEmbeddingProviderRequest,
323    ) -> Result<
324        models::UpdateEmbeddingProviderResponse,
325        Error<apis::embedding_providers_api::UpdateEmbeddingProviderError>,
326    > {
327        apis::embedding_providers_api::update_embedding_provider(self.config, id, request).await
328    }
329
330    /// Delete an embedding provider by id.
331    pub async fn delete(
332        &self,
333        id: &str,
334    ) -> Result<(), Error<apis::embedding_providers_api::DeleteEmbeddingProviderError>> {
335        apis::embedding_providers_api::delete_embedding_provider(self.config, id).await
336    }
337}
338
339/// Indexes resource handle. Wraps [`apis::indexes_api`](crate::apis::indexes_api).
340///
341/// Covers instant database table (connection/schema/table) indexes.
342pub struct IndexesApi<'a> {
343    config: &'a Configuration,
344}
345
346impl<'a> IndexesApi<'a> {
347    pub(crate) fn new(config: &'a Configuration) -> Self {
348        Self { config }
349    }
350
351    /// Create an index on an instant database table.
352    pub async fn create_index(
353        &self,
354        connection_id: &str,
355        schema: &str,
356        table: &str,
357        request: models::CreateIndexRequest,
358    ) -> Result<models::IndexInfoResponse, Error<apis::indexes_api::CreateIndexError>> {
359        apis::indexes_api::create_index(self.config, connection_id, schema, table, request).await
360    }
361
362    /// List indexes on an instant database table.
363    pub async fn list_indexes(
364        &self,
365        connection_id: &str,
366        schema: &str,
367        table: &str,
368    ) -> Result<models::ListIndexesResponse, Error<apis::indexes_api::ListIndexesError>> {
369        apis::indexes_api::list_indexes(self.config, connection_id, schema, table).await
370    }
371
372    /// Delete an index from an instant database table.
373    pub async fn delete_index(
374        &self,
375        connection_id: &str,
376        schema: &str,
377        table: &str,
378        index_name: &str,
379    ) -> Result<(), Error<apis::indexes_api::DeleteIndexError>> {
380        apis::indexes_api::delete_index(self.config, connection_id, schema, table, index_name).await
381    }
382}
383
384/// Information-schema resource handle. Wraps [`apis::information_schema_api`](crate::apis::information_schema_api).
385pub struct InformationSchemaApi<'a> {
386    config: &'a Configuration,
387}
388
389impl<'a> InformationSchemaApi<'a> {
390    pub(crate) fn new(config: &'a Configuration) -> Self {
391        Self { config }
392    }
393
394    /// Query the information schema, optionally filtered by connection/schema/table.
395    #[allow(clippy::too_many_arguments)]
396    pub async fn get(
397        &self,
398        connection_id: Option<&str>,
399        schema: Option<&str>,
400        table: Option<&str>,
401        include_columns: Option<bool>,
402        limit: Option<i32>,
403        cursor: Option<&str>,
404    ) -> Result<
405        models::InformationSchemaResponse,
406        Error<apis::information_schema_api::InformationSchemaError>,
407    > {
408        apis::information_schema_api::information_schema(
409            self.config,
410            connection_id,
411            schema,
412            table,
413            include_columns,
414            limit,
415            cursor,
416        )
417        .await
418    }
419}
420
421/// Jobs resource handle. Wraps [`apis::jobs_api`](crate::apis::jobs_api).
422pub struct JobsApi<'a> {
423    config: &'a Configuration,
424}
425
426impl<'a> JobsApi<'a> {
427    pub(crate) fn new(config: &'a Configuration) -> Self {
428        Self { config }
429    }
430
431    /// Fetch a job by id.
432    pub async fn get(
433        &self,
434        id: &str,
435    ) -> Result<models::JobStatusResponse, Error<apis::jobs_api::GetJobError>> {
436        apis::jobs_api::get_job(self.config, id).await
437    }
438
439    /// List jobs, optionally filtered by type and status.
440    pub async fn list(
441        &self,
442        job_type: Option<models::JobType>,
443        status: Option<&str>,
444        limit: Option<i32>,
445        offset: Option<i32>,
446    ) -> Result<models::ListJobsResponse, Error<apis::jobs_api::ListJobsError>> {
447        apis::jobs_api::list_jobs(self.config, job_type, status, limit, offset).await
448    }
449}
450
451/// Query resource handle. Wraps [`apis::query_api`](crate::apis::query_api).
452///
453/// Also available as the flat [`Client::query`](crate::Client::query) pass-through.
454pub struct QueryApi<'a> {
455    config: &'a Configuration,
456}
457
458impl<'a> QueryApi<'a> {
459    pub(crate) fn new(config: &'a Configuration) -> Self {
460        Self { config }
461    }
462
463    /// Execute a SQL query. `x_database_id` scopes the query to a database.
464    pub async fn execute(
465        &self,
466        request: models::QueryRequest,
467        x_database_id: Option<&str>,
468    ) -> Result<models::QueryResponse, Error<apis::query_api::QueryError>> {
469        apis::query_api::query(self.config, request, x_database_id).await
470    }
471}
472
473/// Query-runs resource handle. Wraps [`apis::query_runs_api`](crate::apis::query_runs_api).
474pub struct QueryRunsApi<'a> {
475    config: &'a Configuration,
476}
477
478impl<'a> QueryRunsApi<'a> {
479    pub(crate) fn new(config: &'a Configuration) -> Self {
480        Self { config }
481    }
482
483    /// Fetch a query run by id. `x_database_id` scopes the lookup to a database
484    /// (the required `X-Database-Id` header).
485    pub async fn get(
486        &self,
487        id: &str,
488        x_database_id: &str,
489    ) -> Result<models::QueryRunInfo, Error<apis::query_runs_api::GetQueryRunError>> {
490        apis::query_runs_api::get_query_run(self.config, id, x_database_id).await
491    }
492
493    /// List recent query runs for the database named by `x_database_id` (the
494    /// required `X-Database-Id` header).
495    pub async fn list(
496        &self,
497        x_database_id: &str,
498        limit: Option<i32>,
499        cursor: Option<&str>,
500        status: Option<&str>,
501        saved_query_id: Option<&str>,
502    ) -> Result<models::ListQueryRunsResponse, Error<apis::query_runs_api::ListQueryRunsError>>
503    {
504        apis::query_runs_api::list_query_runs(
505            self.config,
506            x_database_id,
507            limit,
508            cursor,
509            status,
510            saved_query_id,
511        )
512        .await
513    }
514}
515
516/// Results resource handle. Wraps [`apis::results_api`](crate::apis::results_api).
517///
518/// For Arrow IPC decoding use [`Client::get_result_arrow`](crate::Client::get_result_arrow)
519/// (requires the `arrow` feature).
520pub struct ResultsApi<'a> {
521    config: &'a Configuration,
522}
523
524impl<'a> ResultsApi<'a> {
525    pub(crate) fn new(config: &'a Configuration) -> Self {
526        Self { config }
527    }
528
529    /// Fetch a persisted result by id (JSON form). `x_database_id` scopes the
530    /// lookup to a database (the required `X-Database-Id` header).
531    pub async fn get(
532        &self,
533        id: &str,
534        x_database_id: &str,
535        offset: Option<i32>,
536        limit: Option<i32>,
537        format: Option<models::ResultsFormatQuery>,
538    ) -> Result<models::GetResultResponse, Error<apis::results_api::GetResultError>> {
539        apis::results_api::get_result(self.config, id, x_database_id, offset, limit, format).await
540    }
541
542    /// List persisted results for the database named by `x_database_id` (the
543    /// required `X-Database-Id` header).
544    pub async fn list(
545        &self,
546        x_database_id: &str,
547        limit: Option<i32>,
548        offset: Option<i32>,
549    ) -> Result<models::ListResultsResponse, Error<apis::results_api::ListResultsError>> {
550        apis::results_api::list_results(self.config, x_database_id, limit, offset).await
551    }
552}
553
554/// Saved-queries resource handle. Wraps [`apis::saved_queries_api`](crate::apis::saved_queries_api).
555pub struct SavedQueriesApi<'a> {
556    config: &'a Configuration,
557}
558
559impl<'a> SavedQueriesApi<'a> {
560    pub(crate) fn new(config: &'a Configuration) -> Self {
561        Self { config }
562    }
563
564    /// Create a new saved query.
565    pub async fn create(
566        &self,
567        request: models::CreateSavedQueryRequest,
568    ) -> Result<models::SavedQueryDetail, Error<apis::saved_queries_api::CreateSavedQueryError>>
569    {
570        apis::saved_queries_api::create_saved_query(self.config, request).await
571    }
572
573    /// Fetch a saved query by id.
574    pub async fn get(
575        &self,
576        id: &str,
577    ) -> Result<models::SavedQueryDetail, Error<apis::saved_queries_api::GetSavedQueryError>> {
578        apis::saved_queries_api::get_saved_query(self.config, id).await
579    }
580
581    /// List saved queries.
582    pub async fn list(
583        &self,
584        limit: Option<i32>,
585        offset: Option<i32>,
586    ) -> Result<
587        models::ListSavedQueriesResponse,
588        Error<apis::saved_queries_api::ListSavedQueriesError>,
589    > {
590        apis::saved_queries_api::list_saved_queries(self.config, limit, offset).await
591    }
592
593    /// Update a saved query by id.
594    pub async fn update(
595        &self,
596        id: &str,
597        request: models::UpdateSavedQueryRequest,
598    ) -> Result<models::SavedQueryDetail, Error<apis::saved_queries_api::UpdateSavedQueryError>>
599    {
600        apis::saved_queries_api::update_saved_query(self.config, id, request).await
601    }
602
603    /// Delete a saved query by id.
604    pub async fn delete(
605        &self,
606        id: &str,
607    ) -> Result<(), Error<apis::saved_queries_api::DeleteSavedQueryError>> {
608        apis::saved_queries_api::delete_saved_query(self.config, id).await
609    }
610
611    /// Execute a saved query. `x_database_id` scopes the execution to a database.
612    pub async fn execute(
613        &self,
614        id: &str,
615        x_database_id: &str,
616        request: Option<models::ExecuteSavedQueryRequest>,
617    ) -> Result<models::QueryResponse, Error<apis::saved_queries_api::ExecuteSavedQueryError>> {
618        apis::saved_queries_api::execute_saved_query(self.config, id, x_database_id, request).await
619    }
620
621    /// List versions of a saved query.
622    pub async fn list_versions(
623        &self,
624        id: &str,
625        limit: Option<i32>,
626        offset: Option<i32>,
627    ) -> Result<
628        models::ListSavedQueryVersionsResponse,
629        Error<apis::saved_queries_api::ListSavedQueryVersionsError>,
630    > {
631        apis::saved_queries_api::list_saved_query_versions(self.config, id, limit, offset).await
632    }
633}
634
635/// Uploads resource handle. Wraps [`apis::uploads_api`](crate::apis::uploads_api).
636pub struct UploadsApi<'a> {
637    config: &'a Configuration,
638}
639
640impl<'a> UploadsApi<'a> {
641    pub(crate) fn new(config: &'a Configuration) -> Self {
642        Self { config }
643    }
644
645    /// Upload a local file directly to object storage (presigned) and finalize
646    /// it. The primary upload path; returns the finalized upload (read
647    /// `upload_id` from it). See [`Client::upload_file`](crate::Client::upload_file)
648    /// for the full contract and [`UploadOptions`](crate::uploads::UploadOptions).
649    pub async fn upload_file(
650        &self,
651        path: impl AsRef<std::path::Path>,
652        opts: crate::uploads::UploadOptions,
653    ) -> Result<models::FinalizeUploadResponse, crate::uploads::UploadError> {
654        crate::uploads::upload_file(self.config, path.as_ref(), opts).await
655    }
656}
657
658/// Workspaces resource handle. Wraps [`apis::workspaces_api`](crate::apis::workspaces_api).
659///
660/// Also available as the flat [`Client::list_workspaces`](crate::Client::list_workspaces)
661/// pass-through.
662pub struct WorkspacesApi<'a> {
663    config: &'a Configuration,
664}
665
666impl<'a> WorkspacesApi<'a> {
667    pub(crate) fn new(config: &'a Configuration) -> Self {
668        Self { config }
669    }
670
671    /// Create a new workspace.
672    pub async fn create(
673        &self,
674        request: models::CreateWorkspaceRequest,
675    ) -> Result<models::CreateWorkspaceResponse, Error<apis::workspaces_api::CreateWorkspaceError>>
676    {
677        apis::workspaces_api::create_workspace(self.config, request).await
678    }
679
680    /// List workspaces visible to the authenticated principal.
681    pub async fn list(
682        &self,
683        organization_public_id: Option<&str>,
684    ) -> Result<models::ListWorkspacesResponse, Error<apis::workspaces_api::ListWorkspacesError>>
685    {
686        apis::workspaces_api::list_workspaces(self.config, organization_public_id).await
687    }
688
689    /// Delete a workspace by public id.
690    pub async fn delete(
691        &self,
692        public_id: &str,
693    ) -> Result<(), Error<apis::workspaces_api::DeleteWorkspaceError>> {
694        apis::workspaces_api::delete_workspace(self.config, public_id).await
695    }
696}
697
698#[cfg(test)]
699mod tests {
700    use super::*;
701
702    /// A handle borrows the exact `Configuration` it is constructed from. We
703    /// assert by comparing pointer identity, which proves no copy was made.
704    #[test]
705    fn handle_borrows_provided_config() {
706        let config = Configuration::default();
707        let handle = ConnectionsApi::new(&config);
708        assert!(std::ptr::eq(handle.config, &config));
709    }
710
711    /// Several handle types can borrow the same `Configuration` simultaneously
712    /// (shared borrows), confirming the handles are zero-cost views.
713    #[test]
714    fn multiple_handles_share_one_config() {
715        let config = Configuration::default();
716        let databases = DatabasesApi::new(&config);
717        let connections = ConnectionsApi::new(&config);
718        let queries = QueryApi::new(&config);
719
720        assert!(std::ptr::eq(databases.config, &config));
721        assert!(std::ptr::eq(connections.config, &config));
722        assert!(std::ptr::eq(queries.config, &config));
723    }
724
725    /// Construct every handle type from a default config to guarantee each
726    /// `new` is callable and the structs line up with their modules.
727    #[test]
728    fn all_handles_constructible() {
729        let config = Configuration::default();
730        let _ = ConnectionsApi::new(&config);
731        let _ = DatabaseContextApi::new(&config);
732        let _ = DatabasesApi::new(&config);
733        let _ = EmbeddingProvidersApi::new(&config);
734        let _ = IndexesApi::new(&config);
735        let _ = InformationSchemaApi::new(&config);
736        let _ = JobsApi::new(&config);
737        let _ = QueryApi::new(&config);
738        let _ = QueryRunsApi::new(&config);
739        let _ = ResultsApi::new(&config);
740        let _ = SavedQueriesApi::new(&config);
741        let _ = UploadsApi::new(&config);
742        let _ = WorkspacesApi::new(&config);
743    }
744}