taskcluster_download/
service.rs1use anyhow::Error;
3use async_trait::async_trait;
4use serde_json::Value;
5use taskcluster::{Object, Queue};
6
7#[allow(non_snake_case)]
9#[async_trait]
10pub(super) trait ObjectService {
11 async fn startDownload(&self, name: &str, payload: &Value)
12 -> std::result::Result<Value, Error>;
13}
14
15#[async_trait]
17impl ObjectService for Object {
18 async fn startDownload(
19 &self,
20 name: &str,
21 payload: &Value,
22 ) -> std::result::Result<Value, Error> {
23 (self as &Object).startDownload(name, payload).await
24 }
25}
26
27#[allow(non_snake_case)]
29#[async_trait]
30pub(super) trait QueueService {
31 async fn artifact(
32 &self,
33 task_id: &str,
34 run_id: &str,
35 name: &str,
36 ) -> std::result::Result<Value, Error>;
37 async fn latestArtifact(&self, task_id: &str, name: &str) -> std::result::Result<Value, Error>;
38}
39
40#[async_trait]
42impl QueueService for Queue {
43 async fn artifact(
44 &self,
45 task_id: &str,
46 run_id: &str,
47 name: &str,
48 ) -> std::result::Result<Value, Error> {
49 (self as &Queue).artifact(task_id, run_id, name).await
50 }
51
52 async fn latestArtifact(&self, task_id: &str, name: &str) -> std::result::Result<Value, Error> {
53 (self as &Queue).latestArtifact(task_id, name).await
54 }
55}