Skip to main content

neptunium_http/endpoints/guild/stickers/
update_guild_sticker.rs

1use bon::Builder;
2use neptunium_model::{
3    guild::properties::GuildSticker,
4    id::{
5        Id,
6        marker::{GuildMarker, StickerMarker},
7    },
8};
9use reqwest::Method;
10use serde::Serialize;
11
12use crate::{endpoints::Endpoint, request::Request};
13
14#[derive(Builder, Serialize, Clone, Debug)]
15pub struct UpdateGuildStickerBody {
16    #[builder(into)]
17    pub name: String,
18    #[serde(skip_serializing_if = "Option::is_none")]
19    #[builder(into)]
20    pub description: Option<String>,
21    /// Up to 10 tags for autocomplete/suggestions.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    #[builder(into)]
24    pub tags: Option<Vec<String>>,
25}
26
27#[derive(Builder, Clone, Debug)]
28pub struct UpdateGuildSticker {
29    pub guild_id: Id<GuildMarker>,
30    pub sticker_id: Id<StickerMarker>,
31    pub body: UpdateGuildStickerBody,
32}
33
34impl Endpoint for UpdateGuildSticker {
35    type Response = GuildSticker;
36
37    fn into_request(self) -> crate::request::Request {
38        Request::builder()
39            .method(Method::PATCH)
40            .body(serde_json::to_string(&self.body).unwrap())
41            .path(format!(
42                "/guilds/{}/stickers/{}",
43                self.guild_id, self.sticker_id
44            ))
45            .build()
46    }
47}