{"modulePath":"github.com/kobsio/kobs","version":"v0.11.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package instance\n\n## Types\n\n```go\ntype Config struct {\n\tOrganization string             `json:\"organization\"`\n\tOAuth        OAuthConfig        `json:\"oauth\"`\n\tSession      auth.SessionConfig `json:\"session\"`\n}\n```\nConfig is the structure of the configuration for a single GitHub instance.\n\n```go\ntype Instance interface {\n\tGetName() string\n\tGetOrganization() string\n\tTokenToCookie(token *oauth2.Token) (*http.Cookie, error)\n\tTokenFromCookie(r *http.Request) (*oauth2.Token, error)\n\tOAuthLoginURL() string\n\tOAuthCallback(ctx context.Context, state, code string) (*oauth2.Token, *github.User, error)\n\tOAuthIsAuthenticated(ctx context.Context, token *oauth2.Token) (*github.User, error)\n}\n```\n\n```go\nfunc New(name string, options map[string]any) (Instance, error)\n```\nNew returns a new GitHub instance for the given configuration.\n\n```go\ntype MockInstance struct {\n\tmock.Mock\n}\n```\nMockInstance is an autogenerated mock type for the Instance type\n\n```go\nfunc NewMockInstance(t NewMockInstanceT) *MockInstance\n```\nNewMockInstance creates a new instance of MockInstance. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.\n\n```go\nfunc (_m *MockInstance) GetName() string\n```\nGetName provides a mock function with given fields:\n\n```go\nfunc (_m *MockInstance) GetOrganization() string\n```\nGetOrganization provides a mock function with given fields:\n\n```go\nfunc (_m *MockInstance) OAuthCallback(ctx context.Context, state string, code string) (*oauth2.Token, *github.User, error)\n```\nOAuthCallback provides a mock function with given fields: ctx, state, code\n\n```go\nfunc (_m *MockInstance) OAuthIsAuthenticated(ctx context.Context, token *oauth2.Token) (*github.User, error)\n```\nOAuthIsAuthenticated provides a mock function with given fields: ctx, token\n\n```go\nfunc (_m *MockInstance) OAuthLoginURL() string\n```\nOAuthLoginURL provides a mock function with given fields:\n\n```go\nfunc (_m *MockInstance) TokenFromCookie(r *http.Request) (*oauth2.Token, error)\n```\nTokenFromCookie provides a mock function with given fields: r\n\n```go\nfunc (_m *MockInstance) TokenToCookie(token *oauth2.Token) (*http.Cookie, error)\n```\nTokenToCookie provides a mock function with given fields: token\n\n```go\ntype NewMockInstanceT interface {\n\tmock.TestingT\n\tCleanup(func())\n}\n```\n\n```go\ntype OAuthConfig struct {\n\tClientID     string `json:\"clientID\"`\n\tClientSecret string `json:\"clientSecret\"`\n\tState        string `json:\"state\"`\n}\n```\n\n","path":"github.com/kobsio/kobs/plugins/plugin-github/pkg/instance","name":"instance","synopsis":"","isRedistributable":true}
