mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-12 16:50:10 +00:00
add /api/v2/bulk endpoint
also, initial support for patch models in rust!
This commit is contained in:
parent
1776902000
commit
034865cc13
12 changed files with 715 additions and 32 deletions
|
|
@ -9,6 +9,8 @@ macro_rules! model {
|
|||
|
||||
model!(system);
|
||||
model!(system_config);
|
||||
model!(member);
|
||||
model!(group);
|
||||
|
||||
#[derive(serde::Serialize, Debug, Clone)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
|
|
@ -31,3 +33,30 @@ impl From<i32> for PrivacyLevel {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PrivacyLevel> for sea_query::Value {
|
||||
fn from(level: PrivacyLevel) -> sea_query::Value {
|
||||
match level {
|
||||
PrivacyLevel::Public => sea_query::Value::Int(Some(1)),
|
||||
PrivacyLevel::Private => sea_query::Value::Int(Some(2)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize, Debug, Clone)]
|
||||
pub enum ValidationError {
|
||||
Simple { key: String, value: String },
|
||||
}
|
||||
|
||||
impl ValidationError {
|
||||
fn new(key: &str) -> Self {
|
||||
Self::simple(key, "is invalid")
|
||||
}
|
||||
|
||||
fn simple(key: &str, value: &str) -> Self {
|
||||
Self::Simple {
|
||||
key: key.to_string(),
|
||||
value: value.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue