datasource

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2019 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

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)
}

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

type GithubRESTAPI

type GithubRESTAPI struct {
}

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

func (GithubRESTAPI) GetOrgs

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

GetOrgs returns body of request to "https://api.github.com/organizations" for provided Github API access token. Access token should be presented as string. Body is presented as byte array. If http.Get or bodyutil.ReadResponseBody occurs any error, this will be returned.

func (GithubRESTAPI) GetScopes

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

GetScopes returns scopes provided Github API access token. Access token should be presented as string. Scopes is presented as string array. If http.Get or headerutil.ReadResponseHeader occurs any error, this will be returned.

func (GithubRESTAPI) GetUser

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

GetUser returns body of request to "https://api.github.com/user" for provided Github API access token. Access token should be presented as string. Body is presented as byte array. If http.Get or bodyutil.ReadResponseBody occurs any error, this will be returned.

Jump to

Keyboard shortcuts

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