Created
April 5, 2023 08:53
-
-
Save infu/9e856adea2e79bd6fd9af3494739072b to your computer and use it in GitHub Desktop.
OC UserIndex
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
type AccessorId = principal; | |
type AccountIdentifier = blob; | |
type BlockIndex = nat64; | |
type CanisterId = principal; | |
type ChatId = CanisterId; | |
type Cycles = nat; | |
type EventIndex = nat32; | |
type FileId = nat; | |
type Hash = blob; | |
type ICP = Tokens; | |
type Memo = nat64; | |
type MessageId = nat; | |
type MessageIndex = nat32; | |
type Milliseconds = nat64; | |
type NnsNeuronId = nat64; | |
type ProposalId = nat64; | |
type SnsNeuronId = blob; | |
type TimestampMillis = nat64; | |
type TimestampNanos = nat64; | |
type Tokens = record { e8s: nat64; }; | |
type TransactionHash = blob; | |
type UserId = CanisterId; | |
type AddedToGroupNotification = | |
record { | |
chat_id: ChatId; | |
group_name: text; | |
added_by: UserId; | |
added_by_name: text; | |
timestamp: TimestampMillis; | |
}; | |
type AudioContent = | |
record { | |
caption: opt text; | |
mime_type: text; | |
blob_reference: opt BlobReference; | |
}; | |
type Avatar = | |
record { | |
id: nat; | |
mime_type: text; | |
data: blob; | |
}; | |
type BlobReference = | |
record { | |
canister_id: CanisterId; | |
blob_id: nat; | |
}; | |
type CanisterUpgradeStatus = | |
variant { | |
InProgress; | |
NotRequired; | |
}; | |
type CanisterWasm = | |
record { | |
module: vec nat8; | |
version: Version; | |
compressed: bool; | |
}; | |
type ChatMetrics = | |
record { | |
text_messages: nat64; | |
image_messages: nat64; | |
video_messages: nat64; | |
audio_messages: nat64; | |
file_messages: nat64; | |
polls: nat64; | |
poll_votes: nat64; | |
cycles_messages: nat64; | |
icp_messages: nat64; | |
sns1_messages: nat64; | |
ckbtc_messages: nat64; | |
chat_messages: nat64; | |
deleted_messages: nat64; | |
giphy_messages: nat64; | |
prize_messages: nat64; | |
prize_winner_messages: nat64; | |
replies: nat64; | |
edits: nat64; | |
reactions: nat64; | |
proposals: nat64; | |
reported_messages: nat64; | |
last_active: TimestampMillis; | |
}; | |
type CryptoContent = | |
record { | |
recipient: UserId; | |
transfer: CryptoTransaction; | |
caption: opt text; | |
}; | |
type DeletedContent = | |
record { | |
deleted_by: UserId; | |
timestamp: TimestampMillis; | |
}; | |
type DirectChatCreated = | |
record { | |
}; | |
type DirectChatEventWrapper = | |
record { | |
index: EventIndex; | |
timestamp: TimestampMillis; | |
correlation_id: nat64; | |
expires_at: opt TimestampMillis; | |
event: ChatEvent; | |
}; | |
type DirectChatSummary = | |
record { | |
them: UserId; | |
latest_message: MessageEventWrapper; | |
latest_event_index: EventIndex; | |
date_created: TimestampMillis; | |
read_by_me_up_to: opt MessageIndex; | |
read_by_them_up_to: opt MessageIndex; | |
notifications_muted: bool; | |
metrics: ChatMetrics; | |
my_metrics: ChatMetrics; | |
archived: bool; | |
events_ttl: opt Milliseconds; | |
expired_messages: vec MessageIndexRange; | |
}; | |
type DirectChatSummaryUpdates = | |
record { | |
chat_id: ChatId; | |
latest_message: opt MessageEventWrapper; | |
latest_event_index: opt EventIndex; | |
read_by_me_up_to: opt MessageIndex; | |
read_by_them_up_to: opt MessageIndex; | |
notifications_muted: opt bool; | |
affected_events: vec EventIndex; | |
updated_events: vec record { nat32; nat64 }; | |
metrics: opt ChatMetrics; | |
my_metrics: opt ChatMetrics; | |
archived: opt bool; | |
events_ttl: EventsTimeToLiveUpdate; | |
newly_expired_messages: vec MessageIndexRange; | |
}; | |
type DirectMessageNotification = | |
record { | |
sender: UserId; | |
thread_root_message_index: opt MessageIndex; | |
sender_name: text; | |
message: MessageEventWrapper; | |
}; | |
type DirectReactionAddedNotification = | |
record { | |
them: UserId; | |
username: text; | |
message: MessageEventWrapper; | |
reaction: text; | |
timestamp: TimestampMillis; | |
}; | |
type FieldTooShortResult = | |
record { | |
length_provided: nat32; | |
min_length: nat32; | |
}; | |
type FieldTooLongResult = | |
record { | |
length_provided: nat32; | |
max_length: nat32; | |
}; | |
type FileContent = | |
record { | |
name: text; | |
caption: opt text; | |
mime_type: text; | |
file_size: nat32; | |
blob_reference: opt BlobReference; | |
}; | |
type GroupChatCreated = | |
record { | |
name: text; | |
description: text; | |
created_by: UserId; | |
}; | |
type ChatEvent = | |
variant { | |
Message: Message; | |
GroupChatCreated: GroupChatCreated; | |
DirectChatCreated: DirectChatCreated; | |
GroupNameChanged: GroupNameChanged; | |
GroupDescriptionChanged: GroupDescriptionChanged; | |
AvatarChanged: AvatarChanged; | |
OwnershipTransferred: OwnershipTransferred; | |
ParticipantsAdded: ParticipantsAdded; | |
ParticipantsRemoved: ParticipantsRemoved; | |
ParticipantJoined: ParticipantJoined; | |
ParticipantLeft: ParticipantLeft; | |
ParticipantAssumesSuperAdmin: ParticipantAssumesSuperAdmin; | |
ParticipantDismissedAsSuperAdmin: ParticipantDismissedAsSuperAdmin; | |
ParticipantRelinquishesSuperAdmin: ParticipantRelinquishesSuperAdmin; | |
RoleChanged: RoleChanged; | |
MessageEdited: UpdatedMessage; | |
MessageDeleted: UpdatedMessage; | |
MessageUndeleted: UpdatedMessage; | |
MessageReactionAdded: UpdatedMessage; | |
MessageReactionRemoved: UpdatedMessage; | |
UsersBlocked: UsersBlocked; | |
UsersUnblocked: UsersUnblocked; | |
MessagePinned: MessagePinned; | |
MessageUnpinned: MessageUnpinned; | |
PollVoteRegistered: UpdatedMessage; | |
PollVoteDeleted: UpdatedMessage; | |
PollEnded: PollEnded; | |
PermissionsChanged: PermissionsChanged; | |
GroupVisibilityChanged: GroupVisibilityChanged; | |
GroupInviteCodeChanged: GroupInviteCodeChanged; | |
ThreadUpdated: ThreadUpdated; | |
ProposalsUpdated: ProposalsUpdated; | |
GroupRulesChanged: GroupRulesChanged; | |
ChatFrozen: ChatFrozen; | |
ChatUnfrozen: ChatUnfrozen; | |
EventsTimeToLiveUpdated: EventsTimeToLiveUpdated; | |
}; | |
type ChatEventWrapper = | |
record { | |
index: EventIndex; | |
timestamp: TimestampMillis; | |
correlation_id: nat64; | |
expires_at: opt TimestampMillis; | |
event: ChatEvent; | |
}; | |
type GroupChatSummary = | |
record { | |
chat_id: ChatId; | |
last_updated: TimestampMillis; | |
name: text; | |
description: text; | |
subtype: opt GroupSubtype; | |
avatar_id: opt nat; | |
is_public: bool; | |
history_visible_to_new_joiners: bool; | |
min_visible_event_index: EventIndex; | |
min_visible_message_index: MessageIndex; | |
latest_message: opt MessageEventWrapper; | |
latest_event_index: EventIndex; | |
joined: TimestampMillis; | |
read_by_me_up_to: opt MessageIndex; | |
notifications_muted: bool; | |
participant_count: nat32; | |
role: Role; | |
mentions: vec Mention; | |
permissions: GroupPermissions; | |
metrics: ChatMetrics; | |
my_metrics: ChatMetrics; | |
latest_threads: vec ThreadSyncDetails; | |
archived: bool; | |
frozen: opt FrozenGroupInfo; | |
wasm_version: Version; | |
date_last_pinned: opt TimestampMillis; | |
date_read_pinned: opt TimestampMillis; | |
events_ttl: opt Milliseconds; | |
expired_messages: vec MessageIndexRange; | |
next_message_expiry: opt TimestampMillis; | |
}; | |
type GroupCanisterGroupChatSummary = | |
record { | |
chat_id: ChatId; | |
last_updated: TimestampMillis; | |
name: text; | |
description: text; | |
subtype: opt GroupSubtype; | |
avatar_id: opt nat; | |
is_public: bool; | |
history_visible_to_new_joiners: bool; | |
min_visible_event_index: EventIndex; | |
min_visible_message_index: MessageIndex; | |
latest_message: opt MessageEventWrapper; | |
latest_event_index: EventIndex; | |
joined: TimestampMillis; | |
participant_count: nat32; | |
role: Role; | |
mentions: vec Mention; | |
permissions: GroupPermissions; | |
notifications_muted: bool; | |
metrics: ChatMetrics; | |
my_metrics: ChatMetrics; | |
latest_threads: vec GroupCanisterThreadDetails; | |
frozen: opt FrozenGroupInfo; | |
wasm_version: Version; | |
date_last_pinned: opt TimestampMillis; | |
events_ttl: opt Milliseconds; | |
expired_messages: vec MessageIndexRange; | |
next_message_expiry: opt TimestampMillis; | |
}; | |
type GroupCanisterGroupChatSummaryUpdates = | |
record { | |
chat_id: ChatId; | |
last_updated: TimestampMillis; | |
name: opt text; | |
description: opt text; | |
subtype: GroupSubtypeUpdate; | |
avatar_id: AvatarIdUpdate; | |
latest_message: opt MessageEventWrapper; | |
latest_event_index: opt EventIndex; | |
participant_count: opt nat32; | |
role: opt Role; | |
mentions: vec Mention; | |
permissions: opt GroupPermissions; | |
affected_events: vec EventIndex; | |
updated_events: vec record { opt nat32; nat32; nat64 }; | |
metrics: opt ChatMetrics; | |
my_metrics: opt ChatMetrics; | |
is_public: opt bool; | |
latest_threads: vec GroupCanisterThreadDetails; | |
notifications_muted: opt bool; | |
frozen: FrozenGroupUpdate; | |
wasm_version: opt Version; | |
date_last_pinned: opt TimestampMillis; | |
events_ttl: EventsTimeToLiveUpdate; | |
newly_expired_messages: vec MessageIndexRange; | |
next_message_expiry: TimestampUpdate; | |
}; | |
type GroupDescriptionChanged = | |
record { | |
new_description: text; | |
previous_description: text; | |
changed_by: UserId; | |
}; | |
type AvatarChanged = | |
record { | |
new_avatar: opt nat; | |
previous_avatar: opt nat; | |
changed_by: UserId; | |
}; | |
type AvatarUpdate = | |
variant { | |
NoChange; | |
SetToNone; | |
SetToSome: Avatar; | |
}; | |
type TextUpdate = | |
variant { | |
NoChange; | |
SetToNone; | |
SetToSome: text; | |
}; | |
type AvatarIdUpdate = | |
variant { | |
NoChange; | |
SetToNone; | |
SetToSome: nat; | |
}; | |
type TimestampUpdate = | |
variant { | |
NoChange; | |
SetToNone; | |
SetToSome: TimestampMillis; | |
}; | |
type Mention = | |
record { | |
thread_root_message_index: opt MessageIndex; | |
message_id: MessageId; | |
message_index: MessageIndex; | |
event_index: EventIndex; | |
mentioned_by: UserId; | |
}; | |
type Message = | |
record { | |
message_index: MessageIndex; | |
message_id: MessageId; | |
sender: UserId; | |
content: MessageContent; | |
replies_to: opt ReplyContext; | |
reactions: vec record { text; vec UserId; }; | |
thread_summary: opt ThreadSummary; | |
edited: bool; | |
forwarded: bool; | |
last_updated: opt TimestampMillis; | |
}; | |
type MessageEventWrapper = | |
record { | |
index: EventIndex; | |
timestamp: TimestampMillis; | |
correlation_id: nat64; | |
expires_at: opt TimestampMillis; | |
event: Message; | |
}; | |
type FrozenGroupInfo = | |
record { | |
timestamp: TimestampMillis; | |
frozen_by: UserId; | |
reason: opt text; | |
}; | |
type FrozenGroupUpdate = | |
variant { | |
NoChange; | |
SetToNone; | |
SetToSome: FrozenGroupInfo; | |
}; | |
type GroupMessageNotification = | |
record { | |
chat_id: ChatId; | |
thread_root_message_index: opt MessageIndex; | |
group_name: text; | |
sender: UserId; | |
sender_name: text; | |
message: MessageEventWrapper; | |
mentioned: vec User; | |
hide: bool; | |
}; | |
type GroupNameChanged = | |
record { | |
new_name: text; | |
previous_name: text; | |
changed_by: UserId; | |
}; | |
type GroupReactionAddedNotification = | |
record { | |
chat_id: ChatId; | |
thread_root_message_index: opt MessageIndex; | |
group_name: text; | |
added_by: UserId; | |
added_by_name: text; | |
message: MessageEventWrapper; | |
reaction: text; | |
timestamp: TimestampMillis; | |
}; | |
type GroupReplyContext = | |
record { | |
event_index: EventIndex; | |
}; | |
type GroupSubtype = | |
variant { | |
GovernanceProposals: GovernanceProposalsSubtype; | |
}; | |
type GroupSubtypeUpdate = | |
variant { | |
NoChange; | |
SetToNone; | |
SetToSome: GroupSubtype; | |
}; | |
type GovernanceProposalsSubtype = | |
record { | |
is_nns: bool; | |
governance_canister_id: CanisterId; | |
}; | |
type MessagePinned = | |
record { | |
message_index: MessageIndex; | |
pinned_by: UserId; | |
}; | |
type MessageUnpinned = | |
record { | |
message_index: MessageIndex; | |
unpinned_by: UserId; | |
due_to_message_deleted: bool; | |
}; | |
type PinnedMessageUpdate = | |
variant { | |
NoChange; | |
SetToNone; | |
SetToSome: MessageIndex; | |
}; | |
type PublicGroupSummary = | |
record { | |
chat_id: ChatId; | |
last_updated: TimestampMillis; | |
name: text; | |
description: text; | |
subtype: opt GroupSubtype; | |
avatar_id: opt nat; | |
latest_message: opt MessageEventWrapper; | |
latest_event_index: EventIndex; | |
participant_count: nat32; | |
is_public: bool; | |
frozen: opt FrozenGroupInfo; | |
wasm_version: Version; | |
}; | |
type ReplyContext = | |
record { | |
chat_id_if_other: opt ChatId; | |
event_index: EventIndex; | |
}; | |
type GiphyImageVariant = | |
record { | |
width: nat32; | |
height: nat32; | |
url: text; | |
mime_type: text; | |
}; | |
type GiphyContent = | |
record { | |
caption: opt text; | |
title: text; | |
desktop: GiphyImageVariant; | |
mobile: GiphyImageVariant; | |
}; | |
type ImageContent = | |
record { | |
width: nat32; | |
height: nat32; | |
thumbnail_data: text; | |
caption: opt text; | |
mime_type: text; | |
blob_reference: opt BlobReference; | |
}; | |
type IndexedNotification = | |
record { | |
index: nat64; | |
value: NotificationEnvelope; | |
}; | |
type InvalidPollReason = | |
variant { | |
TooFewOptions: nat32; | |
TooManyOptions: nat32; | |
OptionTooLong: nat32; | |
DuplicateOptions; | |
EndDateInThePast; | |
PollsNotValidForDirectChats; | |
}; | |
type MessageContentInitial = | |
variant { | |
Text: TextContent; | |
Image: ImageContent; | |
Video: VideoContent; | |
Audio: AudioContent; | |
File: FileContent; | |
Poll: PollContent; | |
Crypto: CryptoContent; | |
Deleted: DeletedContent; | |
Giphy: GiphyContent; | |
GovernanceProposal: ProposalContent; | |
Prize: PrizeContentInitial; | |
}; | |
type MessageContent = | |
variant { | |
Text: TextContent; | |
Image: ImageContent; | |
Video: VideoContent; | |
Audio: AudioContent; | |
File: FileContent; | |
Poll: PollContent; | |
Crypto: CryptoContent; | |
Deleted: DeletedContent; | |
Giphy: GiphyContent; | |
GovernanceProposal: ProposalContent; | |
Prize: PrizeContent; | |
PrizeWinner: PrizeWinnerContent; | |
}; | |
type UpdatedMessage = | |
record { | |
updated_by: UserId; | |
event_index: EventIndex; | |
message_id: MessageId; | |
}; | |
type MessageMatch = | |
record { | |
chat_id: ChatId; | |
message_index: MessageIndex; | |
content: MessageContent; | |
sender: UserId; | |
score: nat32; | |
}; | |
type Notification = | |
variant { | |
AddedToGroupNotification: AddedToGroupNotification; | |
DirectMessageNotification: DirectMessageNotification; | |
GroupMessageNotification: GroupMessageNotification; | |
DirectReactionAddedNotification: DirectReactionAddedNotification; | |
GroupReactionAddedNotification: GroupReactionAddedNotification; | |
}; | |
type NotificationEnvelope = | |
record { | |
recipients: vec UserId; | |
notification: Notification; | |
}; | |
type PartialUserSummary = | |
record { | |
user_id: UserId; | |
username: opt text; | |
avatar_id: opt nat; | |
is_bot: bool; | |
suspended: bool; | |
diamond_member: bool; | |
}; | |
type Participant = | |
record { | |
user_id: UserId; | |
date_added: TimestampMillis; | |
role: Role; | |
}; | |
type ParticipantJoined = | |
record { | |
user_id: UserId; | |
}; | |
type ParticipantLeft = | |
record { | |
user_id: UserId; | |
}; | |
type ParticipantAssumesSuperAdmin = | |
record { | |
user_id: UserId; | |
}; | |
type ParticipantRelinquishesSuperAdmin = | |
record { | |
user_id: UserId; | |
}; | |
type ParticipantDismissedAsSuperAdmin = | |
record { | |
user_id: UserId; | |
}; | |
type ParticipantsAdded = | |
record { | |
user_ids: vec UserId; | |
added_by: UserId; | |
unblocked: vec UserId; | |
}; | |
type PermissionsChanged = | |
record { | |
old_permissions: GroupPermissions; | |
new_permissions: GroupPermissions; | |
changed_by: UserId; | |
}; | |
type GroupVisibilityChanged = | |
record { | |
now_public: bool; | |
changed_by: UserId; | |
}; | |
type GroupInviteCodeChanged = | |
record { | |
change: GroupInviteCodeChange; | |
changed_by: UserId; | |
}; | |
type GroupInviteCodeChange = | |
variant { | |
Enabled; | |
Disabled; | |
Reset; | |
}; | |
type PollConfig = | |
record { | |
text: opt text; | |
options: vec text; | |
end_date: opt TimestampMillis; | |
anonymous: bool; | |
show_votes_before_end_date: bool; | |
allow_multiple_votes_per_user: bool; | |
}; | |
type PollContent = | |
record { | |
config: PollConfig; | |
votes: PollVotes; | |
ended: bool; | |
}; | |
type PollEnded = | |
record { | |
event_index: EventIndex; | |
message_index: MessageIndex; | |
}; | |
type PollVotes = | |
record { | |
total: TotalPollVotes; | |
user: vec nat32; | |
}; | |
type RoleChanged = | |
record { | |
user_ids: vec UserId; | |
changed_by: UserId; | |
old_role: Role; | |
new_role: Role; | |
}; | |
type OwnershipTransferred = | |
record { | |
old_owner: UserId; | |
new_owner: UserId; | |
}; | |
type ParticipantsRemoved = | |
record { | |
user_ids: vec UserId; | |
removed_by: UserId; | |
}; | |
type ProposalContent = | |
record { | |
governance_canister_id: CanisterId; | |
proposal: Proposal; | |
my_vote: opt bool; | |
}; | |
type Proposal = | |
variant { | |
NNS: NnsProposal; | |
SNS: SnsProposal; | |
}; | |
type NnsProposal = | |
record { | |
id: ProposalId; | |
topic: int32; | |
proposer: NnsNeuronId; | |
created: TimestampMillis; | |
title: text; | |
summary: text; | |
url: text; | |
status: ProposalDecisionStatus; | |
reward_status: ProposalRewardStatus; | |
tally: Tally; | |
deadline: TimestampMillis; | |
last_updated: TimestampMillis; | |
}; | |
type SnsProposal = | |
record { | |
id: ProposalId; | |
action: nat64; | |
proposer: SnsNeuronId; | |
created: TimestampMillis; | |
title: text; | |
summary: text; | |
url: text; | |
status: ProposalDecisionStatus; | |
reward_status: ProposalRewardStatus; | |
tally: Tally; | |
deadline: TimestampMillis; | |
payload_text_rendering: opt text; | |
last_updated: TimestampMillis; | |
}; | |
type ProposalDecisionStatus = | |
variant { | |
Unspecified; | |
Open; | |
Rejected; | |
Adopted; | |
Executed; | |
Failed; | |
}; | |
type ProposalRewardStatus = | |
variant { | |
Unspecified; | |
AcceptVotes; | |
ReadyToSettle; | |
Settled; | |
}; | |
type Tally = | |
record { | |
yes: nat64; | |
no: nat64; | |
total: nat64; | |
timestamp: TimestampMillis; | |
}; | |
type TotalPollVotes = | |
variant { | |
Visible: vec record { nat32; vec UserId }; | |
Anonymous: vec record { nat32; nat32 }; | |
Hidden: nat32; | |
}; | |
type UsersBlocked = | |
record { | |
user_ids: vec UserId; | |
blocked_by: UserId; | |
}; | |
type UsersUnblocked = | |
record { | |
user_ids: vec UserId; | |
unblocked_by: UserId; | |
}; | |
type VoteOperation = | |
variant { | |
RegisterVote; | |
DeleteVote; | |
}; | |
type RegistrationFee = | |
variant { | |
ICP: ICPRegistrationFee; | |
Cycles: CyclesRegistrationFee; | |
}; | |
type ICPRegistrationFee = | |
record { | |
amount: ICP; | |
recipient: AccountIdentifier; | |
valid_until: TimestampMillis; | |
}; | |
type CyclesRegistrationFee = | |
record { | |
amount: Cycles; | |
recipient: principal; | |
valid_until: TimestampMillis; | |
}; | |
type Role = | |
variant { | |
Owner; | |
Admin; | |
Participant; | |
}; | |
type FallbackRole = | |
variant { | |
Admin; | |
Participant; | |
}; | |
type Subscription = | |
record { | |
value: SubscriptionInfo; | |
last_active: TimestampMillis; | |
}; | |
type SubscriptionInfo = | |
record { | |
endpoint: text; | |
keys: SubscriptionKeys; | |
}; | |
type SubscriptionKeys = | |
record { | |
p256dh: text; | |
auth: text; | |
}; | |
type TextContent = | |
record { | |
text: text; | |
}; | |
type UserSummary = | |
record { | |
user_id: UserId; | |
username: text; | |
avatar_id: opt nat; | |
is_bot: bool; | |
suspended: bool; | |
seconds_since_last_online: nat32; | |
diamond_member: bool; | |
}; | |
type Version = | |
record { | |
major: nat32; | |
minor: nat32; | |
patch: nat32; | |
}; | |
type Cryptocurrency = | |
variant { | |
InternetComputer; | |
SNS1; | |
CKBTC; | |
CHAT; | |
}; | |
type CryptoTransaction = | |
variant { | |
Pending: PendingCryptoTransaction; | |
Completed: CompletedCryptoTransaction; | |
Failed: FailedCryptoTransaction; | |
}; | |
type PendingCryptoTransaction = | |
variant { | |
NNS: NnsPendingCryptoTransaction; | |
SNS: SnsPendingCryptoTransaction; | |
}; | |
type CompletedCryptoTransaction = | |
variant { | |
NNS: NnsCompletedCryptoTransaction; | |
SNS: SnsCompletedCryptoTransaction; | |
}; | |
type FailedCryptoTransaction = | |
variant { | |
NNS: NnsFailedCryptoTransaction; | |
SNS: SnsFailedCryptoTransaction; | |
}; | |
type NnsPendingCryptoTransaction = | |
record { | |
token: Cryptocurrency; | |
amount: Tokens; | |
to: NnsUserOrAccount; | |
fee: opt Tokens; | |
memo: opt Memo; | |
}; | |
type NnsCompletedCryptoTransaction = | |
record { | |
token: Cryptocurrency; | |
amount: Tokens; | |
fee: Tokens; | |
from: NnsCryptoAccount; | |
to: NnsCryptoAccount; | |
memo: Memo; | |
created: TimestampNanos; | |
transaction_hash: TransactionHash; | |
block_index: BlockIndex; | |
}; | |
type NnsFailedCryptoTransaction = | |
record { | |
token: Cryptocurrency; | |
amount: Tokens; | |
fee: Tokens; | |
from: NnsCryptoAccount; | |
to: NnsCryptoAccount; | |
memo: Memo; | |
created: TimestampNanos; | |
transaction_hash: TransactionHash; | |
error_message: text; | |
}; | |
type NnsUserOrAccount = | |
variant { | |
User: UserId; | |
Account: AccountIdentifier; | |
}; | |
type NnsCryptoAccount = | |
variant { | |
Mint; | |
Account: AccountIdentifier; | |
}; | |
type SnsPendingCryptoTransaction = | |
record { | |
token: Cryptocurrency; | |
amount: Tokens; | |
to: Icrc1Account; | |
fee: Tokens; | |
memo: opt Memo; | |
}; | |
type SnsCompletedCryptoTransaction = | |
record { | |
token: Cryptocurrency; | |
amount: Tokens; | |
fee: Tokens; | |
from: SnsAccount; | |
to: SnsAccount; | |
memo: opt Memo; | |
created: TimestampNanos; | |
transaction_hash: TransactionHash; | |
block_index: BlockIndex; | |
}; | |
type SnsFailedCryptoTransaction = | |
record { | |
token: Cryptocurrency; | |
amount: Tokens; | |
fee: Tokens; | |
from: SnsAccount; | |
to: SnsAccount; | |
memo: opt Memo; | |
created: TimestampNanos; | |
transaction_hash: TransactionHash; | |
error_message: text; | |
}; | |
type SnsAccount = | |
variant { | |
Mint; | |
Account: Icrc1Account; | |
}; | |
type Icrc1Account = | |
record { | |
owner: principal; | |
subaccount: opt blob; | |
}; | |
type VideoContent = | |
record { | |
width: nat32; | |
height: nat32; | |
thumbnail_data: text; | |
caption: opt text; | |
mime_type: text; | |
image_blob_reference: opt BlobReference; | |
video_blob_reference: opt BlobReference; | |
}; | |
type User = | |
record { | |
user_id: UserId; | |
username: text; | |
}; | |
type GroupPermissions = | |
record { | |
change_permissions: PermissionRole; | |
change_roles: PermissionRole; | |
add_members: PermissionRole; | |
remove_members: PermissionRole; | |
block_users: PermissionRole; | |
delete_messages: PermissionRole; | |
update_group: PermissionRole; | |
pin_messages: PermissionRole; | |
invite_users: PermissionRole; | |
create_polls: PermissionRole; | |
send_messages: PermissionRole; | |
react_to_messages: PermissionRole; | |
reply_in_thread: PermissionRole; | |
}; | |
type PermissionRole = | |
variant { | |
Owner; | |
Admins; | |
Members; | |
}; | |
type ThreadSummary = | |
record { | |
participant_ids: vec UserId; | |
reply_count: nat32; | |
latest_event_index: EventIndex; | |
latest_event_timestamp: TimestampMillis; | |
}; | |
type ThreadUpdated = | |
record { | |
event_index: EventIndex; | |
message_index: MessageIndex; | |
latest_thread_message_index_if_updated: opt MessageIndex; | |
}; | |
type ThreadSyncDetails = | |
record { | |
root_message_index: MessageIndex; | |
latest_event: opt EventIndex; | |
latest_message: opt MessageIndex; | |
read_up_to: opt MessageIndex; | |
last_updated: TimestampMillis; | |
}; | |
type GroupCanisterThreadDetails = | |
record { | |
root_message_index: MessageIndex; | |
latest_event: EventIndex; | |
latest_message: MessageIndex; | |
last_updated: TimestampMillis; | |
}; | |
type ProposalsUpdated = | |
record { | |
proposals: vec ProposalUpdated; | |
}; | |
type ProposalUpdated = | |
record { | |
event_index: EventIndex; | |
message_index: MessageIndex; | |
}; | |
type GroupRules = | |
record { | |
text: text; | |
enabled: bool; | |
}; | |
type GroupRulesChanged = | |
record { | |
enabled: bool; | |
prev_enabled: bool; | |
changed_by: UserId; | |
}; | |
type ChatFrozen = | |
record { | |
frozen_by: UserId; | |
reason: opt text; | |
}; | |
type ChatUnfrozen = | |
record { | |
unfrozen_by: UserId; | |
}; | |
type EventsTimeToLiveUpdated = | |
record { | |
updated_by: UserId; | |
new_ttl: opt Milliseconds; | |
}; | |
type EventsTimeToLiveUpdate = | |
variant { | |
NoChange; | |
SetToNone; | |
SetToSome: Milliseconds; | |
}; | |
type PushEventResult = | |
record { | |
index: EventIndex; | |
timestamp: TimestampMillis; | |
expires_at: opt TimestampMillis; | |
}; | |
type MessageIndexRange = | |
record { | |
start: MessageIndex; | |
end: MessageIndex; | |
}; | |
type PrizeContentInitial = | |
record { | |
prizes: vec Tokens; | |
transfer: CryptoTransaction; | |
end_date: TimestampMillis; | |
caption: opt text; | |
}; | |
type PrizeContent = | |
record { | |
prizes_remaining: nat32; | |
prizes_pending: nat32; | |
winners: vec UserId; | |
token: Cryptocurrency; | |
end_date: TimestampMillis; | |
caption: opt text; | |
}; | |
type PrizeWinnerContent = | |
record { | |
winner: UserId; | |
transaction: CompletedCryptoTransaction; | |
prize_message: MessageIndex; | |
}; | |
type DiamondMembershipDetails = | |
record { | |
expires_at: TimestampMillis; | |
recurring: opt DiamondMembershipPlanDuration; | |
}; | |
type DiamondMembershipPlanDuration = | |
variant { | |
OneMonth; | |
ThreeMonths; | |
OneYear; | |
}; | |
type EmptyArgs = | |
record { | |
}; | |
type ChallengeKey = nat32; | |
type CreateChallengeResponse = | |
variant { | |
Success: Challenge; | |
Throttled; | |
}; | |
type Challenge = record { | |
key: ChallengeKey; | |
png_base64: text; | |
}; | |
type RegisterUserArgs = | |
record { | |
username: text; | |
challenge_attempt: ChallengeAttempt; | |
referred_by: opt UserId; | |
}; | |
type ChallengeAttempt = record { | |
key : ChallengeKey; | |
chars : text; | |
}; | |
type RegisterUserResponse = | |
variant { | |
Success: UserId; | |
AlreadyRegistered; | |
UserLimitReached; | |
UsernameTaken; | |
UsernameInvalid; | |
UsernameTooShort: nat16; | |
UsernameTooLong: nat16; | |
CyclesBalanceTooLow; | |
InternalError: text; | |
ChallengeFailed; | |
}; | |
type SetUsernameArgs = | |
record { | |
username: text; | |
}; | |
type SetUsernameResponse = | |
variant { | |
Success; | |
UsernameTaken; | |
UserNotFound; | |
UsernameInvalid; | |
UsernameTooShort: nat16; | |
UsernameTooLong: nat16; | |
}; | |
type CheckUsernameArgs = | |
record { | |
username: text; | |
}; | |
type CheckUsernameResponse = | |
variant { | |
Success; | |
UsernameTaken; | |
UsernameInvalid; | |
UsernameTooShort: nat16; | |
UsernameTooLong: nat16; | |
}; | |
type CurrentUserResponse = | |
variant { | |
Success: record { | |
user_id: UserId; | |
username: text; | |
canister_upgrade_status: CanisterUpgradeStatus; | |
avatar_id: opt nat; | |
wasm_version: Version; | |
icp_account: AccountIdentifier; | |
referrals: vec UserId; | |
is_super_admin: bool; | |
suspension_details: opt SuspensionDetails; | |
is_suspected_bot: bool; | |
diamond_membership_details: opt DiamondMembershipDetails; | |
}; | |
UserNotFound; | |
}; | |
type SuspensionDetails = | |
record { | |
reason: text; | |
action: SuspensionAction; | |
suspended_by: UserId; | |
}; | |
type SuspensionAction = | |
variant { | |
Unsuspend: TimestampMillis; | |
Delete: TimestampMillis; | |
}; | |
type UserArgs = | |
record { | |
user_id: opt UserId; | |
username: opt text; | |
}; | |
type UserResponse = | |
variant { | |
Success: UserSummary; | |
UserNotFound; | |
}; | |
type UsersArgs = | |
record { | |
user_groups: vec record { | |
users: vec UserId; | |
updated_since: TimestampMillis; | |
}; | |
}; | |
type UsersResponse = | |
variant { | |
Success: record { | |
users: vec PartialUserSummary; | |
timestamp: TimestampMillis; | |
} | |
}; | |
type SearchArgs = | |
record { | |
search_term: text; | |
max_results: nat8 | |
}; | |
type SearchResponse = | |
variant { | |
Success: record { | |
users: vec UserSummary; | |
timestamp: TimestampMillis; | |
} | |
}; | |
type AddPlatformModeratorArgs = | |
record { | |
user_id: UserId; | |
}; | |
type AddPlatformModeratorResponse = | |
variant { | |
Success; | |
AlreadyPlatformModerator; | |
InternalError: text; | |
}; | |
type RemovePlatformModeratorArgs = | |
record { | |
user_id: UserId; | |
}; | |
type RemovePlatformModeratorResponse = | |
variant { | |
Success; | |
NotPlatformModerator; | |
InternalError: text; | |
}; | |
type AddPlatformOperatorArgs = | |
record { | |
user_id: UserId; | |
}; | |
type AddPlatformOperatorResponse = | |
variant { | |
Success; | |
}; | |
type RemovePlatformOperatorArgs = | |
record { | |
user_id: UserId; | |
}; | |
type RemovePlatformOperatorResponse = | |
variant { | |
Success; | |
}; | |
type PlatformModeratorsResponse = | |
variant { | |
Success: record { | |
users: vec UserId; | |
}; | |
}; | |
type PlatformOperatorsArgs = | |
record { | |
}; | |
type PlatformOperatorsResponse = | |
variant { | |
Success: record { | |
users: vec UserId; | |
}; | |
}; | |
type SuspectedBotsArgs = | |
record { | |
after: opt UserId; | |
count: nat32; | |
}; | |
type SuspectedBotsResponse = | |
variant { | |
Success: record { | |
users: vec UserId; | |
}; | |
}; | |
type SuspendUserArgs = | |
record { | |
user_id: UserId; | |
duration: opt Milliseconds; | |
reason: text; | |
}; | |
type SuspendUserResponse = | |
variant { | |
Success; | |
UserAlreadySuspended; | |
UserNotFound; | |
InternalError: text; | |
}; | |
type UnsuspendUserArgs = | |
record { | |
user_id: UserId; | |
}; | |
type UnsuspendUserResponse = | |
variant { | |
Success; | |
UserNotSuspended; | |
UserNotFound; | |
InternalError: text; | |
}; | |
type MarkSuspectedBotArgs = | |
record { | |
}; | |
type MarkSuspectedBotResponse = | |
variant { | |
Success; | |
}; | |
type PayForDiamondMembershipArgs = | |
record { | |
duration: DiamondMembershipPlanDuration; | |
token: Cryptocurrency; | |
expected_price_e8s: nat64; | |
recurring: bool; | |
}; | |
type PayForDiamondMembershipResponse = | |
variant { | |
Success: DiamondMembershipDetails; | |
CannotExtend: record { | |
diamond_membership_expires_at: TimestampMillis; | |
can_extend_at: TimestampMillis; | |
}; | |
CurrencyNotSupported; | |
PriceMismatch; | |
PaymentAlreadyInProgress; | |
UserNotFound; | |
InsufficientFunds: nat64; // Returns the account balance in e8s | |
TransferFailed: text; | |
InternalError: text; | |
}; | |
type SetUserUpgradeConcurrencyArgs = | |
record { | |
value: nat32; | |
}; | |
type SetUserUpgradeConcurrencyResponse = | |
variant { | |
Success; | |
}; | |
type IsEligibleForInitialAirdropResponse = | |
variant { | |
Yes: opt principal; | |
No; | |
AirdropClosed; | |
UserNotFound; | |
}; | |
type SetNeuronControllerForInitialAirdropArgs = | |
record { | |
controller: principal | |
}; | |
type SetNeuronControllerForInitialAirdropResponse = | |
variant { | |
Success; | |
AirdropClosed; | |
UserNotEligible; | |
UserNotFound; | |
}; | |
service: { | |
create_challenge : (EmptyArgs) -> (CreateChallengeResponse); | |
register_user: (RegisterUserArgs) -> (RegisterUserResponse); | |
// This is used to set the initial username and subsequently to change it | |
set_username: (SetUsernameArgs) -> (SetUsernameResponse); | |
// This is used to check whether the username already exists | |
check_username: (CheckUsernameArgs) -> (CheckUsernameResponse) query; | |
// Gets the user based on the caller principal. The user can be in a variety of states | |
current_user: (EmptyArgs) -> (CurrentUserResponse) query; | |
// Gets a user by id or username | |
user: (UserArgs) -> (UserResponse) query; | |
// Gets some users by id | |
users: (UsersArgs) -> (UsersResponse) query; | |
// Search for users matching some query | |
search: (SearchArgs) -> (SearchResponse) query; | |
// Mark the caller as a suspected bot | |
mark_suspected_bot: (MarkSuspectedBotArgs) -> (MarkSuspectedBotResponse); | |
pay_for_diamond_membership: (PayForDiamondMembershipArgs) -> (PayForDiamondMembershipResponse); | |
// List the platform moderators/operators | |
platform_moderators: (EmptyArgs) -> (PlatformModeratorsResponse) query; | |
platform_operators: (PlatformOperatorsArgs) -> (PlatformOperatorsResponse) query; | |
// Only callable by SNS governance canister | |
add_platform_moderator: (AddPlatformModeratorArgs) -> (AddPlatformModeratorResponse); | |
add_platform_operator: (AddPlatformOperatorArgs) -> (AddPlatformOperatorResponse); | |
remove_platform_moderator: (RemovePlatformModeratorArgs) -> (RemovePlatformModeratorResponse); | |
remove_platform_operator: (RemovePlatformOperatorArgs) -> (RemovePlatformOperatorResponse); | |
// Only callable by "platform moderators" | |
suspend_user: (SuspendUserArgs) -> (SuspendUserResponse); | |
unsuspend_user: (UnsuspendUserArgs) -> (UnsuspendUserResponse); | |
suspected_bots: (SuspectedBotsArgs) -> (SuspectedBotsResponse) query; | |
// Only callable by "platform operators" | |
set_user_upgrade_concurrency: (SetUserUpgradeConcurrencyArgs) -> (SetUserUpgradeConcurrencyResponse); | |
// Temporary endpoints for the initial airdrop | |
is_eligible_for_initial_airdrop: (EmptyArgs) -> (IsEligibleForInitialAirdropResponse) query; | |
set_neuron_controller_for_initial_airdrop: (SetNeuronControllerForInitialAirdropArgs) -> (SetNeuronControllerForInitialAirdropResponse); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment