1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::one_api::{Channel, Result};
use serde::Serialize;

/// Message sent to the gateway
#[derive(Serialize, Debug)]
pub struct Message {
  channel: Channel,
  to: String,
  content: String,
}

impl Message {
  pub fn new(channel: Channel, to: impl ToString, content: impl ToString) -> Result<Self> {
    Ok(Self {
      channel,
      to: to.to_string(),
      content: content.to_string(),
    })
  }
}