use chrono::{DateTime, Utc};
use reqwest::{Method, RequestBuilder};
use serde::Deserialize;
use crate::{Auth0Client, Auth0RequestBuilder};
#[derive(Debug, Clone, Deserialize)]
pub struct UserEnrollment {
pub id: String,
pub status: String,
#[serde(rename = "type")]
pub kind: String,
pub name: String,
pub identifier: String,
pub phone_number: String,
pub auth_method: String,
pub enrolled_at: DateTime<Utc>,
pub last_auth: DateTime<Utc>,
}
pub struct UserEnrollmentsGet {
id: String,
}
impl UserEnrollmentsGet {
pub fn new<S: AsRef<str>>(id: S) -> Self {
Self {
id: id.as_ref().to_owned(),
}
}
}
impl Auth0RequestBuilder for UserEnrollmentsGet {
fn build(&self, client: &Auth0Client) -> RequestBuilder {
client.begin(
Method::GET,
&format!("api/v2/users/{}/enrollments", self.id),
)
}
}