githubprovider

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

githubprovider 包提供 GitHub provider client 工厂。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientFactory

type ClientFactory struct {
	// contains filtered or unexported fields
}

ClientFactory 负责把已授权账户转换成 GitHub client。

func NewClientFactory

func NewClientFactory(cfg config.GithubAppConfig, authService *auth.ThirdPartyAuthService) *ClientFactory

NewClientFactory 创建一个新的 GitHub client 工厂。

func NewClientFactoryWithHTTPClient

func NewClientFactoryWithHTTPClient(cfg config.GithubAppConfig, authService *auth.ThirdPartyAuthService, httpClient *http.Client) *ClientFactory

NewClientFactoryWithHTTPClient 创建一个可注入自定义 HTTP client 的 GitHub client 工厂。

func (*ClientFactory) ResolveClient

func (f *ClientFactory) ResolveClient(ctx context.Context, req *ResolveClientRequest) (*ResolvedClient, error)

ResolveClient 解析用户账户并创建 GitHub client。

type OAuthProvider

type OAuthProvider struct {
	// contains filtered or unexported fields
}

OAuthProvider 实现 GitHub 用户 OAuth 授权接入。

func NewOAuthProvider

func NewOAuthProvider(cfg config.GithubAppConfig) *OAuthProvider

NewOAuthProvider 创建一个新的 GitHub OAuth provider。

func (*OAuthProvider) BuildAuthorizationURL

func (p *OAuthProvider) BuildAuthorizationURL(req *auth.StartAuthorizationRequest, state *auth.OAuthState) (string, error)

BuildAuthorizationURL 构造 GitHub 授权 URL。

func (*OAuthProvider) CompleteAuthorization

func (p *OAuthProvider) CompleteAuthorization(req *auth.CompleteAuthorizationRequest) (*auth.AuthorizationResult, error)

CompleteAuthorization 用 code 完成 GitHub 授权。

func (*OAuthProvider) ProviderCode

func (p *OAuthProvider) ProviderCode() string

ProviderCode 返回 provider 标识。

type ResolveClientRequest

type ResolveClientRequest struct {
	Selector  *auth.AuthSelector
	UserID    string
	AccountID string
}

ResolveClientRequest 表示一次 GitHub client 解析请求。

type ResolvedClient

type ResolvedClient struct {
	Client     *gogithub.Client
	Account    *auth.AuthorizedAccount
	Credential *auth.AccountCredential
	ResolvedBy string
}

ResolvedClient 表示解析后的 GitHub client 与账户信息。

Jump to

Keyboard shortcuts

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