Add constructors for ID types
This commit is contained in:
parent
876ac3b985
commit
fcc2035b46
|
@ -65,6 +65,12 @@ impl AsRef<str> for AccountId {
|
|||
}
|
||||
}
|
||||
|
||||
impl AccountId {
|
||||
pub fn new(value: impl Into<String>) -> Self {
|
||||
Self(value.into())
|
||||
}
|
||||
}
|
||||
|
||||
/// A single name: value pair from a user's profile
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)]
|
||||
pub struct MetadataField {
|
||||
|
|
|
@ -35,6 +35,12 @@ impl AsRef<str> for AttachmentId {
|
|||
}
|
||||
}
|
||||
|
||||
impl AttachmentId {
|
||||
pub fn new(value: impl Into<String>) -> Self {
|
||||
Self(value.into())
|
||||
}
|
||||
}
|
||||
|
||||
/// Information about the attachment itself.
|
||||
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
|
||||
pub struct Meta {
|
||||
|
|
|
@ -62,6 +62,12 @@ impl AsRef<str> for FilterId {
|
|||
}
|
||||
}
|
||||
|
||||
impl FilterId {
|
||||
pub fn new(value: impl Into<String>) -> Self {
|
||||
Self(value.into())
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents the various types of Filter contexts
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
|
|
|
@ -33,6 +33,12 @@ impl AsRef<str> for NotificationId {
|
|||
}
|
||||
}
|
||||
|
||||
impl NotificationId {
|
||||
pub fn new(value: impl Into<String>) -> Self {
|
||||
Self(value.into())
|
||||
}
|
||||
}
|
||||
|
||||
/// The type of notification.
|
||||
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
|
|
|
@ -37,6 +37,12 @@ impl AsRef<str> for SubscriptionId {
|
|||
}
|
||||
}
|
||||
|
||||
impl SubscriptionId {
|
||||
pub fn new(value: impl Into<String>) -> Self {
|
||||
Self(value.into())
|
||||
}
|
||||
}
|
||||
|
||||
pub mod add_subscription {
|
||||
use serde::Serialize;
|
||||
|
||||
|
|
|
@ -42,3 +42,9 @@ impl AsRef<str> for RelationshipId {
|
|||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl RelationshipId {
|
||||
pub fn new(value: impl Into<String>) -> Self {
|
||||
Self(value.into())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,3 +21,9 @@ impl AsRef<str> for ReportId {
|
|||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl ReportId {
|
||||
pub fn new(value: impl Into<String>) -> Self {
|
||||
Self(value.into())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,6 +76,12 @@ impl AsRef<str> for StatusId {
|
|||
}
|
||||
}
|
||||
|
||||
impl StatusId {
|
||||
pub fn new(value: impl Into<String>) -> Self {
|
||||
Self(value.into())
|
||||
}
|
||||
}
|
||||
|
||||
/// A mention of another user.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct Mention {
|
||||
|
|
Loading…
Reference in New Issue