provider

package
v0.0.0-...-476e770 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT Imports: 7 Imported by: 1

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

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

GetGithubEmail get user email from github

func (*GitHub) GetProfile

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

GetProfile returns a profile for a user from GitHub

type GitHubEmail

type GitHubEmail struct {
	Verified bool   `json:"verified"`
	Primary  bool   `json:"primary"`
	Email    string `json:"email"`
}

GitHubEmail represents an email registered in Github

type GitHubProfile

type GitHubProfile struct {
	ID        int       `json:"id"`
	Login     string    `json:"login"`
	Name      string    `json:"name"`
	Email     string    `json:"email"`
	Avatar    string    `json:"avatar_url"`
	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        string    `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 Profile

type Profile struct {
	ID        string    `json:"id"`
	Login     string    `json:"login"`
	Name      string    `json:"name"`
	Email     string    `json:"email"`
	Avatar    string    `json:"avatar"`
	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