sdk

package
v0.0.0-...-e7f9bc8 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package sdk provides a GitHub provider implementation using the go-github SDK.

This package implements the GitHubProvider interface by wrapping the github.com/google/go-github/v67 SDK, providing a consistent API for interacting with GitHub repositories, issues, pull requests, and workflows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*config) error

Option configures the SDK provider.

func WithClient

func WithClient(client *github.Client) Option

WithClient sets a custom GitHub client for the SDK provider. This allows full control over the HTTP client configuration, authentication, and other advanced settings.

func WithToken

func WithToken(token string) Option

WithToken sets the authentication token for the SDK provider.

type SDKProvider

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

SDKProvider implements GitHubProvider using the go-github SDK.

func NewSDKProvider

func NewSDKProvider(opts ...Option) (*SDKProvider, error)

NewSDKProvider creates a provider using the GitHub SDK.

Example with token authentication:

provider, err := sdk.NewSDKProvider(sdk.WithToken("ghp_..."))

Example with custom client:

httpClient := &http.Client{Timeout: 30 * time.Second}
ghClient := github.NewClient(httpClient)
provider, err := sdk.NewSDKProvider(sdk.WithClient(ghClient))

func (*SDKProvider) AddLabels

func (s *SDKProvider) AddLabels(ctx context.Context, owner, repo string, number int, labels []string) error

AddLabels adds labels to an issue.

func (*SDKProvider) CloseIssue

func (s *SDKProvider) CloseIssue(ctx context.Context, owner, repo string, number int) error

CloseIssue closes an issue.

func (*SDKProvider) CreateIssue

func (s *SDKProvider) CreateIssue(ctx context.Context, owner, repo string, opts gh.CreateIssueOptions) (*gh.IssueData, error)

CreateIssue creates a new issue.

func (*SDKProvider) CreatePullRequest

func (s *SDKProvider) CreatePullRequest(ctx context.Context, owner, repo string, opts gh.CreatePullRequestOptions) (*gh.PullRequestData, error)

CreatePullRequest creates a new pull request.

func (*SDKProvider) CreateRepository

func (s *SDKProvider) CreateRepository(ctx context.Context, owner string, opts gh.CreateRepositoryOptions) (*gh.RepositoryData, error)

CreateRepository creates a new repository.

func (*SDKProvider) GetIssue

func (s *SDKProvider) GetIssue(ctx context.Context, owner, repo string, number int) (*gh.IssueData, error)

GetIssue retrieves a specific issue by number.

func (*SDKProvider) GetPullRequest

func (s *SDKProvider) GetPullRequest(ctx context.Context, owner, repo string, number int) (*gh.PullRequestData, error)

GetPullRequest retrieves a specific pull request by number.

func (*SDKProvider) GetRepository

func (s *SDKProvider) GetRepository(ctx context.Context, owner, repo string) (*gh.RepositoryData, error)

GetRepository retrieves repository information.

func (*SDKProvider) GetWorkflowRun

func (s *SDKProvider) GetWorkflowRun(ctx context.Context, owner, repo string, runID int64) (*gh.WorkflowRunData, error)

GetWorkflowRun retrieves a specific workflow run by ID.

func (*SDKProvider) GetWorkflowRunJobs

func (s *SDKProvider) GetWorkflowRunJobs(ctx context.Context, owner, repo string, runID int64) ([]*gh.WorkflowJobData, error)

GetWorkflowRunJobs retrieves the jobs for a specific workflow run.

func (*SDKProvider) ListIssues

func (s *SDKProvider) ListIssues(ctx context.Context, owner, repo string, opts gh.ListIssuesOptions) ([]*gh.IssueData, error)

ListIssues lists issues for a repository with optional filtering.

func (*SDKProvider) ListPullRequests

func (s *SDKProvider) ListPullRequests(ctx context.Context, owner, repo string, opts gh.ListPullRequestsOptions) ([]*gh.PullRequestData, error)

ListPullRequests lists pull requests for a repository with optional filtering.

func (*SDKProvider) ListRepositories

func (s *SDKProvider) ListRepositories(ctx context.Context, owner string, opts gh.ListOptions) ([]*gh.RepositoryData, error)

ListRepositories lists repositories for the given owner.

func (*SDKProvider) ListWorkflowRuns

func (s *SDKProvider) ListWorkflowRuns(ctx context.Context, owner, repo string, opts gh.ListWorkflowRunsOptions) ([]*gh.WorkflowRunData, error)

ListWorkflowRuns lists workflow runs for a repository with optional filtering.

func (*SDKProvider) MergePullRequest

func (s *SDKProvider) MergePullRequest(ctx context.Context, owner, repo string, number int, opts gh.MergePullRequestOptions) error

MergePullRequest merges a pull request.

func (*SDKProvider) RemoveLabel

func (s *SDKProvider) RemoveLabel(ctx context.Context, owner, repo string, number int, label string) error

RemoveLabel removes a label from an issue.

func (*SDKProvider) TriggerWorkflow

func (s *SDKProvider) TriggerWorkflow(ctx context.Context, owner, repo, workflowFileName string, ref string, inputs map[string]interface{}) error

TriggerWorkflow manually triggers a workflow run.

func (*SDKProvider) UpdateIssue

func (s *SDKProvider) UpdateIssue(ctx context.Context, owner, repo string, number int, opts gh.UpdateIssueOptions) (*gh.IssueData, error)

UpdateIssue updates an existing issue.

func (*SDKProvider) UpdatePullRequest

func (s *SDKProvider) UpdatePullRequest(ctx context.Context, owner, repo string, number int, opts gh.UpdatePullRequestOptions) (*gh.PullRequestData, error)

UpdatePullRequest updates an existing pull request.

Jump to

Keyboard shortcuts

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