Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Travis Build Status AppVeyor Build status Coverage Status crates.io docs.rs

GDPR Transparency and Consent Framework SDK Rust

Example Usage

Vendor List

extern crate gdpr_consent;
extern crate reqwest;

use gdpr_consent::vendor_list::VendorList;
use std::error::Error;

fn main() -> Result<(), Box<Error>> {
    let json = reqwest::get("https://vendorlist.consensu.org/vendorlist.json")?.text()?;
    let vendor_list: VendorList = json.parse()?;

    match vendor_list.vendors.get(&32) {
        Some(appnexus) => println!("{:?}", appnexus),
        None => println!("AppNexus was not present in the vendor list."),
    }

    Ok(())
}

Vendor Consent String

extern crate chrono;
extern crate gdpr_consent;

use gdpr_consent::vendor_consent::VendorConsent;
use std::error::Error;

fn main() -> Result<(), Box<Error>> {
    let vendor_consent = "BOEFEAyOEFEAyAHABDENAI4AAAB9vABAASA".parse()?;
    let VendorConsent::V1(mut v1) = vendor_consent;

    v1.last_updated = "2018-05-11T12:00:00.000Z".parse()?;
    v1.vendor_consent.remove(9); // remove consent for Vendor ID 10

    let serialized = VendorConsent::V1(v1).to_string()?;
    assert_eq!(serialized, "BOEFEAyONlzmAAHABDENAI4AAAB9vABgASABQA");

    Ok(())
}

About

GDPR Transparency and Consent Framework SDK for Rust

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages