Channel

Defines:

public struct Channel has key {
        id: UID,
        avatar_hash: String,
        banner_hash: String,
        created_at: u64,
        created_by: address,
        description: String,
        key: String,
        members: Membership,
        moderators: Moderation,
        name: String,
        posts: Posts,
        updated_at: u64
}

Assert Description

The assert_channel_description function has these effects:

  1. Throws error (370 - EInvalidChannelDescription) if the description is longer than 370 characters

Assert Name

The assert_channel_name function has these effects:

  1. Throws error (371 - EInvalidChannelName) if the name is not between 3 - 21 characters, or contains characters that are not a-z, A-Z, or a dash at the beginning or end

Borrow Members

The borrow_members_mut function has these effects:

  1. Returns a mutable reference to the Membership table of the Channel

Borrow Moderators

The borrow_moderators_mut function has these effects:

  1. Returns a mutable reference to the Moderators table of the Channel

Borrow Posts

The borrow_posts_mut function has these effects:

  1. Returns a mutable reference to the Posts table of the Channel

Create

The create function has these effects:

  1. Asserts name & description values

  2. Creates and shares Channel

  3. Returns Channel address

Get Avatar

The get_avatar function has these effects:

  1. Returns the String avatar of the Channel

Get Banner

The get_banner function has these effects:

  1. Returns the String banner of the Channel

Get Author

The get_created_by function has these effects:

  1. Returns the address creator of the Channel

Get Description

The get_description function has these effects:

  1. Returns the String description of the Channel

Get Key

The get_key function has these effects:

  1. Returns the String lowercase version of the Channel's name

Get Name

The get_name function has these effects:

  1. Returns the String name of the Channel

Update

The update function has these effects:

  1. Asserts description value

  2. Updates the Channel data

Last updated