instance

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Organization string             `json:"organization"`
	OAuth        OAuthConfig        `json:"oauth"`
	Session      auth.SessionConfig `json:"session"`
}

Config is the structure of the configuration for a single GitHub instance.

type Instance

type Instance interface {
	GetName() string
	GetOrganization() string
	TokenToCookie(token *oauth2.Token) (*http.Cookie, error)
	TokenFromCookie(r *http.Request) (*oauth2.Token, error)
	OAuthLoginURL() string
	OAuthCallback(ctx context.Context, state, code string) (*oauth2.Token, *github.User, error)
	OAuthIsAuthenticated(ctx context.Context, token *oauth2.Token) (*github.User, error)
}

func New

func New(name string, options map[string]any) (Instance, error)

New returns a new GitHub instance for the given configuration.

type MockInstance

type MockInstance struct {
	mock.Mock
}

MockInstance is an autogenerated mock type for the Instance type

func NewMockInstance

func NewMockInstance(t NewMockInstanceT) *MockInstance

NewMockInstance creates a new instance of MockInstance. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockInstance) GetName

func (_m *MockInstance) GetName() string

GetName provides a mock function with given fields:

func (*MockInstance) GetOrganization

func (_m *MockInstance) GetOrganization() string

GetOrganization provides a mock function with given fields:

func (*MockInstance) OAuthCallback

func (_m *MockInstance) OAuthCallback(ctx context.Context, state string, code string) (*oauth2.Token, *github.User, error)

OAuthCallback provides a mock function with given fields: ctx, state, code

func (*MockInstance) OAuthIsAuthenticated

func (_m *MockInstance) OAuthIsAuthenticated(ctx context.Context, token *oauth2.Token) (*github.User, error)

OAuthIsAuthenticated provides a mock function with given fields: ctx, token

func (*MockInstance) OAuthLoginURL

func (_m *MockInstance) OAuthLoginURL() string

OAuthLoginURL provides a mock function with given fields:

func (*MockInstance) TokenFromCookie

func (_m *MockInstance) TokenFromCookie(r *http.Request) (*oauth2.Token, error)

TokenFromCookie provides a mock function with given fields: r

func (*MockInstance) TokenToCookie

func (_m *MockInstance) TokenToCookie(token *oauth2.Token) (*http.Cookie, error)

TokenToCookie provides a mock function with given fields: token

type NewMockInstanceT

type NewMockInstanceT interface {
	mock.TestingT
	Cleanup(func())
}

type OAuthConfig

type OAuthConfig struct {
	ClientID     string `json:"clientID"`
	ClientSecret string `json:"clientSecret"`
	State        string `json:"state"`
}

Jump to

Keyboard shortcuts

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