olai-uc-client 0.0.5

Async Rust client for the Unity Catalog REST API.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
//! Hand-written client for the UC Delta REST API (`/delta/v1/...`).
//!
//! The Delta API is a standalone REST protocol (not a generated resource API),
//! so — like [`crate::temporary_credentials`] — it is hand-maintained. The wire
//! DTOs are shared with the server via
//! [`unitycatalog_delta_api::models`]. This client covers the full
//! `delta.yaml` surface: catalog config negotiation, the catalog-managed table
//! lifecycle (`createStagingTable`, `createTable`, `loadTable`, `updateTable`,
//! `deleteTable`, `tableExists`, `renameTable`), credential vending
//! (`getTableCredentials`, `getStagingTableCredentials`,
//! `getTemporaryPathCredentials`), and commit-metrics reporting (`reportMetrics`).

use percent_encoding::{NON_ALPHANUMERIC, utf8_percent_encode};
use unitycatalog_delta_api::models::{
    DeltaCatalogConfig, DeltaCreateStagingTableRequest, DeltaCreateTableRequest,
    DeltaCredentialOperation, DeltaCredentialsResponse, DeltaLoadTableResponse,
    DeltaRenameTableRequest, DeltaReportMetricsRequest, DeltaStagingTableResponse,
    DeltaUpdateTableRequest,
};
use url::Url;

use crate::{Result, Transport};

/// Percent-encode a single path segment so names containing `/ ? # space ..`
/// route to the intended resource instead of being interpreted as path
/// structure. We encode every non-alphanumeric byte (a superset of the RFC 3986
/// path-segment reserved set), which is safe because each call encodes exactly
/// one segment that is then joined with literal `/` separators.
fn encode_segment(segment: &str) -> String {
    utf8_percent_encode(segment, NON_ALPHANUMERIC).to_string()
}

/// The wire string for a credential operation as used in `operation` query params.
fn operation_param(operation: DeltaCredentialOperation) -> &'static str {
    match operation {
        DeltaCredentialOperation::Read => "READ",
        DeltaCredentialOperation::ReadWrite => "READ_WRITE",
    }
}

/// Client for the `/delta/v1/` Delta REST API.
///
/// Constructed from the per-target [`Transport`] (carrying auth) and the Unity
/// Catalog base URL. Prefer
/// [`UnityCatalogClient::delta_v1`](crate::UnityCatalogClient::delta_v1).
#[derive(Clone)]
pub struct DeltaV1Client {
    client: Transport,
    base_url: Url,
}

impl DeltaV1Client {
    /// Create a new Delta v1 client. `base_url` is normalized to end in `/` so it
    /// joins cleanly with the relative endpoint paths.
    pub fn new(client: Transport, mut base_url: Url) -> Self {
        if !base_url.path().ends_with('/') {
            base_url.set_path(&format!("{}/", base_url.path()));
        }
        Self { client, base_url }
    }

    /// Build a `/delta/v1/...` URL from already-encoded path components.
    fn url(&self, rest: &str) -> Result<Url> {
        Ok(self.base_url.join(&format!("delta/v1/{rest}"))?)
    }

    /// Get catalog configuration and supported endpoints —
    /// `GET /delta/v1/config?catalog={catalog}&protocol-versions={versions}`.
    ///
    /// This is the protocol-negotiation entry point: the client advertises the
    /// highest protocol versions it supports per major version (`protocol_versions`,
    /// e.g. `"1.1,2.3"`) and the server returns the endpoints it supports for the
    /// newest mutually supported version. Used to discover whether the
    /// `/delta/v1` surface is available before falling back to the legacy API.
    pub async fn get_config(
        &self,
        catalog: &str,
        protocol_versions: &str,
    ) -> Result<DeltaCatalogConfig> {
        let url = self.url("config")?;
        let response = self
            .client
            .get(url)
            .query(&[
                ("catalog", catalog),
                ("protocol-versions", protocol_versions),
            ])
            .send_raw()
            .await
            .map_err(crate::Error::from_delta_send)?;
        let response = crate::error::check_delta_response(response).await?;
        let result = response.bytes().await?;
        Ok(serde_json::from_slice(&result)?)
    }

    /// Create a staging table — `POST /delta/v1/catalogs/{catalog}/schemas/{schema}/staging-tables`.
    ///
    /// Allocates an immutable table id and a managed storage `location`, and
    /// advertises the catalog-managed contract (required/suggested protocol +
    /// properties) plus `READ_WRITE` credentials for writing the initial
    /// `_delta_log/0.json`. The catalog/schema are taken from the path; the
    /// request body carries only the table name.
    pub async fn create_staging_table(
        &self,
        catalog: &str,
        schema: &str,
        request: &DeltaCreateStagingTableRequest,
    ) -> Result<DeltaStagingTableResponse> {
        let url = self.url(&format!(
            "catalogs/{}/schemas/{}/staging-tables",
            encode_segment(catalog),
            encode_segment(schema),
        ))?;
        let response = self
            .client
            .post(url)
            .json(request)
            .send_raw()
            .await
            .map_err(crate::Error::from_delta_send)?;
        let response = crate::error::check_delta_response(response).await?;
        let result = response.bytes().await?;
        Ok(serde_json::from_slice(&result)?)
    }

    /// Finalize a managed table from its staging reservation —
    /// `POST /delta/v1/catalogs/{catalog}/schemas/{schema}/tables`.
    ///
    /// Called after the client has written `_delta_log/0.json` (carrying the
    /// required features/properties, including `io.unitycatalog.tableId`) to the
    /// staging `location`. The server validates the contract and registers the
    /// table at version 0.
    pub async fn create_table(
        &self,
        catalog: &str,
        schema: &str,
        request: &DeltaCreateTableRequest,
    ) -> Result<DeltaLoadTableResponse> {
        let url = self.url(&format!(
            "catalogs/{}/schemas/{}/tables",
            encode_segment(catalog),
            encode_segment(schema),
        ))?;
        let response = self
            .client
            .post(url)
            .json(request)
            .send_raw()
            .await
            .map_err(crate::Error::from_delta_send)?;
        let response = crate::error::check_delta_response(response).await?;
        let result = response.bytes().await?;
        Ok(serde_json::from_slice(&result)?)
    }

    /// Load a Delta table's metadata, unbackfilled CCv2 commits, and latest
    /// ratified version — `GET /delta/v1/catalogs/{catalog}/schemas/{schema}/tables/{table}`.
    ///
    /// For a catalog-managed (MANAGED) table the response carries the `commits`
    /// log tail and `latest_table_version` a reader needs to materialize the
    /// catalog's ratified snapshot.
    pub async fn load_table(
        &self,
        catalog: &str,
        schema: &str,
        table: &str,
    ) -> Result<DeltaLoadTableResponse> {
        let url = self.table_url(catalog, schema, table, "")?;
        let response = self
            .client
            .get(url)
            .send_raw()
            .await
            .map_err(crate::Error::from_delta_send)?;
        let response = crate::error::check_delta_response(response).await?;
        let result = response.bytes().await?;
        Ok(serde_json::from_slice(&result)?)
    }

    /// Update a table — `POST /delta/v1/catalogs/{catalog}/schemas/{schema}/tables/{table}`.
    ///
    /// This is the catalog-managed commit surface: the `add-commit` action
    /// proposes a staged commit (the server ratifies iff `version == last + 1`,
    /// returning `409` on conflict), and `set-latest-backfilled-version` notifies
    /// the catalog that commits up to a version have been published into
    /// `_delta_log/`. Metadata/property/schema changes ride the same call.
    pub async fn update_table(
        &self,
        catalog: &str,
        schema: &str,
        table: &str,
        request: &DeltaUpdateTableRequest,
    ) -> Result<DeltaLoadTableResponse> {
        let url = self.table_url(catalog, schema, table, "")?;
        let response = self
            .client
            .post(url)
            .json(request)
            .send_raw()
            .await
            .map_err(crate::Error::from_delta_send)?;
        let response = crate::error::check_delta_response(response).await?;
        let result = response.bytes().await?;
        Ok(serde_json::from_slice(&result)?)
    }

    /// Delete a table — `DELETE /delta/v1/catalogs/{catalog}/schemas/{schema}/tables/{table}`.
    ///
    /// The server responds `204 No Content` on success.
    pub async fn delete_table(&self, catalog: &str, schema: &str, table: &str) -> Result<()> {
        let url = self.table_url(catalog, schema, table, "")?;
        let response = self
            .client
            .delete(url)
            .send_raw()
            .await
            .map_err(crate::Error::from_delta_send)?;
        crate::error::check_delta_response(response).await?;
        Ok(())
    }

    /// Check whether a table exists —
    /// `HEAD /delta/v1/catalogs/{catalog}/schemas/{schema}/tables/{table}`.
    ///
    /// Returns `Ok(true)` on `204`, `Ok(false)` on `404`, and an error for any
    /// other non-success status. A HEAD response carries no body, so a `404` here
    /// is mapped directly rather than parsed as a Delta error envelope.
    pub async fn table_exists(&self, catalog: &str, schema: &str, table: &str) -> Result<bool> {
        let url = self.table_url(catalog, schema, table, "")?;
        // The two transports classify a 404 differently: CloudClient's retry layer
        // surfaces it as `Err(SendRawError::Retry)` with the status attached,
        // whereas WasmClient's `send_raw` is a plain send with no `error_for_status`
        // so a 404 comes back as `Ok(Response)` with a 404 status.
        #[cfg(not(target_arch = "wasm32"))]
        {
            match self.client.head(url).send_raw().await {
                // Any 2xx (the server responds 204) means the table exists.
                Ok(_) => Ok(true),
                // A 404 is the documented "does not exist" signal — a HEAD carries
                // no body, so map it directly rather than parsing an error envelope.
                Err(olai_http::SendRawError::Retry(ref e))
                    if e.status() == Some(reqwest::StatusCode::NOT_FOUND) =>
                {
                    Ok(false)
                }
                Err(e) => Err(crate::Error::from_delta_send(e)),
            }
        }
        #[cfg(target_arch = "wasm32")]
        {
            let response = self
                .client
                .head(url)
                .send_raw()
                .await
                .map_err(crate::Error::from_delta_send)?;
            let status = response.status();
            if status == reqwest::StatusCode::NOT_FOUND {
                Ok(false)
            } else if status.is_success() {
                Ok(true)
            } else {
                Err(crate::Error::delta_status(status))
            }
        }
    }

    /// Rename a table within the same catalog and schema —
    /// `POST /delta/v1/catalogs/{catalog}/schemas/{schema}/tables/{table}/rename`.
    ///
    /// Cross-schema and cross-catalog moves are not supported. The server responds
    /// `204 No Content` on success.
    pub async fn rename_table(
        &self,
        catalog: &str,
        schema: &str,
        table: &str,
        request: &DeltaRenameTableRequest,
    ) -> Result<()> {
        let url = self.table_url(catalog, schema, table, "/rename")?;
        let response = self
            .client
            .post(url)
            .json(request)
            .send_raw()
            .await
            .map_err(crate::Error::from_delta_send)?;
        crate::error::check_delta_response(response).await?;
        Ok(())
    }

    /// Vend temporary credentials for a table's data —
    /// `GET /delta/v1/catalogs/{catalog}/schemas/{schema}/tables/{table}/credentials?operation={op}`.
    ///
    /// `operation` scopes the credential to `READ` or `READ_WRITE` access.
    pub async fn get_table_credentials(
        &self,
        catalog: &str,
        schema: &str,
        table: &str,
        operation: DeltaCredentialOperation,
    ) -> Result<DeltaCredentialsResponse> {
        let url = self.table_url(catalog, schema, table, "/credentials")?;
        let response = self
            .client
            .get(url)
            .query(&[("operation", operation_param(operation))])
            .send_raw()
            .await
            .map_err(crate::Error::from_delta_send)?;
        let response = crate::error::check_delta_response(response).await?;
        let result = response.bytes().await?;
        Ok(serde_json::from_slice(&result)?)
    }

    /// Vend `READ_WRITE` credentials for a staging table identified by its UUID —
    /// `GET /delta/v1/staging-tables/{table_id}/credentials`.
    ///
    /// A staging table is globally identified by its UUID (no catalog/schema). This
    /// is how staging-phase credentials are refreshed while the client writes the
    /// initial commit.
    pub async fn get_staging_table_credentials(
        &self,
        table_id: &str,
    ) -> Result<DeltaCredentialsResponse> {
        let url = self.url(&format!(
            "staging-tables/{}/credentials",
            encode_segment(table_id),
        ))?;
        let response = self
            .client
            .get(url)
            .send_raw()
            .await
            .map_err(crate::Error::from_delta_send)?;
        let response = crate::error::check_delta_response(response).await?;
        let result = response.bytes().await?;
        Ok(serde_json::from_slice(&result)?)
    }

    /// Vend temporary credentials for a storage path (for creating a new external
    /// table) — `GET /delta/v1/temporary-path-credentials?location={location}&operation={op}`.
    ///
    /// The path is not yet part of any catalog/namespace, so it is passed as a
    /// query parameter rather than a path segment.
    pub async fn get_temporary_path_credentials(
        &self,
        location: &str,
        operation: DeltaCredentialOperation,
    ) -> Result<DeltaCredentialsResponse> {
        let url = self.url("temporary-path-credentials")?;
        let response = self
            .client
            .get(url)
            .query(&[
                ("location", location),
                ("operation", operation_param(operation)),
            ])
            .send_raw()
            .await
            .map_err(crate::Error::from_delta_send)?;
        let response = crate::error::check_delta_response(response).await?;
        let result = response.bytes().await?;
        Ok(serde_json::from_slice(&result)?)
    }

    /// Report commit metrics (telemetry) for a table —
    /// `POST /delta/v1/catalogs/{catalog}/schemas/{schema}/tables/{table}/metrics`.
    ///
    /// The path `{table}` and the body `table-id` must identify the same table.
    /// The server responds `204 No Content` on success.
    pub async fn report_metrics(
        &self,
        catalog: &str,
        schema: &str,
        table: &str,
        request: &DeltaReportMetricsRequest,
    ) -> Result<()> {
        let url = self.table_url(catalog, schema, table, "/metrics")?;
        let response = self
            .client
            .post(url)
            .json(request)
            .send_raw()
            .await
            .map_err(crate::Error::from_delta_send)?;
        crate::error::check_delta_response(response).await?;
        Ok(())
    }

    /// Build a `catalogs/{c}/schemas/{s}/tables/{t}{suffix}` URL with each name
    /// percent-encoded. `suffix` is a literal sub-path (e.g. `"/rename"`) or empty.
    fn table_url(&self, catalog: &str, schema: &str, table: &str, suffix: &str) -> Result<Url> {
        self.url(&format!(
            "catalogs/{}/schemas/{}/tables/{}{suffix}",
            encode_segment(catalog),
            encode_segment(schema),
            encode_segment(table),
        ))
    }
}

// Native-only: these tests use mockito + `CloudClient::new_unauthenticated` and a
// tokio runtime, none of which exist on wasm32.
#[cfg(all(test, not(target_arch = "wasm32")))]
mod tests {
    use super::*;
    use mockito::Server;
    use unitycatalog_delta_api::models::DeltaErrorType;

    fn test_client(server: &Server) -> DeltaV1Client {
        let base = Url::parse(&server.url()).unwrap();
        DeltaV1Client::new(Transport::new_unauthenticated(), base)
    }

    /// A minimal `DeltaLoadTableResponse` JSON body for happy-path assertions.
    fn load_table_body() -> &'static str {
        r#"{"metadata":{"etag":"e","table-type":"MANAGED","table-uuid":"u",
            "location":"s3://b/t","created-time":0,"updated-time":0,
            "columns":{"type":"struct","fields":[]},"properties":{}}}"#
    }

    #[tokio::test]
    async fn load_table_maps_delta_not_found() {
        let mut server = Server::new_async().await;
        let m = server
            .mock("GET", "/delta/v1/catalogs/c/schemas/s/tables/t")
            .with_status(404)
            .with_header("content-type", "application/json")
            .with_body(
                r#"{"error":{"message":"no table","type":"NoSuchTableException","code":404}}"#,
            )
            .create_async()
            .await;

        let err = test_client(&server)
            .load_table("c", "s", "t")
            .await
            .unwrap_err();
        m.assert_async().await;
        assert!(err.is_not_found());
        assert!(matches!(
            err,
            crate::Error::Delta(ref model)
                if model.error_type == DeltaErrorType::NoSuchTableException
        ));
    }

    #[tokio::test]
    async fn update_table_maps_commit_conflict() {
        let mut server = Server::new_async().await;
        let m = server
            .mock("POST", "/delta/v1/catalogs/c/schemas/s/tables/t")
            .with_status(409)
            .with_body(
                r#"{"error":{"message":"conflict","type":"CommitVersionConflictException","code":409}}"#,
            )
            .create_async()
            .await;

        let req = DeltaUpdateTableRequest {
            requirements: vec![],
            updates: vec![],
        };
        let err = test_client(&server)
            .update_table("c", "s", "t", &req)
            .await
            .unwrap_err();
        m.assert_async().await;
        assert!(err.is_commit_conflict());
    }

    #[tokio::test]
    async fn url_segments_are_percent_encoded() {
        let mut server = Server::new_async().await;
        // A schema with a space and a table with a slash must be encoded so they
        // route to a single resource rather than extra path structure.
        let m = server
            .mock(
                "GET",
                "/delta/v1/catalogs/c/schemas/my%20schema/tables/weird%2Fname",
            )
            .with_status(200)
            .with_header("content-type", "application/json")
            .with_body(load_table_body())
            .create_async()
            .await;

        let resp = test_client(&server)
            .load_table("c", "my schema", "weird/name")
            .await
            .unwrap();
        m.assert_async().await;
        assert_eq!(resp.metadata.location, "s3://b/t");
    }

    #[tokio::test]
    async fn table_exists_true_false() {
        let mut server = Server::new_async().await;
        let exists = server
            .mock("HEAD", "/delta/v1/catalogs/c/schemas/s/tables/yes")
            .with_status(204)
            .create_async()
            .await;
        let missing = server
            .mock("HEAD", "/delta/v1/catalogs/c/schemas/s/tables/no")
            .with_status(404)
            .create_async()
            .await;

        let client = test_client(&server);
        assert!(client.table_exists("c", "s", "yes").await.unwrap());
        assert!(!client.table_exists("c", "s", "no").await.unwrap());
        exists.assert_async().await;
        missing.assert_async().await;
    }

    #[tokio::test]
    async fn get_config_sends_query_params() {
        let mut server = Server::new_async().await;
        let m = server
            .mock("GET", "/delta/v1/config")
            .match_query(mockito::Matcher::AllOf(vec![
                mockito::Matcher::UrlEncoded("catalog".into(), "main".into()),
                mockito::Matcher::UrlEncoded("protocol-versions".into(), "1.1,2.3".into()),
            ]))
            .with_status(200)
            .with_header("content-type", "application/json")
            .with_body(r#"{"endpoints":["GET /v1/config"],"protocol-version":"1.0"}"#)
            .create_async()
            .await;

        let cfg = test_client(&server)
            .get_config("main", "1.1,2.3")
            .await
            .unwrap();
        m.assert_async().await;
        assert_eq!(cfg.protocol_version, "1.0");
    }

    #[tokio::test]
    async fn get_table_credentials_sends_operation() {
        let mut server = Server::new_async().await;
        let m = server
            .mock("GET", "/delta/v1/catalogs/c/schemas/s/tables/t/credentials")
            .match_query(mockito::Matcher::UrlEncoded(
                "operation".into(),
                "READ_WRITE".into(),
            ))
            .with_status(200)
            .with_header("content-type", "application/json")
            .with_body(r#"{"storage-credentials":[]}"#)
            .create_async()
            .await;

        let resp = test_client(&server)
            .get_table_credentials("c", "s", "t", DeltaCredentialOperation::ReadWrite)
            .await
            .unwrap();
        m.assert_async().await;
        assert!(resp.storage_credentials.is_empty());
    }

    #[tokio::test]
    async fn rename_and_delete_and_metrics_no_content() {
        let mut server = Server::new_async().await;
        let rename = server
            .mock("POST", "/delta/v1/catalogs/c/schemas/s/tables/t/rename")
            .with_status(204)
            .create_async()
            .await;
        let delete = server
            .mock("DELETE", "/delta/v1/catalogs/c/schemas/s/tables/t")
            .with_status(204)
            .create_async()
            .await;
        let metrics = server
            .mock("POST", "/delta/v1/catalogs/c/schemas/s/tables/t/metrics")
            .with_status(204)
            .create_async()
            .await;

        let client = test_client(&server);
        client
            .rename_table(
                "c",
                "s",
                "t",
                &DeltaRenameTableRequest {
                    new_name: "t2".into(),
                },
            )
            .await
            .unwrap();
        client.delete_table("c", "s", "t").await.unwrap();
        client
            .report_metrics(
                "c",
                "s",
                "t",
                &DeltaReportMetricsRequest {
                    table_id: "u".into(),
                    report: None,
                },
            )
            .await
            .unwrap();
        rename.assert_async().await;
        delete.assert_async().await;
        metrics.assert_async().await;
    }

    #[tokio::test]
    async fn temporary_path_credentials_query() {
        let mut server = Server::new_async().await;
        let m = server
            .mock("GET", "/delta/v1/temporary-path-credentials")
            .match_query(mockito::Matcher::AllOf(vec![
                mockito::Matcher::UrlEncoded("location".into(), "s3://bucket/path".into()),
                mockito::Matcher::UrlEncoded("operation".into(), "READ".into()),
            ]))
            .with_status(200)
            .with_header("content-type", "application/json")
            .with_body(r#"{"storage-credentials":[]}"#)
            .create_async()
            .await;

        test_client(&server)
            .get_temporary_path_credentials("s3://bucket/path", DeltaCredentialOperation::Read)
            .await
            .unwrap();
        m.assert_async().await;
    }
}