#open-rtb #native #ads #dynamic #deserialize #serialization

vizio-openrtb

OpenRTB v2.5 and OpenRTB Dynamic Native Ads v1.2 types for rust forked for Vizio

3 releases

Uses old Rust 2015

0.2.3 Mar 21, 2023
0.2.2 Mar 2, 2023
0.2.1 Mar 2, 2023

#1240 in Encoding

Download history 31/week @ 2024-04-03 141/week @ 2024-04-17

113 downloads per month

MIT/Apache

97KB
2K SLoC

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

openrtb

OpenRTB v2.5 and OpenRTB Dynamic Native Ads v1.2 types for rust. Handles (de)serialization to/from JSON.

Example

extern crate openrtb;
extern crate reqwest;

use std::error::Error;

use openrtb::current::{BidRequest, BidResponse};
use reqwest::StatusCode;

fn main() -> Result<(), Box<Error>> {
    let id = "f9b54eb8-6f3b-11e8-adc0-fa7ae01bbebc".to_string();
    let req = BidRequest::new(id);

    let client = reqwest::Client::new();
    let mut res = client
        .post("https://prebid.adnxs.com/pbs/v1/openrtb2/auction")
        .json(&req)
        .send()?;

    match res.status() {
        StatusCode::OK => {
            let res: BidResponse = res.json()?;
            println!("Received bids for req {}.", res.id);
        }
        StatusCode::NO_CONTENT => {
            println!("No bids.");
        }
        _ => {
            println!("Error: {:?}", res);
        }
    }

    Ok(())
}

Dependencies

~2–3MB
~58K SLoC