pkgo

package module
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: BSD-3-Clause Imports: 15 Imported by: 12

README

pkgo

Go Reference godocs.io

pkgo is a simple wrapper around PluralKit's REST API.

Usage

Import the package into your project:

import "github.com/starshine-sys/pkgo/v2"

All API actions are done through a Session struct. This can be authenticated or unauthenticated; for unauthenticated sessions, only public information will be returned.
To get an API token, run pk;token on Discord.

pk := pkgo.New("authentication token")
// or
pk := pkgo.New("")
Note on branches/versions

The main branch contains pkgo v1, which supports version 1 of PluralKit's API. Like the API version it supports, it's deprecated and won't receive any further updates.
The v2 branch contains pkgo v2, which supports version 2 of PluralKit's API (with groups).

Example

sysID := "exmpl"

pk := pkgo.New("")

sys, err := pk.System(sysID)
// ID => exmpl
// Name => PluralKit Example System
// Tag => | PluralKit 🦊
// Created => 2020-01-12 02:00:33.387824 +0000 UTC

front, err := pk.Fronters(sysID)
// Timestamp => 2020-01-12 02:21:44.024493 +0000 UTC
// Members => [Myriad Kit Tester T. Testington]

msg, err := s.Message(859157735644069928)
// ID => 859157735644069928
// Original => 859157734331252777
// Sender => 694563574386786314
pk = pkgo.New("notARealToken")

sys, err = pk.EditSystem(pkgo.EditSystemData{
    Name:        pkgo.NewNullableString("Testing System"),
    Description: pkgo.NewNullableString("Hi, we're a system! 👋"),
    Tag:         pkgo.NewNullableString("| Testers"),
})

Documentation

Index

Constants

View Source
const (
	ErrNoToken          = errors.Sentinel("pkgo: no token in session, can't hit endpoints requiring authentication")
	ErrInvalidID        = errors.Sentinel("pkgo: not a 5-character ID")
	ErrInvalidSnowflake = errors.Sentinel("pkgo: not a valid Discord snowflake")
	ErrMsgNotFound      = errors.Sentinel("pkgo: message not found")
	ErrPrivacyInvalid   = errors.Sentinel("pkgo: invalid privacy setting")
	ErrInvalidProxyTag  = errors.Sentinel("pkgo: invalid proxy tag")
)

Errors

View Source
const (
	SystemNotFound        = 20001
	MemberNotFound        = 20002
	MemberNotFoundWithRef = 20003
	GroupNotFound         = 20004
	GroupNotFoundWithRef  = 20005
	MessageNotFound       = 20006
	SwitchNotFound        = 20007
	SwitchNotFoundPublic  = 20008
	SystemGuildNotFound   = 20009
	MemberGuildNotFound   = 20010

	UnauthorizedMemberList      = 30001
	UnauthorizedGroupList       = 30002
	UnauthorizedGroupMemberList = 30003
	UnauthorizedCurrentFronters = 30004
	UnauthorizedFrontHistory    = 30005
	NotOwnMember                = 30006
	NotOwnGroup                 = 30007
	NotOwnMemberWithRef         = 30008
	NotOwnGroupWithRef          = 30009
	MissingAutoproxyMember      = 40002
	DuplicateMembersInList      = 40003
	SameSwitchMembers           = 40004
	SameSwitchTimestamp         = 40005
	InvalidSwitchID             = 40006
	MemberLimitReached          = 40007
	GroupLimitReached           = 40008

	Unimplemented = 50001
)

Error codes

Variables

View Source
var (
	// BaseURL is the API base url
	BaseURL = "https://api.pluralkit.me/v"
	// Version is the API version
	Version = "2"
)

Functions

This section is empty.

Types

type AutoproxyMode

type AutoproxyMode string
const (
	AutoproxyModeOff    AutoproxyMode = "off"
	AutoproxyModeFront  AutoproxyMode = "front"
	AutoproxyModeLatch  AutoproxyMode = "latch"
	AutoproxyModeMember AutoproxyMode = "member"
)

Autoproxy modes

type AutoproxySettings added in v2.1.0

type AutoproxySettings struct {
	Mode AutoproxyMode `json:"autoproxy_mode"`
	// Member will be empty if Mode is "front"
	Member string `json:"autoproxy_member,omitempty"`
	// LastLatchTimestamp will be zero if Mode is not "latch"
	LastLatchTimestamp time.Time `json:"last_latch_timestamp,omitempty"`
}

AutoproxySettings are a system's autoproxy settings.

type Birthday

type Birthday time.Time

Birthday is a member's birthday

func ParseBirthday

func ParseBirthday(in string) (bd Birthday, err error)

ParseBirthday parses a birthday in yyyy-mm-dd or mm-dd format.

func (Birthday) MarshalJSON

func (bd Birthday) MarshalJSON() (b []byte, err error)

MarshalJSON ...

func (Birthday) Time

func (bd Birthday) Time() time.Time

Time returns bd as time.Time

func (*Birthday) UnmarshalJSON

func (bd *Birthday) UnmarshalJSON(v []byte) error

UnmarshalJSON ...

type Color

type Color string

Color holds the color for a member

func (Color) IsValid

func (c Color) IsValid() bool

IsValid returns true if the color is valid for PK

func (Color) ToInt

func (c Color) ToInt() int64

ToInt converts the color to an int64 value

type CreateGroupData

type CreateGroupData struct {
	Name        string `json:"name"`
	DisplayName string `json:"display_name,omitempty"`
	Description string `json:"description,omitempty"`
	Icon        string `json:"icon,omitempty"`
	Banner      string `json:"banner,omitempty"`
	Color       Color  `json:"color"`

	Privacy *GroupPrivacy `json:"privacy,omitempty"`
}

CreateGroupData is the data for s.CreateGroup.

type CreateMemberData

type CreateMemberData struct {
	Name        string `json:"name,omitempty"`
	DisplayName string `json:"display_name,omitempty"`

	Description string   `json:"description,omitempty"`
	Pronouns    string   `json:"pronouns,omitempty"`
	Color       Color    `json:"color,omitempty"`
	Birthday    Birthday `json:"birthday,omitempty"`
	AvatarURL   string   `json:"avatar_url,omitempty"`
	Banner      string   `json:"banner,omitempty"`

	ProxyTags []ProxyTag `json:"proxy_tags,omitempty"`
	KeepProxy bool       `json:"keep_proxy"`

	Privacy *MemberPrivacy `json:"privacy,omitempty"`
}

CreateMemberData is the data for s.CreateMember.

type EditAutoproxyData added in v2.1.0

type EditAutoproxyData struct {
	Mode *AutoproxyMode `json:"autoproxy_mode"`
	// Member must be null if Mode is "front"
	Member NullableString `json:"autoproxy_member,omitempty"`
}

type EditGroupData

type EditGroupData struct {
	Name        NullableString `json:"name,omitempty"`
	DisplayName NullableString `json:"display_name,omitempty"`
	Description NullableString `json:"description,omitempty"`
	Icon        NullableString `json:"icon,omitempty"`
	Banner      NullableString `json:"banner,omitempty"`
	Color       *Color         `json:"color"`

	Privacy *GroupPrivacy `json:"privacy,omitempty"`
}

EditGroupData is the data for s.EditGroup.

type EditMemberData

type EditMemberData struct {
	Name        NullableString `json:"name,omitempty"`
	DisplayName NullableString `json:"display_name,omitempty"`

	Description NullableString `json:"description,omitempty"`
	Pronouns    NullableString `json:"pronouns,omitempty"`
	Color       *Color         `json:"color,omitempty"`
	Birthday    *Birthday      `json:"birthday,omitempty"`
	AvatarURL   NullableString `json:"avatar_url,omitempty"`
	Banner      NullableString `json:"banner,omitempty"`

	ProxyTags []ProxyTag `json:"proxy_tags,omitempty"`
	KeepProxy bool       `json:"keep_proxy,omitempty"`

	Privacy *MemberPrivacy `json:"privacy,omitempty"`
}

EditMemberData is the data for s.EditMember.

type EditMemberGuildData

type EditMemberGuildData struct {
	DisplayName NullableString `json:"display_name,omitempty"`
	AvatarURL   NullableString `json:"avatar_url,omitempty"`
}

EditMemberGuildData ...

type EditSystemData

type EditSystemData struct {
	Name        NullableString `json:"name,omitempty"`
	Description NullableString `json:"description,omitempty"`
	Tag         NullableString `json:"tag,omitempty"`
	AvatarURL   NullableString `json:"avatar_url,omitempty"`
	Banner      NullableString `json:"banner,omitempty"`
	Color       NullableString `json:"color,omitempty"`
	Timezone    NullableString `json:"tz,omitempty"`
	Privacy     *SystemPrivacy `json:"privacy,omitempty"`
}

EditSystemData ...

type EditSystemGuildData

type EditSystemGuildData struct {
	ProxyingEnabled NullableBool   `json:"proxying_enabled"`
	Tag             NullableString `json:"tag,omitempty"`
	TagEnabled      NullableBool   `json:"tag_enabled"`
}

EditSystemGuildData ...

type Front

type Front struct {
	ID        uuid.UUID `json:"id"`
	Timestamp time.Time `json:"timestamp,omitempty"`
	Members   []Member  `json:"members"`
}

Front holds the info for a full switch, as queried from /systems/{systemRef}/fronters

type Group

type Group struct {
	ID          string    `json:"id"`
	UUID        uuid.UUID `json:"uuid"`
	Name        string    `json:"name"`
	DisplayName string    `json:"display_name,omitempty"`
	Description string    `json:"description,omitempty"`
	Icon        string    `json:"icon,omitempty"`
	Banner      string    `json:"banner,omitempty"`
	Color       Color     `json:"color"`

	Privacy *GroupPrivacy `json:"privacy,omitempty"`

	// Only returned in GroupsWithMembers
	Members []uuid.UUID `json:"members,omitempty"`
}

Group is a member group.

type GroupPrivacy

type GroupPrivacy struct {
	DescriptionPrivacy Privacy `json:"description_privacy,omitempty"`
	IconPrivacy        Privacy `json:"icon_privacy,omitempty"`
	ListPrivacy        Privacy `json:"list_privacy,omitempty"`
	Visibility         Privacy `json:"visibility,omitempty"`
}

GroupPrivacy is a group privacy object.

type HTTPError added in v2.0.2

type HTTPError int

HTTPError is an error code returned by the API. This is only returned if the API did not return a valid error object.

func (HTTPError) Error added in v2.0.2

func (h HTTPError) Error() string

type InvalidError

type InvalidError struct {
	// contains filtered or unexported fields
}

InvalidError is returned when the data for a PATCH or POST endpoint is invalid.

func (*InvalidError) Error

func (e *InvalidError) Error() string

type Member

type Member struct {
	ID   string    `json:"id"`
	UUID uuid.UUID `json:"uuid"`

	Name        string   `json:"name,omitempty"`
	DisplayName string   `json:"display_name,omitempty"`
	Color       Color    `json:"color,omitempty"`
	Birthday    Birthday `json:"birthday,omitempty"`
	Pronouns    string   `json:"pronouns,omitempty"`
	AvatarURL   string   `json:"avatar_url,omitempty"`
	Banner      string   `json:"banner,omitempty"`
	Description string   `json:"description,omitempty"`

	Created time.Time `json:"created"`

	ProxyTags []ProxyTag `json:"proxy_tags,omitempty"`
	KeepProxy bool       `json:"keep_proxy"`

	Privacy *MemberPrivacy `json:"privacy,omitempty"`
}

Member holds information for a specific system member. Fields set to private are empty.

func (Member) String

func (m Member) String() string

String returns the member's displayed name--either DisplayName if one is set, otherwise Name.

func (Member) Validate

func (m Member) Validate() error

Validate will validate the member object. If any of the fields have invalid values, it returns an InvalidError.

type MemberGuild

type MemberGuild struct {
	DisplayName string `json:"display_name,omitempty"`
	AvatarURL   string `json:"avatar_url,omitempty"`
}

MemberGuild is a member's guild-specific settings

type MemberPrivacy

type MemberPrivacy struct {
	Visibility         Privacy `json:"visibility,omitempty"`
	NamePrivacy        Privacy `json:"name_privacy,omitempty"`
	DescriptionPrivacy Privacy `json:"description_privacy,omitempty"`
	BirthdayPrivacy    Privacy `json:"birthday_privacy,omitempty"`
	PronounPrivacy     Privacy `json:"pronoun_privacy,omitempty"`
	AvatarPrivacy      Privacy `json:"avatar_privacy,omitempty"`
	MetadataPrivacy    Privacy `json:"metadata_privacy,omitempty"`
}

MemberPrivacy is a member privacy object.

type Message

type Message struct {
	Timestamp time.Time `json:"timestamp"`

	ID       Snowflake `json:"id"`
	Original Snowflake `json:"original"`
	Sender   Snowflake `json:"sender"`
	Channel  Snowflake `json:"channel"`

	System *System `json:"system"`
	Member *Member `json:"member"`
}

Message is a proxied message. System and Member may be null if the system/member the message is connected to is deleted.

type ModelError

type ModelError struct {
	Message      string `json:"message"`
	MaxLength    int    `json:"max_length"`
	ActualLength int    `json:"actual_length"`
}

ModelError ...

type NullableBool

type NullableBool = *bool

NullableBool is a nullable bool for use in post/patch endpoints

func NewNullableBool

func NewNullableBool(b bool) NullableBool

NewNullableBool creates a new nullable bool with the given value

type NullableInt

type NullableInt = *int

NullableBool is a nullable int for use in post/patch endpoints

func NewNullableInt

func NewNullableInt(i int) NullableInt

NewNullableInt creates a new nullable int with the given value

type NullableString

type NullableString = *string

NullableString is a nullable string for use in post/patch endpoints

func NewNullableString

func NewNullableString(s string) NullableString

NewNullableString creates a new nullable string with the given value

type PKAPIError

type PKAPIError struct {
	StatusCode int                     `json:"-"`
	Code       int                     `json:"code"`
	RetryAfter *int                    `json:"retry_after,omitempty"`
	Message    string                  `json:"message"`
	Errors     map[string][]ModelError `json:"errors,omitempty"`
}

PKAPIError is an error returned by the PluralKit API

func (PKAPIError) Error

func (e PKAPIError) Error() string

type Privacy

type Privacy string

Privacy is a system or member privacy field. Note: an empty Privacy is marshaled as null.

func (Privacy) MarshalJSON

func (p Privacy) MarshalJSON() (b []byte, err error)

MarshalJSON ...

func (*Privacy) UnmarshalJSON

func (p *Privacy) UnmarshalJSON(v []byte) error

UnmarshalJSON ...

type ProxyTag

type ProxyTag struct {
	Prefix string `json:"prefix,omitempty"`
	Suffix string `json:"suffix,omitempty"`
}

ProxyTag is a single proxy tag for a member, in the format <prefix>text<suffix>

func (ProxyTag) MarshalJSON

func (t ProxyTag) MarshalJSON() (b []byte, err error)

MarshalJSON marshals the ProxyTag to json

func (ProxyTag) String

func (t ProxyTag) String() string

String returns a <prefix>text<suffix> formatted version of the proxy tag

type RequestOption

type RequestOption func(*http.Request) error

RequestOption is an optional request option.

func WithBody

func WithBody(r io.Reader) RequestOption

WithBody adds a body to the request.

func WithHeader

func WithHeader(header http.Header) RequestOption

WithHeader adds headers to the request.

func WithJSONBody

func WithJSONBody(v interface{}) RequestOption

WithJSONBody adds a JSON body to the request. Marshaling errors are ignored.

func WithURLValues

func WithURLValues(values url.Values) RequestOption

WithURLValues adds query parameters to the request.

type Session

type Session struct {
	// BaseURL is the API's base url.
	// This is set to the global variables BaseURL + Version when the session is initialized.
	BaseURL string

	Client *http.Client

	// Timeout is the maximum time this Session will wait for requests.
	Timeout time.Duration

	// RequestOptions are applied to every outgoing request.
	RequestOptions []RequestOption

	// UserAgent is the user agent sent with every request.
	// PluralKit recommends setting a custom user agent.
	UserAgent string
	// contains filtered or unexported fields
}

Session is the PluralKit API session, including a token

func New

func New(token string) *Session

New returns a session with the given token, or no token if the string is empty.

func NewWithLimiter

func NewWithLimiter(token string, limiter *rate.Limiter) *Session

NewWithLimiter returns a session with the given token and rate limiter.

func (*Session) Account

func (s *Session) Account(id Snowflake) (sys System, err error)

Account gets a system by a Discord snowflake (user ID).

func (*Session) AddGroupMembers

func (s *Session) AddGroupMembers(groupID string, memberIDs []string) (err error)

AddGroupMembers adds the given member IDs to the given group.

func (*Session) AddMemberGroups

func (s *Session) AddMemberGroups(memberID string, groupIDs []string) (err error)

AddMemberGroups adds a member to the given groups IDs.

func (*Session) CreateGroup

func (s *Session) CreateGroup(data CreateGroupData) (g Group, err error)

CreateGroup creates a group.

func (*Session) CreateMember

func (s *Session) CreateMember(data CreateMemberData) (m Member, err error)

CreateMember creates a member. Requires authentication.

func (*Session) DeleteGroup

func (s *Session) DeleteGroup(id string) (err error)

DeleteGroup deletes a group. Requires authentication.

func (*Session) DeleteMember

func (s *Session) DeleteMember(id string) (err error)

DeleteMember deletes a member. Requires authentication.

func (*Session) DeleteSwitch

func (s *Session) DeleteSwitch(id uuid.UUID) (err error)

DeleteSwitch deletes a switch. Requires authentication.

func (*Session) EditGroup

func (s *Session) EditGroup(id string, dat EditGroupData) (g Group, err error)

EditGroup edits the given group.

func (*Session) EditGuildAutoproxy added in v2.1.0

func (s *Session) EditGuildAutoproxy(guildID Snowflake, dat EditAutoproxyData) (as AutoproxySettings, err error)

EditGuildAutoproxy updates the current system's autoproxy settings in the given guild.

func (*Session) EditMember

func (s *Session) EditMember(id string, emd EditMemberData) (Member, error)

EditMember edits a member by ID. Requires authentication.

func (*Session) EditMemberGuild

func (s *Session) EditMemberGuild(memberID string, guildID Snowflake, dat EditMemberGuildData) (mg MemberGuild, err error)

EditMemberGuild edits the member's guild settings.

func (*Session) EditSystem

func (s *Session) EditSystem(psd EditSystemData) (sys System, err error)

EditSystem edits your system with the provided data.

func (*Session) EditSystemGuild

func (s *Session) EditSystemGuild(guildID Snowflake, dat EditSystemGuildData) (sg SystemGuild, err error)

EditSystemGuild edits the current system's guild settings.

func (*Session) Fronters

func (s *Session) Fronters(id string) (f Front, err error)

Fronters gets the current fronters for a system. If the system's fronters are set to private, requires authentication.

func (*Session) Group

func (s *Session) Group(id string) (g Group, err error)

Group returns a group by its ID or UUID.

func (*Session) GroupByUUID

func (s *Session) GroupByUUID(id uuid.UUID) (g Group, err error)

GroupByUUID returns a group by its UUID.

func (*Session) GroupMembers

func (s *Session) GroupMembers(groupID string) (m []Member, err error)

GroupMembers gets the members list of the given group.

func (*Session) Groups

func (s *Session) Groups(systemID string) (g []Group, err error)

Groups gets a system's groups.

func (*Session) GroupsWithMembers

func (s *Session) GroupsWithMembers(systemID string) (g []Group, err error)

GroupsWithMembers gets a system's groups, with the Members field filled.

func (*Session) GuildAutoproxy added in v2.1.0

func (s *Session) GuildAutoproxy(guildID Snowflake) (as AutoproxySettings, err error)

GuildAutoproxy gets the current system's autoproxy settings in the given guild.

func (*Session) Me

func (s *Session) Me() (sys System, err error)

Me gets the current token's system.

func (*Session) Member

func (s *Session) Member(id string) (m Member, err error)

Member gets a member by their ID.

func (*Session) MemberByUUID

func (s *Session) MemberByUUID(id uuid.UUID) (Member, error)

MemberByUUID gets a member by their UUID.

func (*Session) MemberGroups

func (s *Session) MemberGroups(id string) (g []Group, err error)

MemberGroups returns the groups the given member is in.

func (*Session) MemberGuild

func (s *Session) MemberGuild(memberID string, guildID Snowflake) (mg MemberGuild, err error)

MemberGuild returns the member's guild settings.

func (*Session) Members

func (s *Session) Members(id string) ([]Member, error)

Members gets all members of a system. If the system's member list is set to private, requires authentication. If the request is not authenticated, only public members will be returned.

func (*Session) Message

func (s *Session) Message(id Snowflake) (m Message, err error)

Message gets a message by Discord snowflake.

func (*Session) OverwriteGroupMembers

func (s *Session) OverwriteGroupMembers(groupID string, memberIDs []string) (err error)

OverwriteGroupMembers overwrites a group's members with the given member IDs.

func (*Session) OverwriteMemberGroups

func (s *Session) OverwriteMemberGroups(memberID string, groupIDs []string) (err error)

OverwriteMemberGroups overwrites a member's groups with the given groups IDs.

func (*Session) RegisterSwitch

func (s *Session) RegisterSwitch(ids ...string) (err error)

RegisterSwitch registers a switch with the given member IDs. Requires authentication.

func (*Session) RegisterSwitchWithTimestamp

func (s *Session) RegisterSwitchWithTimestamp(t time.Time, ids ...string) (err error)

RegisterSwitchWithTimestamp registers a switch with the given member IDs and the given timestamp. Requires authentication.

func (*Session) RemoveGroupMembers

func (s *Session) RemoveGroupMembers(groupID string, memberIDs []string) (err error)

RemoveGroupMembers removes the given member IDs from the given group.

func (*Session) RemoveMemberGroups

func (s *Session) RemoveMemberGroups(memberID string, groupIDs []string) (err error)

RemoveMemberGroups removes a member from the given groups IDs.

func (*Session) Request

func (s *Session) Request(method, endpoint string, opts ...RequestOption) (response []byte, err error)

Request makes a request returning a JSON body.

func (*Session) RequestJSON

func (s *Session) RequestJSON(method, endpoint string, v interface{}, opts ...RequestOption) error

RequestJSON makes a request returning a JSON body.

func (*Session) Switch

func (s *Session) Switch(systemID string, switchID uuid.UUID) (f Front, err error)

Switch gets the given switch.

func (*Session) Switches

func (s *Session) Switches(id string) (switches []Switch, err error)

Switches gets the latest 100 switches for a system. For earlier switches, see SwitchesBefore. If the system's front history is set to private, requires authentication.

func (*Session) SwitchesBefore

func (s *Session) SwitchesBefore(id string, before time.Time, limit uint64) (switches []Switch, err error)

SwitchesBefore gets `limit` switches before the given timestamp. A zero limit will return *all* switches. For the latest switches, see Switches. If the system's front history is set to private, requires authentication.

func (*Session) System

func (s *Session) System(id string) (sys System, err error)

System gets a system by its 5-character system ID. Some fields may be empty if unauthenticated and the system has chosen to make those fields private.

func (*Session) SystemByUUID

func (s *Session) SystemByUUID(id uuid.UUID) (System, error)

SystemByUUID gets a system by its UUID. See s.System for more documentation.

func (*Session) SystemGuild

func (s *Session) SystemGuild(guildID Snowflake) (sg SystemGuild, err error)

SystemGuild returns the current system's guild settings.

func (*Session) SystemSettings

func (s *Session) SystemSettings() (settings SystemSettings, err error)

SystemSettings returns the current token's system's settings.

func (*Session) UpdateSwitchMembers

func (s *Session) UpdateSwitchMembers(id uuid.UUID, members []string) (f Front, err error)

UpdateSwitchMembers updates the given switch's members.

func (*Session) UpdateSwitchTimestamp

func (s *Session) UpdateSwitchTimestamp(id uuid.UUID, t time.Time) (f Front, err error)

UpdateSwitchTimestamp updates the given switch's timestamp.

func (*Session) UpdateSystemSettings

func (s *Session) UpdateSystemSettings(data UpdateSystemSettingsData) (settings SystemSettings, err error)

type Snowflake

type Snowflake uint64

Snowflake is a Discord snowflake

func ParseSnowflake

func ParseSnowflake(str string) (Snowflake, error)

ParseSnowflake parses a snowflake from a string.

func (Snowflake) String

func (s Snowflake) String() string

func (*Snowflake) UnmarshalJSON

func (s *Snowflake) UnmarshalJSON(v []byte) error

UnmarshalJSON ...

type Switch

type Switch struct {
	ID        uuid.UUID `json:"id"`
	Timestamp time.Time `json:"timestamp,omitempty"`
	Members   []string  `json:"members"`
}

Switch holds the info for a simple switch, as queried from /systems/{systemRef}/switches

type System

type System struct {
	ID   string    `json:"id"`
	UUID uuid.UUID `json:"uuid"`

	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Tag         string `json:"tag,omitempty"`
	AvatarURL   string `json:"avatar_url,omitempty"`
	Banner      string `json:"banner,omitempty"`
	Color       string `json:"color,omitempty"`

	Created time.Time `json:"created"`

	Privacy *SystemPrivacy `json:"privacy,omitempty"`
}

System holds all the data for a system

type SystemGuild

type SystemGuild struct {
	ProxyingEnabled bool   `json:"proxying_enabled"`
	Tag             string `json:"tag,omitempty"`
	TagEnabled      bool   `json:"tag_enabled"`
}

SystemGuild is a system's guild-specific settings

type SystemPrivacy

type SystemPrivacy struct {
	DescriptionPrivacy  Privacy `json:"description_privacy,omitempty"`
	MemberListPrivacy   Privacy `json:"member_list_privacy,omitempty"`
	GroupListPrivacy    Privacy `json:"group_list_privacy,omitempty"`
	FrontPrivacy        Privacy `json:"front_privacy,omitempty"`
	FrontHistoryPrivacy Privacy `json:"front_history_privacy,omitempty"`
}

SystemPrivacy is a system privacy object.

type SystemSettings

type SystemSettings struct {
	Timezone     string `json:"timezone"`
	PingsEnabled bool   `json:"pings_enabled"`
	LatchTimeout int    `json:"latch_timeout"`

	MemberDefaultPrivate bool `json:"member_default_private"`
	GroupDefaultPrivate  bool `json:"group_default_private"`
	ShowPrivateInfo      bool `json:"show_private_info"`

	MemberLimit int `json:"member_limit"`
	GroupLimit  int `json:"group_limit"`
}

type UpdateSystemSettingsData

type UpdateSystemSettingsData struct {
	Timezone     NullableString `json:"timezone"`
	PingsEnabled NullableBool   `json:"pings_enabled"`
	LatchTimeout NullableInt    `json:"latch_timeout"`

	MemberDefaultPrivate NullableBool `json:"member_default_private"`
	GroupDefaultPrivate  NullableBool `json:"group_default_private"`
	ShowPrivateInfo      NullableBool `json:"show_private_info"`
}

Directories

Path Synopsis
Package webhook provides support for PluralKit's dispatch webhooks.
Package webhook provides support for PluralKit's dispatch webhooks.

Jump to

Keyboard shortcuts

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