badgesmodel

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2023 License: Apache-2.0 Imports: 1 Imported by: 3

Documentation

Index

Constants

View Source
const (
	NameMaxLength        = 20
	DescriptionMaxLength = 120

	ImageTypeEmoji       ImageType = "emoji"
	ImageTypeRelativeURL ImageType = "rel_url"
	ImageTypeAbsoluteURL ImageType = "abs_url"

	PluginPath          = "/com.mattermost.badges"
	PluginAPIPath       = "/papi/v1"
	PluginAPIPathEnsure = "/ensure"
	PluginAPIPathGrant  = "/grant"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AllBadgesBadge

type AllBadgesBadge struct {
	Badge
	Granted      int    `json:"granted"`
	GrantedTimes int    `json:"granted_times"`
	TypeName     string `json:"type_name"`
}

type Badge

type Badge struct {
	ID          BadgeID   `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Image       string    `json:"image"`
	ImageType   ImageType `json:"image_type"`
	Multiple    bool      `json:"multiple"`
	Type        BadgeType `json:"type"`
	CreatedBy   string    `json:"created_by"`
}

func (Badge) IsValid

func (b Badge) IsValid() bool

type BadgeDetails

type BadgeDetails struct {
	Badge
	Owners            []Ownership `json:"owners"`
	CreatedByUsername string      `json:"created_by_username"`
	TypeName          string      `json:"type_name"`
}

type BadgeID

type BadgeID string

type BadgeType

type BadgeType string

type BadgeTypeDefinition

type BadgeTypeDefinition struct {
	ID        BadgeType        `json:"id"`
	Name      string           `json:"name"`
	Frame     string           `json:"frame"`
	CreatedBy string           `json:"created_by"`
	CanGrant  PermissionScheme `json:"can_grant"`
	CanCreate PermissionScheme `json:"can_create"`
}

type BadgeTypeList

type BadgeTypeList []*BadgeTypeDefinition

func (BadgeTypeList) GetType

type EnsureBadgesRequest

type EnsureBadgesRequest struct {
	Badges []*Badge
	BotID  string
}

type GrantBadgeRequest

type GrantBadgeRequest struct {
	BadgeID BadgeID
	UserID  string
	BotID   string
	Reason  string
}

type ImageType

type ImageType string

type Ownership

type Ownership struct {
	User      string    `json:"user"`
	GrantedBy string    `json:"granted_by"`
	Badge     BadgeID   `json:"badge"`
	Reason    string    `json:"reason"`
	Time      time.Time `json:"time"`
}

type OwnershipList

type OwnershipList []Ownership

func (OwnershipList) IsOwned

func (l OwnershipList) IsOwned(user string, badge BadgeID) bool

type PermissionScheme

type PermissionScheme struct {
	Everyone  bool            `json:"everyone"`
	Roles     map[string]bool `json:"roles"`
	AllowList map[string]bool `json:"allow_list"`
	BlockList map[string]bool `json:"block_list"`
}

type Subscription

type Subscription struct {
	TypeID    BadgeType
	ChannelID string
}

type UserBadge

type UserBadge struct {
	Badge
	Ownership
	GrantedByUsername string `json:"granted_by_name"`
	TypeName          string `json:"type_name"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL