Documentation ¶
Index ¶
- type Client
- func (c *Client) AddCapability(ctx context.Context, u *model.User, cap model.Capability) error
- func (c *Client) AddError(ctx context.Context, msg, username string) error
- func (c *Client) AddSubscription(ctx context.Context, name, repo string) error
- func (c *Client) AllRepositories(ctx context.Context, name, search string) (model.RepositoryList, error)
- func (c *Client) CancelRefByName(ctx context.Context, repoID int64, ref string) error
- func (c *Client) CancelSubmission(ctx context.Context, id int64) error
- func (c *Client) CancelTask(ctx context.Context, id int64) error
- func (c *Client) CancelTasksByPR(ctx context.Context, repository string, prID int64) error
- func (c *Client) Close() error
- func (c *Client) CountRunsForTask(ctx context.Context, taskID int64) (int64, error)
- func (c *Client) CountSubmissions(ctx context.Context, repository, sha string) (int64, error)
- func (c *Client) CountTasks(ctx context.Context, repository, sha string) (int64, error)
- func (c *Client) DeleteError(ctx context.Context, id, userID int64) error
- func (c *Client) DeleteSubscription(ctx context.Context, name, repo string) error
- func (c *Client) DeleteToken(ctx context.Context, username string) error
- func (c *Client) DisableRepository(ctx context.Context, user, name string) error
- func (c *Client) EnableRepository(ctx context.Context, user, name string) error
- func (c *Client) GetCancel(ctx context.Context, id int64) (bool, error)
- func (c *Client) GetCapabilities(ctx context.Context, u *model.User) ([]model.Capability, error)
- func (c *Client) GetErrors(ctx context.Context, name string) ([]*model.UserError, error)
- func (c *Client) GetRefByNameAndSHA(ctx context.Context, repoName, sha string) (*model.Ref, error)
- func (c *Client) GetRepository(ctx context.Context, name string) (*model.Repository, error)
- func (c *Client) GetRun(ctx context.Context, id int64) (*model.Run, error)
- func (c *Client) GetRunUI(ctx context.Context, id int64) (*model.Run, error)
- func (c *Client) GetRunsForSubmission(ctx context.Context, sub *model.Submission, page, perPage int64) ([]*model.Run, error)
- func (c *Client) GetRunsForTask(ctx context.Context, taskID, page, perPage int64) ([]*model.Run, error)
- func (c *Client) GetSession(ctx context.Context, id string) (*model.Session, error)
- func (c *Client) GetSubmissionByID(ctx context.Context, id int64) (*model.Submission, error)
- func (c *Client) GetTasksForSubmission(ctx context.Context, sub *model.Submission, page, perPage int64) ([]*model.Task, error)
- func (c *Client) GetToken(ctx context.Context, username string) (string, error)
- func (c *Client) GetUser(ctx context.Context, name string) (*model.User, error)
- func (c *Client) HasCapability(ctx context.Context, u *model.User, cap model.Capability) (bool, error)
- func (c *Client) ListRuns(ctx context.Context, repoName, sha string, page, perPage int64) ([]*model.Run, error)
- func (c *Client) ListSubmissions(ctx context.Context, page, perPage int64, repository, sha string) ([]*model.Submission, error)
- func (c *Client) ListSubscribedTasksForUser(ctx context.Context, userID, page, perPage int64) ([]*model.Task, error)
- func (c *Client) ListSubscriptions(ctx context.Context, name, search string) (model.RepositoryList, error)
- func (c *Client) ListTasks(ctx context.Context, repository, sha string, page, perPage int64) ([]*model.Task, error)
- func (c *Client) ListUsers(ctx context.Context) ([]*model.User, error)
- func (c *Client) NextQueueItem(ctx context.Context, queueName, runningOn string) (*model.QueueItem, error)
- func (c *Client) OAuthRegisterState(ctx context.Context, state string, scopes []string) error
- func (c *Client) OAuthValidateState(ctx context.Context, state string) ([]string, error)
- func (c *Client) OwnedRepositories(ctx context.Context, name, search string) (model.RepositoryList, error)
- func (c *Client) PatchUser(ctx context.Context, u *model.User) error
- func (c *Client) PrivateRepositories(ctx context.Context, name, search string) (model.RepositoryList, error)
- func (c *Client) PublicRepositories(ctx context.Context, search string) (model.RepositoryList, error)
- func (c *Client) PutQueue(ctx context.Context, qis []*model.QueueItem) ([]*model.QueueItem, error)
- func (c *Client) PutRef(ctx context.Context, ref *model.Ref) (int64, error)
- func (c *Client) PutRepositories(ctx context.Context, name string, github []*github.Repository, ...) error
- func (c *Client) PutSession(ctx context.Context, s *model.Session) error
- func (c *Client) PutStatus(ctx context.Context, runID int64, status bool, msg string) error
- func (c *Client) PutSubmission(ctx context.Context, sub *model.Submission) (*model.Submission, error)
- func (c *Client) PutTask(ctx context.Context, task *model.Task) (*model.Task, error)
- func (c *Client) PutUser(ctx context.Context, u *model.User) (*model.User, error)
- func (c *Client) RemoveCapability(ctx context.Context, u *model.User, cap model.Capability) error
- func (c *Client) RunCount(ctx context.Context, repoName, sha string) (int64, error)
- func (c *Client) SetCancel(ctx context.Context, id int64) error
- func (c *Client) ValidateToken(ctx context.Context, token string) (*model.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a datasvc client.
func (*Client) AddCapability ¶
AddCapability adds a capability for a user.
func (*Client) AddSubscription ¶
AddSubscription adds a subscription for the user.
func (*Client) AllRepositories ¶
func (c *Client) AllRepositories(ctx context.Context, name, search string) (model.RepositoryList, error)
AllRepositories lists all visible repositories by the user.
func (*Client) CancelRefByName ¶
CancelRefByName cancels all jobs for a ref by name
func (*Client) CancelSubmission ¶
CancelSubmission cancels a submission by ID.
func (*Client) CancelTask ¶
CancelTask cancels a task by id.
func (*Client) CancelTasksByPR ¶
CancelTasksByPR cancels tasks by PR ID.
func (*Client) CountRunsForTask ¶
CountRunsForTask counts all the runs associated with the task.
func (*Client) CountSubmissions ¶
CountSubmissions returns the count of all submissions that meet the optional filtering requirements.
func (*Client) CountTasks ¶
CountTasks counts the tasks with the filters applied.
func (*Client) DeleteError ¶
DeleteError removes an error.
func (*Client) DeleteSubscription ¶
DeleteSubscription removes a subscription for the user.
func (*Client) DeleteToken ¶
DeleteToken removes the existing access token and makes it available to be regenerated.
func (*Client) DisableRepository ¶
DisableRepository disabls a repository in CI for a user as owner.
func (*Client) EnableRepository ¶
EnableRepository enables a repository in CI for a user as owner.
func (*Client) GetCapabilities ¶
GetCapabilities yields the capabilities that belong to the user.
func (*Client) GetRefByNameAndSHA ¶
GetRefByNameAndSHA retrieves a ref by it's repo name and SHA
func (*Client) GetRepository ¶
GetRepository retrieves a repository by name.
func (*Client) GetRunsForSubmission ¶
func (c *Client) GetRunsForSubmission(ctx context.Context, sub *model.Submission, page, perPage int64) ([]*model.Run, error)
GetRunsForSubmission returns the runs for the given submission; with pagination
func (*Client) GetRunsForTask ¶
func (c *Client) GetRunsForTask(ctx context.Context, taskID, page, perPage int64) ([]*model.Run, error)
GetRunsForTask retrieves all the runs by task ID.
func (*Client) GetSession ¶
GetSession retrieves a session from the database by id.
func (*Client) GetSubmissionByID ¶
GetSubmissionByID returns the submission for the given ID.
func (*Client) GetTasksForSubmission ¶
func (c *Client) GetTasksForSubmission(ctx context.Context, sub *model.Submission, page, perPage int64) ([]*model.Task, error)
GetTasksForSubmission returns the tasks for the given submission; with pagination
func (*Client) GetToken ¶
GetToken returns a newly minted access token to tinyCI or error otherwise. To get a new token with this method, call the DeleteToken method first if one exists already.
func (*Client) HasCapability ¶
func (c *Client) HasCapability(ctx context.Context, u *model.User, cap model.Capability) (bool, error)
HasCapability returns true if the user has the specified capability.
func (*Client) ListRuns ¶
func (c *Client) ListRuns(ctx context.Context, repoName, sha string, page, perPage int64) ([]*model.Run, error)
ListRuns lists runs by repository name and sha
func (*Client) ListSubmissions ¶
func (c *Client) ListSubmissions(ctx context.Context, page, perPage int64, repository, sha string) ([]*model.Submission, error)
ListSubmissions lists the submissions with pagination, and an optional (just pass empty strings if undesired) repository and sha filter.
func (*Client) ListSubscribedTasksForUser ¶
func (c *Client) ListSubscribedTasksForUser(ctx context.Context, userID, page, perPage int64) ([]*model.Task, error)
ListSubscribedTasksForUser lists all the tasks for the repos the user is subscribed to.
func (*Client) ListSubscriptions ¶
func (c *Client) ListSubscriptions(ctx context.Context, name, search string) (model.RepositoryList, error)
ListSubscriptions lists the subscriptions that the user has selected.
func (*Client) ListTasks ¶
func (c *Client) ListTasks(ctx context.Context, repository, sha string, page, perPage int64) ([]*model.Task, error)
ListTasks returns the items in the task list that match the repository and sha parameters; they may also be blank to select all items. page and perPage are limiters to define pagination rules.
func (*Client) NextQueueItem ¶
func (c *Client) NextQueueItem(ctx context.Context, queueName, runningOn string) (*model.QueueItem, error)
NextQueueItem return the next queue item. The runningOn is a hostname which is provided for tracking purposes. It should be unique (but, is ultimately not necessary).
func (*Client) OAuthRegisterState ¶
OAuthRegisterState registers the oauth state in the database.
func (*Client) OAuthValidateState ¶
OAuthValidateState validates the state in the database.
func (*Client) OwnedRepositories ¶
func (c *Client) OwnedRepositories(ctx context.Context, name, search string) (model.RepositoryList, error)
OwnedRepositories lists the owned repositories by the user.
func (*Client) PrivateRepositories ¶
func (c *Client) PrivateRepositories(ctx context.Context, name, search string) (model.RepositoryList, error)
PrivateRepositories lists all visible private repositories by the user.
func (*Client) PublicRepositories ¶
func (c *Client) PublicRepositories(ctx context.Context, search string) (model.RepositoryList, error)
PublicRepositories lists all owned public repositories by the user.
func (*Client) PutRepositories ¶
func (c *Client) PutRepositories(ctx context.Context, name string, github []*github.Repository, autoCreated bool) error
PutRepositories takes a list of github repositories and adds them to the database for the user as owner.
func (*Client) PutSession ¶
PutSession adds a session to the database.
func (*Client) PutSubmission ¶
func (c *Client) PutSubmission(ctx context.Context, sub *model.Submission) (*model.Submission, error)
PutSubmission puts a submission into the datasvc. Updates the created_at time.
func (*Client) RemoveCapability ¶
RemoveCapability removes a capability from a user.