Documentation
¶
Overview ¶
Package gitlab is a wrapper around the gitlab package in the `./pkg` directory. The difference between this package and that is this package implements a processing layer so that the view layer can interact with interfaces instead of the raw API outputs.
This package also implements other app-specific things such as database table initialisations for custom implemented logic.
Index ¶
- Constants
- Variables
- func GetAccount(hostname, accessToken string) (types.Account, error)
- func GetTodos(hostname, accessToken string, since ...time.Time) (types.Notifications, error)
- func InitSQLite3Database(databasePath string) error
- func InsertNotification(todo pkggitlab.APIv4Todo, hostname string, connection *sql.DB) error
- func QueryNotification(todo pkggitlab.APIv4Todo, hostname string, connection *sql.DB) (bool, error)
- func WatchNotifications(accounts []AccountConfig, databaseConnection *sql.DB, ...) chan types.Notification
- type Account
- func (a Account) GetCreatedAt() *string
- func (a Account) GetEmail() *string
- func (a Account) GetFollowerCount() *int
- func (a Account) GetIsAdmin() *bool
- func (a Account) GetLastSeen() *string
- func (a Account) GetLink() *string
- func (a Account) GetName() *string
- func (a Account) GetProjectCount() *int
- func (a Account) GetUsername() *string
- type AccountConfig
- type AccountConfigs
- type Config
- type TodoSerializer
Constants ¶
const (
TableName = "gl_notifs"
)
Variables ¶
var SQLite3Migrations = []string{ fmt.Sprintf("ALTER TABLE `%s` ADD `notification_id` VARCHAR(32) NOT NULL DEFAULT ''", TableName), fmt.Sprintf("ALTER TABLE `%s` ADD `message` TEXT NOT NULL DEFAULT ''", TableName), fmt.Sprintf("ALTER TABLE `%s` ADD `raw` TEXT NOT NULL DEFAULT ''", TableName), fmt.Sprintf("ALTER TABLE `%s` ADD `hostname` VARCHAR(256) NOT NULL DEFAULT ''", TableName), }
Functions ¶
func InitSQLite3Database ¶ added in v0.0.4
func InsertNotification ¶ added in v0.0.4
func QueryNotification ¶ added in v0.0.4
func WatchNotifications ¶ added in v0.0.4
func WatchNotifications( accounts []AccountConfig, databaseConnection *sql.DB, updateInterval time.Duration, stop chan struct{}, ) chan types.Notification
Types ¶
type Account ¶
type Account pkg.APIv4UserResponse
Account implements types.Account
func (Account) GetCreatedAt ¶ added in v0.0.8
func (Account) GetFollowerCount ¶ added in v0.0.8
func (Account) GetIsAdmin ¶ added in v0.0.8
func (Account) GetLastSeen ¶ added in v0.0.8
func (Account) GetProjectCount ¶ added in v0.0.8
func (Account) GetUsername ¶ added in v0.0.8
type AccountConfig ¶ added in v0.0.4
type AccountConfig struct { // Name is the user-defined label for this account Name string `json:"name" yaml:"name"` // Description is a user-defined description of what this account is for Description string `json:"description" yaml:"description"` // Hostname is the hostname of the Gitlab installation. If this is not provided // this should default to "gitlab.com" Hostname string `json:"hostname" yaml:"hostname"` // AccessToken is your Gitlab Personal Access Token which can be generated // from this page at https://gitlab.com/profile/personal_access_tokens // // The required Scopes are as follows: // - read_user // - read_api // - read_repository // - read_registry AccessToken string `json:"accessToken" yaml:"accessToken"` // Public indicates whether this account should be public, if so, the /platforms // endpoint on the dev server will expose this account; this is done to accomodate // using both personal and work accounts, note that even if this is set to true, // the AccessToken should not be exposed Public bool `json:"public" yaml:"public"` }
AccountConfig defines the configuration structure for a logical Gitlab account to be consumed
func (AccountConfig) GetSanitized ¶ added in v0.0.4
func (a AccountConfig) GetSanitized() AccountConfig
GetSanitized returns a copy of this Account instance without sensitive credentials
type AccountConfigs ¶ added in v0.0.4
type AccountConfigs []AccountConfig
AccountConfigs defines a list of AccountConfig instances which can be operated on internally
func (AccountConfigs) GetSanitized ¶ added in v0.0.4
func (a AccountConfigs) GetSanitized() []AccountConfig
GetSanitized returns a copy of this AccountConfigs instance without sensitive credentials
type Config ¶
type Config struct {
Accounts AccountConfigs `json:"accounts" yaml:"accounts"`
}
Config defines the structure of the configuration for the Gitlab integration
func (Config) GetSanitized ¶
GetSanitized returns a copy of this Config instance without sensitive credentials
type TodoSerializer ¶ added in v0.0.4
func (TodoSerializer) GetMessage ¶ added in v0.0.4
func (ts TodoSerializer) GetMessage() string
func (TodoSerializer) GetTitle ¶ added in v0.0.4
func (ts TodoSerializer) GetTitle() string