adapter

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidIssueType = errors.New("invalid issue type: expected *github.Issue")
	ErrInvalidPRType    = errors.New("invalid pull request type: expected *github.PullRequest")
)

Common errors for adapter operations

Functions

func ConvertIssues

func ConvertIssues(issues []*githubmodel.Issue) []*cluster.Artifact

ConvertIssues is a convenience function to convert multiple issues

func ConvertPullRequests

func ConvertPullRequests(prs []*githubmodel.PullRequest) []*cluster.Artifact

ConvertPullRequests is a convenience function to convert multiple PRs

func ParseArtifactID

func ParseArtifactID(id string) (artifactType string, number int, err error)

ParseArtifactID parses an artifact ID and returns the type and number Format: "issue-123" or "pr-456"

Types

type Adapter

type Adapter interface {
	// ConvertIssue converts a platform-specific issue to a cluster.Artifact
	ConvertIssue(issue interface{}) (*cluster.Artifact, error)

	// ConvertPullRequest converts a platform-specific pull request to a cluster.Artifact
	ConvertPullRequest(pr interface{}) (*cluster.Artifact, error)

	// GetPlatform returns the source platform identifier
	GetPlatform() cluster.SourcePlatform

	// FetchArtifacts fetches all artifacts (issues, PRs, etc.) as a standardized type from the platform
	FetchArtifacts(ctx context.Context, token, owner, repo string) ([]cluster.Artifact, error)
}

Adapter defines the interface for converting platform-specific artifacts into the standardized cluster.Artifact model

type GitHubAdapter

type GitHubAdapter struct{}

GitHubAdapter implements the Adapter interface for GitHub

func NewGitHubAdapter

func NewGitHubAdapter() *GitHubAdapter

NewGitHubAdapter creates a new GitHub adapter instance

func (*GitHubAdapter) ConvertIssue

func (a *GitHubAdapter) ConvertIssue(issue interface{}) (*cluster.Artifact, error)

ConvertIssue converts a GitHub issue to a cluster.Artifact

func (*GitHubAdapter) ConvertPullRequest

func (a *GitHubAdapter) ConvertPullRequest(pr interface{}) (*cluster.Artifact, error)

ConvertPullRequest converts a GitHub pull request to a cluster.Artifact

func (*GitHubAdapter) FetchArtifacts

func (a *GitHubAdapter) FetchArtifacts(ctx context.Context, token, owner, repo string) ([]cluster.Artifact, error)

FetchArtifacts fetches all artifacts (issues and PRs) from GitHub

func (*GitHubAdapter) GetPlatform

func (a *GitHubAdapter) GetPlatform() cluster.SourcePlatform

GetPlatform returns the GitHub platform identifier

Jump to

Keyboard shortcuts

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