repositories

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Overview

Package repositories contains logic relating to the management of repos

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPrivateRepoForbidden is returned when creation fails due to an
	// attempt to register a private repo in a project which does not allow
	// private repos
	ErrPrivateRepoForbidden = validators.ErrPrivateRepoForbidden
	// ErrArchivedRepoForbidden is returned when creation fails due to an
	// attempt to register an archived repo
	ErrArchivedRepoForbidden = validators.ErrArchivedRepoForbidden
)
View Source
var ErrRepoNotFound = errors.New("repository not found")

ErrRepoNotFound is returned when a repository is not found

Functions

This section is empty.

Types

type RepositoryService

type RepositoryService interface {
	// CreateRepository registers a GitHub repository, including creating
	// a webhook in the repo in GitHub.
	CreateRepository(
		ctx context.Context,

		provider *db.Provider,
		projectID uuid.UUID,
		fetchByProps *properties.Properties,
	) (*pb.Repository, error)
	// DeleteByID removes the webhook and deletes the repo from the database.
	DeleteByID(
		ctx context.Context,
		repoID uuid.UUID,
		projectID uuid.UUID,
	) error
	// DeleteByName removes the webhook and deletes the repo from the database.
	// Ideally, we would take provider ID instead of name. Name is used for
	// backwards compatibility with the API endpoint which calls it.
	DeleteByName(
		ctx context.Context,
		repoOwner string,
		repoName string,
		projectID uuid.UUID,
		providerName string,
	) error

	// ListRepositories retrieves all repositories for the
	// specific provider and project.
	ListRepositories(
		ctx context.Context,
		projectID uuid.UUID,
		providerID uuid.UUID,
	) ([]*models.EntityWithProperties, error)

	// GetRepositoryById retrieves a repository by its ID and project.
	GetRepositoryById(ctx context.Context, repositoryID uuid.UUID, projectID uuid.UUID) (*pb.Repository, error)
	// GetRepositoryByName retrieves a repository by its name, owner, project and provider (if specified).
	GetRepositoryByName(
		ctx context.Context,
		repoOwner string,
		repoName string,
		projectID uuid.UUID,
		providerName string,
	) (*pb.Repository, error)
}

RepositoryService encapsulates logic related to registering and deleting repos TODO: get rid of the github client from this interface

func NewRepositoryService

func NewRepositoryService(
	store db.Store,
	propSvc service.PropertiesService,
	eventProducer interfaces.Publisher,
	providerManager manager.ProviderManager,
	entityCreator entityService.EntityCreator,
) RepositoryService

NewRepositoryService creates an instance of the RepositoryService interface

Directories

Path Synopsis
Package mock_repositories is a generated GoMock package.
Package mock_repositories is a generated GoMock package.
fixtures
Package fixtures contains code for creating RepositoryService fixtures and is used in various parts of the code.
Package fixtures contains code for creating RepositoryService fixtures and is used in various parts of the code.

Jump to

Keyboard shortcuts

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