1package hub23import (4 "gno.land/p/gnoland/boards/v0"5)67// Board defines a safe type for boards.8type Board struct {9 // id is the unique identifier of the board.10 id uint641112 // name is the current name of the board.13 name string1415 // aliases contains a list of alternative names for the board.16 aliases []string1718 // readonly indicates that the board is readonly.19 readonly bool2021 // threadCount contains the number of threads within the board.22 threadCount int2324 // memberCount contains the number of members of the board.25 memberCount int2627 // creator is the account address that created the board.28 creator address2930 // createdAt is the board's creation time as Unix time.31 createdAt int643233 // updatedAt is the board's update time as Unix time.34 updatedAt int6435}3637// ID returns the unique identifier of the board.38func (b Board) ID() uint64 { return b.id }3940// Name returns the current name of the board.41func (b Board) Name() string { return b.name }4243// Aliases returns the list of alternative names for the board.44func (b Board) Aliases() []string { return append([]string(nil), b.aliases...) }4546// Readonly indicates that the board is readonly.47func (b Board) Readonly() bool { return b.readonly }4849// ThreadCount returns the number of threads within the board.50func (b Board) ThreadCount() int { return b.threadCount }5152// MemberCount returns the number of members of the board.53func (b Board) MemberCount() int { return b.memberCount }5455// Creator returns the account address that created the board.56func (b Board) Creator() address { return b.creator }5758// CreatedAt returns the board's creation time as Unix time.59func (b Board) CreatedAt() int64 { return b.createdAt }6061// UpdatedAt returns the board's update time as Unix time.62func (b Board) UpdatedAt() int64 { return b.updatedAt }6364// NewSafeBoard creates a safe board.65func NewSafeBoard(ref *boards.Board) Board {66 if ref == nil {67 panic("board reference is nil")68 }6970 var usersCount int71 if ref.Permissions != nil {72 usersCount = ref.Permissions.UsersCount()73 }7475 var threadCount int76 if ref.Threads != nil {77 threadCount = ref.Threads.Size()78 }7980 return Board{81 id: uint64(ref.ID),82 name: ref.Name,83 aliases: append([]string(nil), ref.Aliases...),84 readonly: ref.Readonly,85 threadCount: threadCount,86 memberCount: usersCount,87 creator: ref.Creator,88 createdAt: timeToUnix(ref.CreatedAt),89 updatedAt: timeToUnix(ref.UpdatedAt),90 }91}92Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.