squarecloud 0.2.0

Async Rust client for the SquareCloud API
Documentation
use super::Endpoint;
use reqwest::Method;

#[cfg(feature = "test-utils")]
inventory::submit! {
    crate::EndpointSpec {
    method: "get",
    path: "/apps/{app_id}/snapshots",
    domain: "SnapshotErrorCode",
    known_code: crate::errors::code_is_known::<crate::errors::SnapshotErrorCode>,
    }
}

#[cfg(feature = "test-utils")]
inventory::submit! {
    crate::EndpointSpec {
    method: "post",
    path: "/apps/{app_id}/snapshots",
    domain: "SnapshotErrorCode",
    known_code: crate::errors::code_is_known::<crate::errors::SnapshotErrorCode>,
    }
}

#[cfg(feature = "test-utils")]
inventory::submit! {
    crate::EndpointSpec {
    method: "post",
    path: "/apps/{app_id}/snapshots/restore",
    domain: "SnapshotErrorCode",
    known_code: crate::errors::code_is_known::<crate::errors::SnapshotErrorCode>,
    }
}

impl Endpoint {
    pub(crate) fn list_app_snapshots(app_id: &str) -> Endpoint {
        Self::builder("/apps/{app_id}/snapshots", Method::GET)
            .param("app_id", app_id)
            .build()
    }

    pub(crate) fn app_create_snapshot(app_id: &str) -> Endpoint {
        Self::builder("/apps/{app_id}/snapshots", Method::POST)
            .param("app_id", app_id)
            .build()
    }

    pub(crate) fn restore_app_snapshot(app_id: &str) -> Endpoint {
        Self::builder("/apps/{app_id}/snapshots/restore", Method::POST)
            .param("app_id", app_id)
            .build()
    }
}