forked from jmug/stoatchat
inital webhook support
This commit is contained in:
@@ -117,9 +117,12 @@ pub struct Message {
|
||||
pub nonce: Option<String>,
|
||||
/// Id of the channel this message was sent in
|
||||
pub channel: String,
|
||||
/// Id of the user that sent this message
|
||||
pub author: String,
|
||||
|
||||
/// Id of the user that sent this message, will be none when a webhook sent the message
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub author: Option<String>,
|
||||
/// Id of the webhook that sent this message, mutually exclusive with `author`
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub webhook: Option<String>,
|
||||
/// Message content
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub content: Option<String>,
|
||||
|
||||
33
crates/quark/src/models/channels/webhook.rs
Normal file
33
crates/quark/src/models/channels/webhook.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
use crate::models::File;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Respresents a webhook
|
||||
#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, OptionalStruct)]
|
||||
#[optional_derive(Serialize, Deserialize, JsonSchema, Debug, Default, Clone)]
|
||||
#[optional_name = "PartialWebhook"]
|
||||
#[opt_skip_serializing_none]
|
||||
#[opt_some_priority]
|
||||
|
||||
pub struct Webhook {
|
||||
/// Unique Id
|
||||
#[serde(rename = "_id")]
|
||||
pub id: String,
|
||||
|
||||
/// The name of the webhook
|
||||
pub name: String,
|
||||
|
||||
/// The avatar of the webhook
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub avatar: Option<File>,
|
||||
|
||||
/// The channel this webhook belongs to
|
||||
pub channel: String,
|
||||
|
||||
/// The private token for the webhook
|
||||
pub token: String
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone)]
|
||||
pub enum FieldsWebhook {
|
||||
Avatar
|
||||
}
|
||||
@@ -13,6 +13,7 @@ mod channels {
|
||||
pub mod channel_invite;
|
||||
pub mod channel_unread;
|
||||
pub mod message;
|
||||
pub mod webhook;
|
||||
}
|
||||
|
||||
mod servers {
|
||||
@@ -47,3 +48,4 @@ pub use server_member::Member;
|
||||
pub use simple::SimpleModel;
|
||||
pub use user::User;
|
||||
pub use user_settings::UserSettings;
|
||||
pub use webhook::Webhook;
|
||||
|
||||
Reference in New Issue
Block a user