providers

package
v0.92.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package providers provides provider registry and common provider interfaces.

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingConfig = fmt.Errorf("provider configs are empty")

Functions

func GetConfig

func GetConfig(name, key string) (gjson.Result, error)

func RedirectURI

func RedirectURI(name, flag string) string

func RegisterOAuthProvider added in v0.92.0

func RegisterOAuthProvider(name string, factory OAuthProviderFactory)

RegisterOAuthProvider registers a provider factory under the given name. It is typically called from a provider package's exported Register() function.

func UnregisterOAuthProvider added in v0.92.0

func UnregisterOAuthProvider(name string)

UnregisterOAuthProvider removes an OAuth provider factory from the registry.

Types

type OAuthProvider

type OAuthProvider interface {
	GetAuthorizeURL(state string) string
	GetAccessToken(ctx fiber.Ctx) (*OAuthToken, error)
}

OAuthProvider defines the interface for OAuth authorization providers. Providers construct their own authorize URLs and exchange authorization codes for typed OAuthToken values.

func GetOAuthProvider added in v0.92.0

func GetOAuthProvider(name string) (OAuthProvider, error)

GetOAuthProvider returns a new OAuthProvider instance for the named provider. It returns an error if no factory is registered for the name.

type OAuthProviderFactory added in v0.92.0

type OAuthProviderFactory func() OAuthProvider

OAuthProviderFactory is a constructor function that returns a new OAuthProvider instance, used for provider self-registration.

type OAuthRefresher added in v0.92.0

type OAuthRefresher interface {
	RefreshAccessToken(ctx context.Context, refreshToken string) (*OAuthToken, error)
}

OAuthRefresher is an optional interface implemented by OAuth providers whose access tokens expire and can be rotated via a refresh token.

type OAuthToken added in v0.92.0

type OAuthToken struct {
	Name         string     `json:"name"`
	Type         string     `json:"type"`
	AccessToken  string     `json:"access_token"`
	RefreshToken string     `json:"refresh_token,omitempty"`
	ExpiresAt    *time.Time `json:"expires_at,omitempty"`
	TokenType    string     `json:"token_type,omitempty"`
	Scope        string     `json:"scope,omitempty"`
	Extra        any        `json:"extra,omitempty"`
}

OAuthToken is a typed representation of an OAuth token returned from provider token exchange or token refresh flows.

func GetOrRefreshToken added in v0.92.0

func GetOrRefreshToken(ctx context.Context, uid types.Uid, topic, t string) (*OAuthToken, error)

GetOrRefreshToken retrieves an OAuth token for the given uid, topic, and provider type. If the stored token is expired and the provider implements OAuthRefresher, it automatically refreshes the token and persists the updated values before returning the fresh token.

Directories

Path Synopsis
Package adguard implements the AdGuard Home provider.
Package adguard implements the AdGuard Home provider.
Package archivebox implements the ArchiveBox provider.
Package archivebox implements the ArchiveBox provider.
Package drone implements the Drone CI provider.
Package drone implements the Drone CI provider.
Package dropbox implements the Dropbox provider.
Package dropbox implements the Dropbox provider.
Package email implements the email provider.
Package email implements the email provider.
Package example implements the example provider using jsonplaceholder.typicode.com for demonstration.
Package example implements the example provider using jsonplaceholder.typicode.com for demonstration.
Package fireflyiii implements the Firefly III finance provider.
Package fireflyiii implements the Firefly III finance provider.
Package gitea implements the Gitea provider.
Package gitea implements the Gitea provider.
Package github implements the GitHub API provider.
Package github implements the GitHub API provider.
Package kanboard implements the Kanboard project management provider.
Package kanboard implements the Kanboard project management provider.
Package karakeep implements the Karakeep bookmark provider.
Package karakeep implements the Karakeep bookmark provider.
Package memos implements the Memos provider for note-taking and knowledge management.
Package memos implements the Memos provider for note-taking and knowledge management.
Package miniflux implements the Miniflux RSS reader provider.
Package miniflux implements the Miniflux RSS reader provider.
Package n8n implements the n8n workflow automation provider.
Package n8n implements the n8n workflow automation provider.
Package slack implements the Slack API provider.
Package slack implements the Slack API provider.
Package slash implements the Slash provider.
Package slash implements the Slash provider.
Package transmission implements the Transmission BitTorrent provider.
Package transmission implements the Transmission BitTorrent provider.
Package trilium implements the Trilium Notes ETAPI provider.
Package trilium implements the Trilium Notes ETAPI provider.
Package uptimekuma implements the Uptime Kuma monitoring provider.
Package uptimekuma implements the Uptime Kuma monitoring provider.

Jump to

Keyboard shortcuts

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