social

package module
v0.0.0-...-94dab28 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2017 License: MIT Imports: 3 Imported by: 0

README

Go-Social

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials interface {
	ProviderID() string
	ProviderUserID() string
	AccessToken() string
	AccessTokenSecret() string
	RefreshToken() string
	ExpiresAt() *time.Time
	Permission() Permission
	SetPermission(string)
}

type OAuth

type OAuth interface {
	ProviderID() string

	// Authorization URL to start OAuth process and retrieve a request token
	AuthCodeURL(r *http.Request, claims map[string]interface{}) (string, error)

	// Request an access token from a request token to complete authentication
	Exchange(ctx context.Context, r *http.Request) ([]Credentials, error)
}

type Permission

type Permission int
const (
	PermissionNone Permission = iota
	PermissionRead
	PermissionWrite
	PermissionReadWrite
)

func PermissionFromString

func PermissionFromString(text string) Permission

func (Permission) MarshalText

func (p Permission) MarshalText() ([]byte, error)

func (Permission) String

func (p Permission) String() string

func (*Permission) UnmarshalText

func (p *Permission) UnmarshalText(text []byte) error

type Post

type Post struct {
	ID       string `json:"id"`
	Provider string `json:"provider"`
	URL      string `json:"url"`

	Author    User   `json:"author"`
	Contents  string `json:"contents"`
	NumShares int32  `json:"num_shares"`
	NumLikes  int32  `json:"num_likes"`

	Tags  []string `json:"tags"`
	Links []string `json:"links"`

	PublishedAt *time.Time `json:"published_at,omitempty"`
	UpdatedAt   *time.Time `json:"updated_at,omitempty"`

	Raw interface{}
}

Post is a normalized `post` object across multiple providers. As normalized as possible. The original data is available in Raw

type Posts

type Posts []*Post

func (*Posts) Add

func (ps *Posts) Add(post ...*Post)

type User

type User struct {
	Provider     string     `json:"provider" url:"provider"`
	ID           string     `json:"id" url:"id"`
	Username     string     `json:"username" url:"username"`
	Name         string     `json:"name" url:"name"`
	Email        string     `json:"email" url:"email"`
	ProfileURL   string     `json:"profile_url" url:"profile_url"`
	AvatarURL    string     `json:"avatar_url" url:"avatar_url"`
	NumPosts     int32      `json:"num_posts" url:"num_posts"`
	NumFollowers int32      `json:"num_followers" url:"num_folowers"`
	NumFollowing int32      `json:"num_following" url:"num_following"`
	Lang         string     `json:"lang" url:"lang"`
	Location     string     `json:"location" url:"location"`
	Timezone     string     `json:"timezone" url:"timezone"`
	Private      bool       `json:"private" url:"private"`
	LastSyncAt   *time.Time `json:"last_sync_at" url:"last_sync_at"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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