datasource

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2019 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// OAUTH2_HEADER key for Oauth token in request header.
	OAUTH2_HEADER = "Authorization"

	// OAUTH2_PREFIX Prefix for Oauth token.
	OAUTH2_PREFIX = "Bearer "

	// SCOPES_HEADER key for github oauth scopes in request header.
	SCOPES_HEADER = "X-Oauth-Scopes"

	// USER_QUERY api url for current user.
	USER_QUERY = "https://api.github.com/user"

	// ORGS_QUERY api url for orgs of current user.
	ORGS_QUERY = "https://api.github.com/user/orgs"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DataSource

type DataSource interface {
	GetUser(context.Context, string) ([]byte, error)
	GetScopes(context.Context, string) ([]string, error)
	GetOrgs(context.Context, string) ([]byte, error)
	GetOrgsRepos(context.Context, string, []entity.Organization) ([][]byte, error)
	GetReposPullRequests(context.Context, string, []entity.Repository) ([][]byte, error)
}

DataSource is an interface for github apis (REST, GRAPH-QL).

type GithubRESTAPI

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

GithubRESTAPI is an implentation of data source for REST Github API v3.

func NewGithubRESTAPI added in v0.2.2

func NewGithubRESTAPI() *GithubRESTAPI

NewGithubRESTAPI constructor for GithubRESTAPI struct.

func (GithubRESTAPI) GetOrgs

func (ds GithubRESTAPI) GetOrgs(ctx context.Context, token string) ([]byte, error)

GetOrgs returns body with user orgs.

func (GithubRESTAPI) GetOrgsRepos added in v0.2.2

func (ds GithubRESTAPI) GetOrgsRepos(ctx context.Context, token string, orgs []entity.Organization) ([][]byte, error)

GetOrgsRepos returns body with orgs repos.

func (GithubRESTAPI) GetReposPullRequests added in v0.2.2

func (ds GithubRESTAPI) GetReposPullRequests(ctx context.Context, token string, repos []entity.Repository) ([][]byte, error)

GetReposPullRequests returns body with orgs repos pulls.

func (GithubRESTAPI) GetScopes

func (ds GithubRESTAPI) GetScopes(ctx context.Context, token string) ([]string, error)

GetScopes returns scopes for provided token.

func (GithubRESTAPI) GetUser

func (ds GithubRESTAPI) GetUser(ctx context.Context, token string) ([]byte, error)

GetUser returns body with user data.

Jump to

Keyboard shortcuts

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