warg_api/v1/
paths.rs

1//! The paths of the Warg REST API.
2
3use warg_crypto::hash::AnyHash;
4use warg_protocol::registry::{LogId, RecordId};
5
6/// The path of the "fetch logs" API.
7pub fn fetch_logs() -> &'static str {
8    "v1/fetch/logs"
9}
10
11/// The path of the "fetch checkpoint" API.
12pub fn fetch_checkpoint() -> &'static str {
13    "v1/fetch/checkpoint"
14}
15
16/// The path of the "fetch package names" API.
17pub fn fetch_package_names() -> &'static str {
18    "v1/fetch/names"
19}
20
21/// The path of the get ledger sources.
22pub fn ledger_sources() -> &'static str {
23    "v1/ledger"
24}
25
26/// The path of the "publish package record" API.
27pub fn publish_package_record(log_id: &LogId) -> String {
28    format!("v1/package/{log_id}/record")
29}
30
31/// The path to request download of content digest.
32pub fn content_sources(digest: &AnyHash) -> String {
33    format!("v1/content/{digest}")
34}
35
36/// The path for a package record.
37pub fn package_record(log_id: &LogId, record_id: &RecordId) -> String {
38    format!("v1/package/{log_id}/record/{record_id}")
39}
40
41/// The path for proving checkpoint consistency.
42pub fn prove_consistency() -> &'static str {
43    "v1/proof/consistency"
44}
45
46/// The path for proving checkpoint inclusion.
47pub fn prove_inclusion() -> &'static str {
48    "v1/proof/inclusion"
49}
50
51/// The path for verifying a checkpoint.
52pub fn verify_checkpoint() -> &'static str {
53    "v1/verify/checkpoint"
54}