libedgegrid 0.1.1

This library implements an Authentication handler for the Akamai OPEN EdgeGrid Authentication scheme in Rust
use curl::http;
use std::fmt;

use self::AlertResponseType::*;

pub enum AlertResponseType {
    Get,
    GetById,
    Post,
}

#[cfg(feature = "serde_macros")]
include!("resp.rs.in");

#[cfg(not(feature = "serde_macros"))]
include!(concat!(env!("OUT_DIR"), "/luna/alert/resp.rs"));

pub fn parse(resp: http::Response, resp_type: AlertResponseType) -> ::EdgeGridResult {
    match resp_type {
        Get | Post => {
            ::response::parse_response(resp,
                                       |b| ::response::gen_output::<AlertsResponse>(b),
                                       |b| ::response::gen_error_output(b))
        }
        GetById => {
            ::response::parse_response(resp,
                                       |b| ::response::gen_output::<AlertDetailsResponse>(b),
                                       |b| ::response::gen_error_output(b))
        }
    }
}