azure-devops 0.1.0

Idiomatic Rust client for Azure DevOps REST APIs
Documentation
use super::list_items_options::ListItemsOptions;
use crate::constants;

impl ListItemsOptions {
    pub fn to_query_params(&self) -> Vec<(String, String)> {
        let mut p = Vec::new();
        if let Some(ref r) = self.recursion_level {
            p.push((
                constants::query::RECURSION_LEVEL.into(),
                crate::util::enum_to_str(r),
            ));
        }
        if let Some(v) = self.include_content_metadata {
            p.push((constants::query::INCLUDE_CONTENT_MD.into(), v.to_string()));
        }
        if let Some(v) = self.include_links {
            p.push((constants::query::INCLUDE_LINKS.into(), v.to_string()));
        }
        if let Some(ref vd) = self.version_descriptor {
            if let Some(ref ver) = vd.version {
                p.push((
                    constants::query::VERSION_DOT.to_owned() + "version",
                    ver.clone(),
                ));
            }
            if let Some(ref vt) = vd.version_type {
                p.push((
                    constants::query::VERSION_DOT.to_owned() + "versionType",
                    crate::util::enum_to_str(vt),
                ));
            }
            if let Some(ref vo) = vd.version_options {
                p.push((
                    constants::query::VERSION_DOT.to_owned() + "versionOptions",
                    crate::util::enum_to_str(vo),
                ));
            }
        }
        p
    }
}