use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(test, derive(Default))]
pub struct ActivityEvent {
#[serde(rename = "$id")]
pub id: String,
#[serde(rename = "actorType")]
pub actor_type: String,
#[serde(rename = "actorId")]
pub actor_id: String,
#[serde(rename = "actorEmail")]
pub actor_email: String,
#[serde(rename = "actorName")]
pub actor_name: String,
#[serde(rename = "resourceParent")]
pub resource_parent: String,
#[serde(rename = "resourceType")]
pub resource_type: String,
#[serde(rename = "resourceId")]
pub resource_id: String,
#[serde(rename = "resource")]
pub resource: String,
#[serde(rename = "event")]
pub event: String,
#[serde(rename = "userAgent")]
pub user_agent: String,
#[serde(rename = "ip")]
pub ip: String,
#[serde(rename = "mode")]
pub mode: String,
#[serde(rename = "country")]
pub country: String,
#[serde(rename = "continentCode")]
pub continent_code: String,
#[serde(rename = "city")]
pub city: String,
#[serde(rename = "subdivisions")]
pub subdivisions: String,
#[serde(rename = "isp")]
pub isp: String,
#[serde(rename = "autonomousSystemNumber")]
pub autonomous_system_number: String,
#[serde(rename = "autonomousSystemOrganization")]
pub autonomous_system_organization: String,
#[serde(rename = "connectionType")]
pub connection_type: String,
#[serde(rename = "connectionUsageType")]
pub connection_usage_type: String,
#[serde(rename = "connectionOrganization")]
pub connection_organization: String,
#[serde(rename = "time")]
pub time: String,
#[serde(rename = "projectId")]
pub project_id: String,
#[serde(rename = "teamId")]
pub team_id: String,
#[serde(rename = "hostname")]
pub hostname: String,
#[serde(rename = "sdk")]
pub sdk: String,
#[serde(rename = "sdkVersion")]
pub sdk_version: String,
}
impl ActivityEvent {
pub fn id(&self) -> &String {
&self.id
}
pub fn actor_type(&self) -> &String {
&self.actor_type
}
pub fn actor_id(&self) -> &String {
&self.actor_id
}
pub fn actor_email(&self) -> &String {
&self.actor_email
}
pub fn actor_name(&self) -> &String {
&self.actor_name
}
pub fn resource_parent(&self) -> &String {
&self.resource_parent
}
pub fn resource_type(&self) -> &String {
&self.resource_type
}
pub fn resource_id(&self) -> &String {
&self.resource_id
}
pub fn resource(&self) -> &String {
&self.resource
}
pub fn event(&self) -> &String {
&self.event
}
pub fn user_agent(&self) -> &String {
&self.user_agent
}
pub fn ip(&self) -> &String {
&self.ip
}
pub fn mode(&self) -> &String {
&self.mode
}
pub fn country(&self) -> &String {
&self.country
}
pub fn continent_code(&self) -> &String {
&self.continent_code
}
pub fn city(&self) -> &String {
&self.city
}
pub fn subdivisions(&self) -> &String {
&self.subdivisions
}
pub fn isp(&self) -> &String {
&self.isp
}
pub fn autonomous_system_number(&self) -> &String {
&self.autonomous_system_number
}
pub fn autonomous_system_organization(&self) -> &String {
&self.autonomous_system_organization
}
pub fn connection_type(&self) -> &String {
&self.connection_type
}
pub fn connection_usage_type(&self) -> &String {
&self.connection_usage_type
}
pub fn connection_organization(&self) -> &String {
&self.connection_organization
}
pub fn time(&self) -> &String {
&self.time
}
pub fn project_id(&self) -> &String {
&self.project_id
}
pub fn team_id(&self) -> &String {
&self.team_id
}
pub fn hostname(&self) -> &String {
&self.hostname
}
pub fn sdk(&self) -> &String {
&self.sdk
}
pub fn sdk_version(&self) -> &String {
&self.sdk_version
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_activity_event_creation() {
let _model = <ActivityEvent as Default>::default();
let _ = _model.id();
let _ = _model.actor_type();
let _ = _model.actor_id();
let _ = _model.actor_email();
let _ = _model.actor_name();
let _ = _model.resource_parent();
let _ = _model.resource_type();
let _ = _model.resource_id();
let _ = _model.resource();
let _ = _model.event();
let _ = _model.user_agent();
let _ = _model.ip();
let _ = _model.mode();
let _ = _model.country();
let _ = _model.continent_code();
let _ = _model.city();
let _ = _model.subdivisions();
let _ = _model.isp();
let _ = _model.autonomous_system_number();
let _ = _model.autonomous_system_organization();
let _ = _model.connection_type();
let _ = _model.connection_usage_type();
let _ = _model.connection_organization();
let _ = _model.time();
let _ = _model.project_id();
let _ = _model.team_id();
let _ = _model.hostname();
let _ = _model.sdk();
let _ = _model.sdk_version();
}
#[test]
fn test_activity_event_serialization() {
let model = <ActivityEvent as Default>::default();
let json = serde_json::to_string(&model);
assert!(json.is_ok());
let deserialized: Result<ActivityEvent, _> = serde_json::from_str(&json.unwrap());
assert!(deserialized.is_ok());
}
}