pub struct UpdateLinkInput {
pub target_url: Option<Option<String>>,
pub expires_at: Option<Option<i64>>,
pub is_active: Option<Option<bool>>,
pub seo_title: Option<Option<String>>,
pub seo_description: Option<Option<String>>,
pub seo_image_url: Option<Option<String>>,
pub seo_canonical_url: Option<Option<String>>,
pub seo_noindex: Option<Option<bool>>,
}Expand description
Body for PATCH /v1/links/:code.
Every field uses the Option<Option<T>> pattern:
- The outer
Nonemeans “leave the field alone” — serde skips serializing. Some(None)serializes as JSONnull— explicit “clear the value”.Some(Some(value))serializes asvalue— the normal set case.
Builder methods cover the common cases — set_* for “Some(Some(value))”
and clear_* for “Some(None)”.
The empty payload is rejected client-side (UpdateLinkInput::is_empty)
and the crate::Links::update call returns a bad_request config error
without hitting the server.
Fields§
§target_url: Option<Option<String>>New destination URL.
expires_at: Option<Option<i64>>New expiration (unix seconds) or explicit null to clear.
is_active: Option<Option<bool>>Toggle whether the link is active.
seo_title: Option<Option<String>>New SEO title, or explicit null to clear.
seo_description: Option<Option<String>>New SEO description, or explicit null to clear.
seo_image_url: Option<Option<String>>New SEO image URL, or explicit null to clear.
seo_canonical_url: Option<Option<String>>New SEO canonical URL, or explicit null to clear.
seo_noindex: Option<Option<bool>>Toggle the noindex flag.
Implementations§
Source§impl UpdateLinkInput
impl UpdateLinkInput
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
true when no field has been set — calling update with this would
be rejected client-side.
Sourcepub fn set_target_url(self, target_url: impl Into<String>) -> Self
pub fn set_target_url(self, target_url: impl Into<String>) -> Self
Set a new target_url.
Sourcepub fn set_expires_at(self, expires_at: i64) -> Self
pub fn set_expires_at(self, expires_at: i64) -> Self
Set a new expires_at.
Sourcepub fn clear_expires_at(self) -> Self
pub fn clear_expires_at(self) -> Self
Clear an existing expiration — sends expires_at: null.
Sourcepub fn set_is_active(self, is_active: bool) -> Self
pub fn set_is_active(self, is_active: bool) -> Self
Toggle whether the link is active.
Sourcepub fn set_seo_title(self, seo_title: impl Into<String>) -> Self
pub fn set_seo_title(self, seo_title: impl Into<String>) -> Self
Set a new SEO title.
Sourcepub fn clear_seo_title(self) -> Self
pub fn clear_seo_title(self) -> Self
Clear an existing SEO title — sends seo_title: null.
Sourcepub fn set_seo_description(self, seo_description: impl Into<String>) -> Self
pub fn set_seo_description(self, seo_description: impl Into<String>) -> Self
Set a new SEO description.
Sourcepub fn clear_seo_description(self) -> Self
pub fn clear_seo_description(self) -> Self
Clear an existing SEO description.
Sourcepub fn set_seo_image_url(self, seo_image_url: impl Into<String>) -> Self
pub fn set_seo_image_url(self, seo_image_url: impl Into<String>) -> Self
Set a new SEO image URL.
Sourcepub fn clear_seo_image_url(self) -> Self
pub fn clear_seo_image_url(self) -> Self
Clear an existing SEO image URL.
Sourcepub fn set_seo_canonical_url(self, seo_canonical_url: impl Into<String>) -> Self
pub fn set_seo_canonical_url(self, seo_canonical_url: impl Into<String>) -> Self
Set a new SEO canonical URL.
Sourcepub fn clear_seo_canonical_url(self) -> Self
pub fn clear_seo_canonical_url(self) -> Self
Clear an existing SEO canonical URL.
Sourcepub fn set_seo_noindex(self, seo_noindex: bool) -> Self
pub fn set_seo_noindex(self, seo_noindex: bool) -> Self
Toggle the noindex flag.
Trait Implementations§
Source§impl Clone for UpdateLinkInput
impl Clone for UpdateLinkInput
Source§fn clone(&self) -> UpdateLinkInput
fn clone(&self) -> UpdateLinkInput
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UpdateLinkInput
impl Debug for UpdateLinkInput
Source§impl Default for UpdateLinkInput
impl Default for UpdateLinkInput
Source§fn default() -> UpdateLinkInput
fn default() -> UpdateLinkInput
Source§impl<'de> Deserialize<'de> for UpdateLinkInput
impl<'de> Deserialize<'de> for UpdateLinkInput
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for UpdateLinkInput
Source§impl PartialEq for UpdateLinkInput
impl PartialEq for UpdateLinkInput
Source§fn eq(&self, other: &UpdateLinkInput) -> bool
fn eq(&self, other: &UpdateLinkInput) -> bool
self and other values to be equal, and is used by ==.