azure-devops 0.1.0

Idiomatic Rust client for Azure DevOps REST APIs
Documentation
pub mod content_type;
pub mod http_headers;
pub mod messages;
pub mod paths;
pub mod query_params;

pub const DEFAULT_API_VERSION: &str = "7.1";
pub const AZURE_DEVOPS_URL: &str = "https://dev.azure.com";
pub const NULL_JSON: &str = "null";
pub const USER_AGENT: &str = "azure-devops-rust-api";

/// JSON key for extracting error messages from Azure DevOps API error responses.
pub const JSON_MESSAGE_KEY: &str = "message";

pub use content_type::ct;
pub use http_headers::hdr;
pub use messages::msg;
pub use paths::ApiPath;
pub use query_params::query;

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn project_paths() {
        assert_eq!(ApiPath::projects(), "_apis/projects");
        assert_eq!(ApiPath::project("abc"), "_apis/projects/abc");
    }
    #[test]
    fn work_item_paths() {
        assert_eq!(ApiPath::work_item(42), "_apis/wit/workitems/42");
        assert_eq!(ApiPath::work_item_create("P", "Bug"), "P/_apis/wit/workitems/$Bug");
        assert_eq!(ApiPath::wiql("P"), "P/_apis/wit/wiql");
    }
    #[test]
    fn git_paths() {
        assert_eq!(ApiPath::repository("r"), "_apis/git/repositories/r");
        assert_eq!(ApiPath::prs("r"), "_apis/git/repositories/r/pullrequests");
    }
    #[test]
    fn build_paths() {
        assert_eq!(ApiPath::builds("P"), "P/_apis/build/builds");
        assert_eq!(
            ApiPath::build_badge("https://dev.azure.com/org/", 10),
            "https://dev.azure.com/org/_apis/public/build/definitions/10/badge"
        );
    }
    #[test]
    fn pipeline_paths() {
        assert_eq!(ApiPath::pipelines("P"), "P/_apis/pipelines");
    }
}