livepeer_rs/api/
urls.rs

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

#[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,
    pub list_webhooks: &'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,
}

#[derive(Debug, Clone, Copy)]
pub struct PlaybackUrls {
    pub get_playback_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",
            list_webhooks: "/api/webhook",
        };

        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 playback = PlaybackUrls {
            get_playback_info: "/api/playback",
        };

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