github

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package github package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

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

Provider represents a particular VCS provider.

func New

func New(
	_ context.Context,
	logger logger.Logger,
	client *http.Client,
	tharsisURL string,
) (*Provider, error)

New creates a new Provider instance.

func (*Provider) BuildOAuthAuthorizationURL

func (p *Provider) BuildOAuthAuthorizationURL(input *types.BuildOAuthAuthorizationURLInput) (string, error)

BuildOAuthAuthorizationURL build the authorization code URL which is used to redirect the user to the VCS provider to complete OAuth flow.

func (*Provider) BuildRepositoryURL

func (p *Provider) BuildRepositoryURL(input *types.BuildRepositoryURLInput) (string, error)

BuildRepositoryURL returns the repository URL associated with the provider.

func (*Provider) CreateAccessToken

func (p *Provider) CreateAccessToken(ctx context.Context, input *types.CreateAccessTokenInput) (*types.AccessTokenPayload, error)

CreateAccessToken sends a POST request to the provider to create an access and refresh tokens that can be used to further interact with the provider's API. https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps#web-application-flow

func (*Provider) CreateWebhook

func (p *Provider) CreateWebhook(ctx context.Context, input *types.CreateWebhookInput) (*types.WebhookPayload, error)

CreateWebhook creates a webhook at the specified provider. Returns the webhook ID from the response. https://docs.github.com/en/rest/webhooks/repos#create-a-repository-webhook

func (*Provider) DefaultURL added in v0.7.0

func (p *Provider) DefaultURL() url.URL

DefaultURL returns the default API URL for this provider.

func (*Provider) DeleteWebhook

func (p *Provider) DeleteWebhook(ctx context.Context, input *types.DeleteWebhookInput) error

DeleteWebhook deletes a webhook at the specified provider. https://docs.github.com/en/rest/webhooks/repos#delete-a-repository-webhook

func (*Provider) GetArchive

func (p *Provider) GetArchive(ctx context.Context, input *types.GetArchiveInput) (*http.Response, error)

GetArchive downloads the entire repository archive for a branch or tag. https://docs.github.com/en/rest/repos/contents#download-a-repository-archive-tar

func (*Provider) GetDiff

func (p *Provider) GetDiff(ctx context.Context, input *types.GetDiffInput) (*types.GetDiffsPayload, error)

GetDiff gets the diff for a single ref (branch, tag, commit, etc.). https://docs.github.com/en/rest/commits/commits#get-a-commit

func (*Provider) GetDiffs

func (p *Provider) GetDiffs(ctx context.Context, input *types.GetDiffsInput) (*types.GetDiffsPayload, error)

GetDiffs retrieves diffs for two different refs (branches, commits, etc.) https://docs.github.com/en/rest/commits/commits#compare-two-commits

func (*Provider) GetProject

func (p *Provider) GetProject(ctx context.Context, input *types.GetProjectInput) (*types.GetProjectPayload, error)

GetProject retrieves information about a project or repository. https://docs.github.com/en/rest/repos/repos#get-a-repository

func (*Provider) MergeRequestActionIsSupported

func (p *Provider) MergeRequestActionIsSupported(action string) bool

MergeRequestActionIsSupported returns true if the merge request action is supported.

func (*Provider) TestConnection

func (p *Provider) TestConnection(ctx context.Context, input *types.TestConnectionInput) error

TestConnection simply queries for the user metadata that's associated with the access token to verify validity. https://docs.github.com/en/rest/users/users#get-the-authenticated-user

func (*Provider) ToVCSEventType

func (p *Provider) ToVCSEventType(input *types.ToVCSEventTypeInput) models.VCSEventType

ToVCSEventType determines whether the event is supported and translates the event type to VCSEventType equivalent.

Jump to

Keyboard shortcuts

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