analytics/client.rs
1//! Interfaces to the Segment tracking API.
2
3use crate::message::Message;
4use failure::Error;
5
6/// `Client` is a trait representing the HTTP transport layer of the analytics library.
7pub trait Client {
8 /// Send a single message to Segment using the given write key.
9 ///
10 /// A `write_key` is an API key for Segment's tracking API. See [Segment's
11 /// documentation](https://segment.com/docs/guides/setup/how-do-i-find-my-write-key/)
12 /// for how to find this value.
13 fn send(&self, write_key: &str, msg: &Message) -> Result<(), Error>;
14}