provider

package
v0.0.0-...-f1c27b4 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSupportedString

func GetSupportedString() string

func IsSupported

func IsSupported(name string) bool

Types

type GitHub

type GitHub struct {
	Client *http.Client
}

GitHub provider

func NewGitHub

func NewGitHub(c *http.Client) *GitHub

NewGitHub create a new GitHub API provider

func (*GitHub) GetProfile

func (gh *GitHub) GetProfile(accessToken string) (*Profile, error)

GetProfile returns a profile for a user from GitHub

func (*GitHub) GetUserOrganizations

func (gh *GitHub) GetUserOrganizations(accessToken string) (string, error)

GetUserOrganizations using the API "List your organizations" https://developer.github.com/v3/orgs/#list-your-organizations

type GitHubProfile

type GitHubProfile struct {
	ID        int       `json:"id"`
	Login     string    `json:"login"`
	Name      string    `json:"name"`
	Email     string    `json:"email"`
	TwoFactor bool      `json:"two_factor_authentication"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

GitHubProfile represents a GitHub profile

type GitLabProfile

type GitLabProfile struct {
	ID        int       `json:"id"`
	Username  string    `json:"username"`
	Name      string    `json:"name"`
	Email     string    `json:"email"`
	TwoFactor bool      `json:"two_factor_enabled"`
	CreatedAt time.Time `json:"created_at"`
}

GitLabProfile represents a GitLabProvider profile

type GitLabProvider

type GitLabProvider struct {
	BaseURL string
	ApiURL  string
	Client  *http.Client
}

GitLabProvider provider

func NewGitLabProvider

func NewGitLabProvider(c *http.Client, baseURL string, apiURL string) *GitLabProvider

NewGitLabProvider create a new GitLabProvider API provider

func (*GitLabProvider) GetProfile

func (gl *GitLabProvider) GetProfile(accessToken string) (*Profile, error)

GetProfile returns a profile for a user from GitLabProvider

type Organization

type Organization struct {
	Login string `json:"login"`
	ID    int    `json:"id"`
}

type Profile

type Profile struct {
	ID        int       `json:"id"`
	Login     string    `json:"login"`
	Name      string    `json:"name"`
	Email     string    `json:"email"`
	TwoFactor bool      `json:"two_factor"`
	CreatedAt time.Time `json:"created_at"`
}

type Provider

type Provider interface {
	GetProfile(accessToken string) (*Profile, error)
}

Jump to

Keyboard shortcuts

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