-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
update_bot
endpoint only callable by bot owner (#7073)
- Loading branch information
Showing
14 changed files
with
285 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
backend/canisters/user_index/api/src/updates/update_bot.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use candid::CandidType; | ||
use serde::{Deserialize, Serialize}; | ||
use ts_export::ts_export; | ||
use types::{OptionUpdate, UserId}; | ||
|
||
#[ts_export(user_index, update_bot)] | ||
#[derive(CandidType, Serialize, Deserialize, Debug)] | ||
pub struct Args { | ||
pub bot_id: UserId, | ||
pub owner: Option<UserId>, | ||
pub name: Option<String>, | ||
#[ts(as = "types::OptionUpdateString")] | ||
pub avatar: OptionUpdate<String>, // Image as a data URL | ||
pub endpoint: Option<String>, | ||
} | ||
|
||
#[ts_export(user_index, update_bot)] | ||
#[derive(CandidType, Serialize, Deserialize, Debug)] | ||
pub enum Response { | ||
Success, | ||
NameInvalid, | ||
NameAlreadyExists, | ||
AvatarInvalid, | ||
EndpointInvalid, | ||
BotNotFound, | ||
BotSuspended, | ||
NotAuthorised, | ||
OwnerNotFound, | ||
OwnerSuspended, | ||
NewOwnerNotFound, | ||
NewOwnerSuspended, | ||
DefinitionNotFound, | ||
DefinitionInvalid, | ||
DescriptionTooLong, | ||
TooManyCommands, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.