Documentation ¶
Index ¶
- type Provider
- func (p *Provider) BuildOAuthAuthorizationURL(input *types.BuildOAuthAuthorizationURLInput) string
- func (p *Provider) BuildRepositoryURL(input *types.BuildRepositoryURLInput) string
- func (p *Provider) CreateAccessToken(ctx context.Context, input *types.CreateAccessTokenInput) (*types.AccessTokenPayload, error)
- func (p *Provider) CreateWebhook(ctx context.Context, input *types.CreateWebhookInput) (*types.WebhookPayload, error)
- func (p *Provider) DefaultAPIHostname() string
- func (p *Provider) DeleteWebhook(ctx context.Context, input *types.DeleteWebhookInput) error
- func (p *Provider) GetArchive(ctx context.Context, input *types.GetArchiveInput) (*http.Response, error)
- func (p *Provider) GetDiff(ctx context.Context, input *types.GetDiffInput) (*types.GetDiffsPayload, error)
- func (p *Provider) GetDiffs(ctx context.Context, input *types.GetDiffsInput) (*types.GetDiffsPayload, error)
- func (p *Provider) GetProject(ctx context.Context, input *types.GetProjectInput) (*types.GetProjectPayload, error)
- func (p *Provider) MergeRequestActionIsSupported(action string) bool
- func (p *Provider) TestConnection(ctx context.Context, input *types.TestConnectionInput) error
- func (p *Provider) ToVCSEventType(input *types.ToVCSEventTypeInput) models.VCSEventType
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( ctx 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
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
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.gitlab.com/ee/api/oauth2.html#authorization-code-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.gitlab.com/ee/api/projects.html#add-project-hook
func (*Provider) DefaultAPIHostname ¶
DefaultAPIHostname returns the default API hostname for this provider.
func (*Provider) DeleteWebhook ¶
DeleteWebhook deletes a webhook at the specified provider. https://docs.gitlab.com/ee/api/projects.html#delete-project-hook
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.gitlab.com/ee/api/repositories.html#get-file-archive
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.gitlab.com/ee/api/commits.html#get-the-diff-of-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.gitlab.com/ee/api/repositories.html#compare-branches-tags-or-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.gitlab.com/ee/api/projects.html#get-single-project
func (*Provider) MergeRequestActionIsSupported ¶
MergeRequestActionIsSupported returns true if the merge request action is supported.
func (*Provider) TestConnection ¶
TestConnection simply queries for the user metadata that's associated with the access token to verify validity. https://docs.gitlab.com/ee/api/users.html#for-normal-users-1
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.