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
#[derive(Debug, Clone, Copy)]
pub struct LivepeerUrls {
    pub vod: VodUrls,
    pub task: TaskUrls,
    pub auth: AuthUrls,
    pub access_control: AccessControlUrls,
}

#[derive(Debug, Clone, Copy)]
pub struct VodUrls {
    pub assets: &'static str,
    pub import_asset: &'static str,
    pub get_presigned_url: &'static str,
    pub export: &'static str,
}

#[derive(Debug, Clone, Copy)]
pub struct AccessControlUrls {
    pub signing_key: &'static str,
}

#[derive(Debug, Clone, Copy)]
pub struct TaskUrls {
    pub list_tasks: &'static str,
}

#[derive(Debug, Clone, Copy)]
pub struct AuthUrls {
    pub login: &'static str,
    pub info: &'static str,
}

impl LivepeerUrls {
    pub fn new() -> Self {
        let vod = VodUrls {
            assets: "/api/asset",
            import_asset: "/api/asset/import",
            get_presigned_url: "/api/asset/request-upload",
            export: "/api/asset/{{ASSET_ID}}/export",
        };

        let task = TaskUrls {
            list_tasks: "/api/task",
        };

        let auth = AuthUrls {
            login: "/api/user/token",
            info: "api/user/me",
        };

        let access_control = AccessControlUrls {
            signing_key: "/api/access-control/signing-key",
        };

        let urls = LivepeerUrls { vod, task, auth, access_control };
        urls
    }
}