shared

package
v0.0.0-...-81fa7a2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Key    string `json:"key"`
	Value  string `json:"value"`
	Source string
}

Config bot configuration

func (*Config) Get

func (c *Config) Get(reader io.Reader) map[string]string

Get gets stored config.

func (*Config) Open

func (c *Config) Open(wd string) (io.Reader, error)

Open opens config from working directory.

func (*Config) Remove

func (c *Config) Remove() error

Remove remvoes the config.

func (*Config) Save

func (c *Config) Save()

Save saves the config to disk.

type Token

type Token struct {
	Source   string
	ID       string `json:"token"`
	ExpireAt int64  `json:"expireAt"`
	User     user   `json:"user"`
}

Token defines the token

func (*Token) Lease

func (t *Token) Lease(apiKey string)

Lease leases a new token

func (*Token) Renew

func (t *Token) Renew() Token

Renew renews a token

func (*Token) Validate

func (t *Token) Validate() (*Token, error)

Validate validates the token

type User

type User struct {
	Email    string   `json:"email"`
	ID       string   `json:"_id"`
	Name     string   `json:"name"`
	Password string   `json:"password"`
	Company  string   `json:"company"`
	Config   []Config `json:"config"`
	APIKey   string   `json:"apiKey"`
}

User Recime User

func (*User) CurrentUser

func (u *User) CurrentUser(source string, token string) User

CurrentUser gets the current user for the token.

Jump to

Keyboard shortcuts

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