grom/invite
Types
pub type Create {
Create(
max_age: option.Option(duration.Duration),
max_uses: option.Option(Int),
is_temporary: Bool,
is_unique: Bool,
target_type: option.Option(CreateTargetType),
target_users_ids: option.Option(List(String)),
role_ids: option.Option(List(String)),
)
}
Constructors
-
Create( max_age: option.Option(duration.Duration), max_uses: option.Option(Int), is_temporary: Bool, is_unique: Bool, target_type: option.Option(CreateTargetType), target_users_ids: option.Option(List(String)), role_ids: option.Option(List(String)), )Arguments
- role_ids
-
Automatically given roles to users accepting this invite.
pub type CreateTargetType {
CreateForStream(streaming_user_id: String)
CreateForEmbeddedApplication(application_id: String)
}
Constructors
-
CreateForStream(streaming_user_id: String) -
CreateForEmbeddedApplication(application_id: String)
pub type Invite {
InviteWithoutMetadata(WithoutMetadata)
InviteWithMetadata(WithMetadata)
}
Constructors
-
InviteWithoutMetadata(WithoutMetadata) -
InviteWithMetadata(WithMetadata)
pub type PartialRole {
PartialRole(
id: String,
name: String,
position: Int,
colors: role.Colors,
icon_hash: option.Option(String),
unicode_emoji: option.Option(String),
)
}
Constructors
-
PartialRole( id: String, name: String, position: Int, colors: role.Colors, icon_hash: option.Option(String), unicode_emoji: option.Option(String), )
pub type TargetType {
ForStream(streaming_user: user.User)
ForEmbeddedApplication(application: application.Application)
}
Constructors
-
ForStream(streaming_user: user.User) -
ForEmbeddedApplication(application: application.Application)
pub type WithMetadata {
WithMetadata(
type_: Type,
code: String,
guild: option.Option(guild.Guild),
channel: option.Option(channel.Channel),
inviter: option.Option(user.User),
target_type: option.Option(TargetType),
approximate_presence_count: option.Option(Int),
approximate_member_count: option.Option(Int),
expires_at: option.Option(timestamp.Timestamp),
uses: Int,
max_uses: Int,
max_age: duration.Duration,
is_temporary: Bool,
created_at: timestamp.Timestamp,
flags: option.Option(List(Flag)),
roles: option.Option(List(PartialRole)),
)
}
Constructors
-
WithMetadata( type_: Type, code: String, guild: option.Option(guild.Guild), channel: option.Option(channel.Channel), inviter: option.Option(user.User), target_type: option.Option(TargetType), approximate_presence_count: option.Option(Int), approximate_member_count: option.Option(Int), expires_at: option.Option(timestamp.Timestamp), uses: Int, max_uses: Int, max_age: duration.Duration, is_temporary: Bool, created_at: timestamp.Timestamp, flags: option.Option(List(Flag)), roles: option.Option(List(PartialRole)), )
pub type WithoutMetadata {
WithoutMetadata(
type_: Type,
code: String,
guild: option.Option(guild.Guild),
channel: option.Option(channel.Channel),
inviter: option.Option(user.User),
target_type: option.Option(TargetType),
approximate_presence_count: option.Option(Int),
approximate_member_count: option.Option(Int),
expires_at: option.Option(timestamp.Timestamp),
flags: option.Option(List(Flag)),
roles: option.Option(List(PartialRole)),
)
}
Constructors
-
WithoutMetadata( type_: Type, code: String, guild: option.Option(guild.Guild), channel: option.Option(channel.Channel), inviter: option.Option(user.User), target_type: option.Option(TargetType), approximate_presence_count: option.Option(Int), approximate_member_count: option.Option(Int), expires_at: option.Option(timestamp.Timestamp), flags: option.Option(List(Flag)), roles: option.Option(List(PartialRole)), )
Values
pub fn create(
client: grom.Client,
for channel_id: String,
with create: Create,
reason reason: option.Option(String),
) -> Result(WithoutMetadata, grom.Error)
pub fn delete(
client: grom.Client,
code invite_code: String,
because reason: option.Option(String),
) -> Result(Nil, grom.Error)
pub fn get(
client: grom.Client,
code invite_code: String,
include_counts with_counts: Bool,
scheduled_event_id guild_scheduled_event_id: option.Option(
String,
),
) -> Result(Invite, grom.Error)
pub fn get_all_for_channel(
client: grom.Client,
with_id channel_id: String,
) -> Result(List(WithMetadata), grom.Error)
pub fn get_all_for_guild(
client: grom.Client,
with_id guild_id: String,
) -> Result(List(Invite), grom.Error)
pub fn get_target_users_ids(
client: grom.Client,
for_code code: String,
) -> Result(List(String), grom.Error)
pub fn new_create() -> Create
pub fn update_target_users(
client: grom.Client,
for_code code: String,
users_ids ids: List(String),
) -> Result(Nil, grom.Error)
Supply the full list of users that can use the invite, not just the new users.