mi: within.website/mi/pluralkit Index | Files

package pluralkit

import "within.website/mi/pluralkit"

Package pluralkit is a binding to the PluralKit API as documented here: https://pluralkit.me/api

Index

Package Files

client.go members.go switch.go system.go

type Client Uses

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

Client connects to the PluralKit API.

func New Uses

func New(token string, hc *http.Client) Client

New creates a new instance of the PluralKit API client.

func (Client) Do Uses

func (c Client) Do(method, pathNoSlash string, want int, post interface{}, result interface{}) error

Do is a high level wrapper for sending data to/from the PluralKit API.

func (Client) MakeRequest Uses

func (c Client) MakeRequest(method, pathNoSlash string, body io.Reader) *http.Request

MakeRequest makes a HTTP request for the PluralKit API, catting pathNoSlash to the base PluralKit API address.

func (Client) Member Uses

func (c Client) Member(id string) (Member, error)

Member fetches a given member by ID.

func (Client) RoundTrip Uses

func (c Client) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip sends an authenticated request to the PluralKit API.

func (Client) Switch Uses

func (c Client) Switch(memberIDs []string) error

Switch tells the PluralKit API who is front.

func (Client) Switches Uses

func (c Client) Switches(systemID string) ([]SwitchResponse, error)

Switches gets a historical view of switches. For pagination see SwitchesBefore.

func (Client) SwitchesBefore Uses

func (c Client) SwitchesBefore(systemID string, before time.Time) ([]SwitchResponse, error)

SwitchesBefore shows paginated views of switches.

func (Client) System Uses

func (c Client) System() (System, error)

System gets the currently authenticated system.

func (Client) SystemByID Uses

func (c Client) SystemByID(id string) (System, error)

SystemByID gets information on a system by its ID.

func (Client) SystemMembers Uses

func (c Client) SystemMembers(systemID string) ([]Member, error)

SystemMembers returns the members for a given system.

type Member Uses

type Member struct {
    ID          string     `json:"id"`
    Name        *string    `json:"name"`
    DisplayName *string    `json:"display_name"`
    Description *string    `json:"description"`
    Color       *string    `json:"color"`
    AvatarURL   *string    `json:"avatar_url"`
    Birthday    *string    `json:"birthday"`
    ProxyTags   []ProxyTag `json:"proxy_tags"`
    KeepProxy   bool       `json:"keep_proxy"`
    Created     time.Time  `json:"created"`
}

Member is an individual member of a plural system

type ProxyTag Uses

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

ProxyTags are the message encoding used for proxying messages

type SwitchResponse Uses

type SwitchResponse struct {
    Timestamp time.Time `json:"timestamp"`
    Members   []Member  `json:"members"`
}

type System Uses

type System struct {
    ID          string    `json:"id"`
    Name        *string   `json:"name"`
    Description *string   `json:"description"`
    Tag         *string   `json:"tag"`
    AvatarURL   *string   `json:"avatar_url"`
    Tz          *string   `json:"tz"`
    Created     time.Time `json:"created"`
}

System is a plural system.

Package pluralkit imports 6 packages (graph) and is imported by 1 packages. Updated 2020-02-22. Refresh now. Tools for package owners.