spiral-sdk 0.1.10

Rust SDK for Spiral resource and table APIs
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
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
// Generated by tools/service-contracts/rust.py. Do not edit.
#![doc = "Generated implementation of authenticated SDK resource facades."]
use spiral_contract::call::CallError;
use uuid::Uuid;

use crate::api::tasks::TasksClient;
use crate::api::tasks::objects::*;
use crate::auth::TokenSource;
use crate::http::HttpClient;
/// Service operations sharing a connection pool and resolving credentials for every request.
#[derive(Clone, Debug)]
pub struct AuthenticatedClient {
    http: HttpClient,
    client: TasksClient,
}
impl AuthenticatedClient {
    /// Connect with bounded requests; configure credentials before authenticated calls.
    pub fn new(base: &str) -> Result<Self, CallError<TasksError>> {
        Self::from_http(HttpClient::connect(base).map_err(CallError::transport)?)
    }
    pub(crate) fn from_http(http: HttpClient) -> Result<Self, CallError<TasksError>> {
        let client =
            TasksClient::from_transport(http.base_url().as_str(), http.middleware_client())?;
        Ok(Self { http, client })
    }
    /// Reuse a connection pool with redirects disabled to protect bearer credentials.
    pub fn with_client(mut self, client: reqwest::Client) -> Self {
        self.http = self.http.with_client(client);
        self.client = self.client.with_transport(self.http.middleware_client());
        self
    }
    /// Resolve the provider's current credential before each request and pagination fetch.
    pub fn with_token_source(mut self, provider: TokenSource) -> Self {
        self.http = self.http.with_token_source(provider);
        self
    }
    /// Activate one Worker pool.
    pub async fn activate_worker_pool(
        &self,
        project_id: String,
        worker_pool_id: Uuid,
    ) -> Result<WorkerPoolResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .activate_worker_pool_http(auth_header, project_id, worker_pool_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Cancel a Task through a Project. Deprecated; use cancel_task, which derives the Project.
    pub async fn cancel_project_task(
        &self,
        project_id: String,
        task_id: Uuid,
    ) -> Result<Task, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .cancel_project_task_http(auth_header, project_id, task_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Request cancellation of a Task. The Task's own Project authorizes the request; a Task the
    /// caller cannot view is not found.
    pub async fn cancel_task(&self, task_id: Uuid) -> Result<Task, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client.cancel_task_http(auth_header, task_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Claim worker task.
    pub async fn claim_worker_task(
        &self,
        worker_session_id: Uuid,
        task_id: Uuid,
    ) -> Result<PollTaskResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .claim_worker_task_http(auth_header, worker_session_id, task_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Create a Task from a specification ID and JSON input. Deprecated; use submit_task.
    pub async fn create_task(
        &self,
        project_id: String,
        request: CreateTaskRequest,
    ) -> Result<CreateTaskResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .create_task_http(auth_header, project_id, request),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Create trigger.
    pub async fn create_trigger(
        &self,
        project_id: String,
        request: TriggerDefinition,
    ) -> Result<TaskTrigger, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .create_trigger_http(auth_header, project_id, request),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Create worker pool.
    pub async fn create_worker_pool(
        &self,
        project_id: String,
        request: CreateWorkerPoolRequest,
    ) -> Result<WorkerPoolResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .create_worker_pool_http(auth_header, project_id, request),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Delete trigger.
    pub async fn delete_trigger(
        &self,
        project_id: String,
        trigger_id: Uuid,
    ) -> Result<(), CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .delete_trigger_http(auth_header, project_id, trigger_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Drain worker.
    pub async fn drain_worker(
        &self,
        worker_session_id: Uuid,
    ) -> Result<DrainWorkerResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .drain_worker_http(auth_header, worker_session_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Finish worker attempt.
    pub async fn finish_worker_attempt(
        &self,
        worker_session_id: Uuid,
        attempt_id: Uuid,
        request: FinishAttemptRequest,
    ) -> Result<FinishAttemptResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client.finish_worker_attempt_http(
                auth_header,
                worker_session_id,
                attempt_id,
                request,
            ),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Heartbeat worker.
    pub async fn heartbeat_worker(
        &self,
        worker_session_id: Uuid,
        request: HeartbeatWorkerRequest,
    ) -> Result<HeartbeatWorkerResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .heartbeat_worker_http(auth_header, worker_session_id, request),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// List task specs.
    pub async fn list_task_specs(
        &self,
        project_id: String,
    ) -> Result<ListTaskSpecsResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client.list_task_specs_http(auth_header, project_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// List Tasks by descending Task ID. Pages default to 100 items with a maximum of 1000.
    /// Continuations expire after one hour and are scoped to the caller, target, operation, filters
    /// and page size. This is a live listing; concurrent updates can change later pages.
    pub async fn list_tasks(
        &self,
        project_id: String,
        request: ListTasksRequest,
    ) -> Result<ListTasksResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .list_tasks_http(auth_header, project_id, request),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Build a lazy collection, retaining filters and resolving fresh credentials for each page.
    pub fn list_tasks_list(
        &self,
        project_id: String,
        request: ListTasksRequest,
    ) -> crate::List<'_, Task> {
        let options = crate::pagination::PageOptions {
            token: request.page_token.clone(),
            size: request.page_size,
        };
        crate::List::new(move |options| {
            let project_id = ToOwned::to_owned(&project_id);
            let mut request = request.clone();
            request.page_token = options.token;
            request.page_size = options.size;
            Box::pin(async move {
                let page = self.list_tasks(project_id, request).await?;
                Ok(crate::Page {
                    items: page.tasks,
                    next_page_token: page.next_page_token,
                })
            })
        })
        .with_options(options)
    }
    /// List invocations by descending submission time and Task ID in fixed pages of 10.
    /// Continuations expire after one hour and are scoped to the caller, target, operation, filters
    /// and page size. This is a live listing; concurrent updates can change later pages.
    pub async fn list_trigger_invocations(
        &self,
        project_id: String,
        trigger_id: Uuid,
        request: InvocationPageRequest,
    ) -> Result<InvocationPage, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .list_trigger_invocations_http(auth_header, project_id, trigger_id, request),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// List triggers by descending trigger ID in fixed pages of 50. Continuations expire after one
    /// hour and are scoped to the caller, target, operation, filters and page size. This is a live
    /// listing; concurrent updates can change later pages.
    pub async fn list_triggers(
        &self,
        project_id: String,
        request: TriggerPageRequest,
    ) -> Result<TriggerPage, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .list_triggers_http(auth_header, project_id, request),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// List Attempts by descending Attempt ID. Pages default to 100 items with a maximum of 100.
    /// Continuations expire after one hour and are scoped to the caller, target, operation, filters
    /// and page size. This is a live listing; concurrent updates can change later pages.
    pub async fn list_worker_attempts(
        &self,
        project_id: String,
        worker_session_id: Uuid,
        request: ListWorkerAttemptsRequest,
    ) -> Result<ListWorkerAttemptsResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client.list_worker_attempts_http(
                auth_header,
                project_id,
                worker_session_id,
                request,
            ),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Build a lazy collection, retaining filters and resolving fresh credentials for each page.
    pub fn list_worker_attempts_list(
        &self,
        project_id: String,
        worker_session_id: Uuid,
        request: ListWorkerAttemptsRequest,
    ) -> crate::List<'_, WorkerAttempt> {
        let options = crate::pagination::PageOptions {
            token: request.page_token.clone(),
            size: request.page_size,
        };
        crate::List::new(move |options| {
            let project_id = ToOwned::to_owned(&project_id);
            let worker_session_id = ToOwned::to_owned(&worker_session_id);
            let mut request = request.clone();
            request.page_token = options.token;
            request.page_size = options.size;
            Box::pin(async move {
                let page = self
                    .list_worker_attempts(project_id, worker_session_id, request)
                    .await?;
                Ok(crate::Page {
                    items: page.attempts,
                    next_page_token: page.next_page_token,
                })
            })
        })
        .with_options(options)
    }
    /// List Worker pools and aligned statistics by ascending pool ID. Pages default to 100 items
    /// with a maximum of 1000. Continuations expire after one hour and are scoped to the caller,
    /// target, operation, filters and page size. This is a live listing; concurrent updates can
    /// change later pages.
    pub async fn list_worker_pools(
        &self,
        project_id: String,
        request: ListWorkerPoolsRequest,
    ) -> Result<ListWorkerPoolsResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .list_worker_pools_http(auth_header, project_id, request),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Build a lazy collection, retaining filters and resolving fresh credentials for each page.
    pub fn list_worker_pools_list(
        &self,
        project_id: String,
        request: ListWorkerPoolsRequest,
    ) -> crate::List<'_, WorkerPool> {
        let options = crate::pagination::PageOptions {
            token: request.page_token.clone(),
            size: request.page_size,
        };
        crate::List::new(move |options| {
            let project_id = ToOwned::to_owned(&project_id);
            let mut request = request.clone();
            request.page_token = options.token;
            request.page_size = options.size;
            Box::pin(async move {
                let page = self.list_worker_pools(project_id, request).await?;
                Ok(crate::Page {
                    items: page.worker_pools,
                    next_page_token: page.next_page_token,
                })
            })
        })
        .with_options(options)
    }
    /// List Worker sessions by descending session ID. Pages default to 100 items with a maximum of
    /// 1000. Continuations expire after one hour and are scoped to the caller, target, operation,
    /// filters and page size. This is a live listing; concurrent updates can change later pages.
    pub async fn list_worker_sessions(
        &self,
        project_id: String,
        request: ListWorkerSessionsRequest,
    ) -> Result<ListWorkerSessionsResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .list_worker_sessions_http(auth_header, project_id, request),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Build a lazy collection, retaining filters and resolving fresh credentials for each page.
    pub fn list_worker_sessions_list(
        &self,
        project_id: String,
        request: ListWorkerSessionsRequest,
    ) -> crate::List<'_, WorkerSession> {
        let options = crate::pagination::PageOptions {
            token: request.page_token.clone(),
            size: request.page_size,
        };
        crate::List::new(move |options| {
            let project_id = ToOwned::to_owned(&project_id);
            let mut request = request.clone();
            request.page_token = options.token;
            request.page_size = options.size;
            Box::pin(async move {
                let page = self.list_worker_sessions(project_id, request).await?;
                Ok(crate::Page {
                    items: page.worker_sessions,
                    next_page_token: page.next_page_token,
                })
            })
        })
        .with_options(options)
    }
    /// Pause one Worker pool.
    pub async fn pause_worker_pool(
        &self,
        project_id: String,
        worker_pool_id: Uuid,
    ) -> Result<WorkerPoolResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .pause_worker_pool_http(auth_header, project_id, worker_pool_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Poll worker.
    pub async fn poll_worker(
        &self,
        worker_session_id: Uuid,
    ) -> Result<PollTaskResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client.poll_worker_http(auth_header, worker_session_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Read a Task through a Project. Deprecated; use read_task, which derives the Project.
    pub async fn read_project_task(
        &self,
        project_id: String,
        task_id: Uuid,
    ) -> Result<TaskDetails, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .read_project_task_http(auth_header, project_id, task_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Read resource usage.
    pub async fn read_resource_usage(
        &self,
        project_id: String,
        worker_session_id: Uuid,
        request: ResourceUsageRequest,
    ) -> Result<ResourceUsageHistory, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client.read_resource_usage_http(
                auth_header,
                project_id,
                worker_session_id,
                request,
            ),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Read a Task with its Attempts and resource references. The Task's own Project authorizes the
    /// read; a Task the caller cannot view is not found.
    pub async fn read_task(&self, task_id: Uuid) -> Result<TaskDetails, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client.read_task_http(auth_header, task_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Read task stats.
    pub async fn read_task_stats(
        &self,
        project_id: String,
        request: TaskStatsRequest,
    ) -> Result<TaskStats, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .read_task_stats_http(auth_header, project_id, request),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Read trigger.
    pub async fn read_trigger(
        &self,
        project_id: String,
        trigger_id: Uuid,
    ) -> Result<TaskTrigger, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .read_trigger_http(auth_header, project_id, trigger_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Read worker pool.
    pub async fn read_worker_pool(
        &self,
        project_id: String,
        worker_pool_id: Uuid,
    ) -> Result<WorkerPoolDetails, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .read_worker_pool_http(auth_header, project_id, worker_pool_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Read worker session.
    pub async fn read_worker_session(
        &self,
        project_id: String,
        worker_session_id: Uuid,
    ) -> Result<WorkerSession, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .read_worker_session_http(auth_header, project_id, worker_session_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Register worker.
    pub async fn register_worker(
        &self,
        request: RegisterWorkerRequest,
    ) -> Result<RegisterWorkerResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client.register_worker_http(auth_header, request),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Retire one Worker pool.
    pub async fn retire_worker_pool(
        &self,
        project_id: String,
        worker_pool_id: Uuid,
    ) -> Result<WorkerPoolResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .retire_worker_pool_http(auth_header, project_id, worker_pool_id),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Run trigger.
    pub async fn run_trigger(
        &self,
        project_id: String,
        trigger_id: Uuid,
        request: RunTriggerRequest,
    ) -> Result<TriggerInvocation, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .run_trigger_http(auth_header, project_id, trigger_id, request),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Submit a Task from its definition. The response is accepted with the Task, or skipped when
    /// the definition's overlap policy keeps an equivalent Task already waiting.
    pub async fn submit_task(
        &self,
        project_id: String,
        request: SubmitTaskRequest,
    ) -> Result<CreateTaskResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .submit_task_http(auth_header, project_id, request),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Test trigger.
    pub async fn test_trigger(
        &self,
        project_id: String,
        trigger_id: Uuid,
        request: TestTriggerRequest,
    ) -> Result<TestTriggerResponse, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .test_trigger_http(auth_header, project_id, trigger_id, request),
        )
        .await
        .map_err(CallError::transport)?
    }
    /// Update trigger.
    pub async fn update_trigger(
        &self,
        project_id: String,
        trigger_id: Uuid,
        request: UpdateTriggerRequest,
    ) -> Result<TaskTrigger, CallError<TasksError>> {
        let auth_header = self
            .http
            .auth_header()
            .await
            .map_err(CallError::transport)?;
        tokio::time::timeout(
            std::time::Duration::from_secs(10),
            self.client
                .update_trigger_http(auth_header, project_id, trigger_id, request),
        )
        .await
        .map_err(CallError::transport)?
    }
}