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::CCUResponseType::*;

pub enum CCUResponseType {
    Purge,
    PurgeStatus,
    QueueLength,
}

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

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

pub fn parse(resp: http::Response, ccu_type: CCUResponseType) -> ::EdgeGridResult {
    match ccu_type {
        Purge => {
            ::response::parse_response(resp,
                                       |b| ::response::gen_output::<PurgeResponse>(b),
                                       |b| ::response::gen_error_output(b))
        }
        PurgeStatus => {
            ::response::parse_response(resp,
                                       |b| ::response::gen_output::<PurgeStatusResponse>(b),
                                       |b| ::response::gen_error_output(b))
        }
        QueueLength => {
            ::response::parse_response(resp,
                                       |b| ::response::gen_output::<QueueLengthResponse>(b),
                                       |b| ::response::gen_error_output(b))
        }
    }
}