Documentation ¶
Index ¶
- Variables
- func GetDefaultUser() (string, error)
- func GetInstanceClientID(instance string) (string, error)
- func GetUserInstance(user string) (string, error)
- func Login(user string, opts ...Option) error
- func Ptr[T any](v T) *T
- func SavePrefs(prefs *Prefs) error
- func SetDefaultUser(user string) error
- func SetInstanceClientID(instance string, clientID string) error
- func SetUserInstance(user string, instance string) error
- type Client
- type Config
- type Option
- type Prefs
- type PrefsInstance
- type PrefsUser
Constants ¶
This section is empty.
Variables ¶
View Source
var PrefNotFound = errors.New("preference value not found")
PrefNotFound represents an error in which no preference is found.
Functions ¶
func GetDefaultUser ¶
GetDefaultUser retrieves the default user.
func GetInstanceClientID ¶
GetInstanceClientID retrieves the instance client ID.
func GetUserInstance ¶
GetUserInstance gets the user instance.
func SetInstanceClientID ¶
SetInstanceClientID sets the instance client ID.
func SetUserInstance ¶
SetUserInstance sets the user instance.
Types ¶
type Client ¶
type Client struct { Client *apiclient.GoToSocialSwaggerDocumentation Auth runtime.ClientAuthInfoWriter // contains filtered or unexported fields }
Client is a GtS API client with attached authentication credentials and rate limiter. Credentials may be no-op.
func NewAuthClient ¶
NewAuthClient creates a new authentication client.
type Prefs ¶
type Prefs struct { // Instances is a map of instance names to instance preferences. Instances map[string]PrefsInstance `json:"instances,omitempty"` // Users is a map of user usernames@domains to instance data. Users map[string]PrefsUser `json:"users,omitempty"` // DefaultUser is the username@domain of the last user we successfully // authenticated as, if there is one. DefaultUser string `json:"default_user,omitempty"` }
Prefs stores persisted preferences.
type PrefsInstance ¶
type PrefsInstance struct { // ClientID is the OAuth2 client ID on this instance. ClientID string `json:"client_id"` }
PrefsInstance stores preferences for a given instance. OAuth2 app secrets are stored in the system keychain.
Click to show internal directories.
Click to hide internal directories.