Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHandlers ¶
RegisterHandlers sets up the routing of the HTTP handlers.
Types ¶
type CreateAppRequest ¶
type CreateAppRequest struct { ID string `json:"id"` Secret string `json:"secret"` Name string `json:"name"` Env string `json:"env"` Callback string `json:"callback"` CallbackSecret string `json:"callback_secret"` }
func (CreateAppRequest) Validate ¶
func (m CreateAppRequest) Validate() *response.Error
Validate validates the CreateAppRequest fields.
type ExtListResponse ¶
type FactService ¶
type FactService interface {
Request(*fact.FactRequest) (*fact.FactResponse, error)
}
FactService service to manage sending and receiving fact requests
type Repository ¶
type Repository interface { // Get returns the app with the specified app ID. Get(ctx context.Context, appID string) (entity.App, error) // Count returns the number of apps. Count(ctx context.Context) (int, error) // Create saves a new app in the storage. Create(ctx context.Context, app entity.App) error // Update updates the app with given ID in the storage. Update(ctx context.Context, app entity.App) error // Delete removes the app with given ID from the storage. Delete(ctx context.Context, id string) error // List returns a list of all entity.App List(ctx context.Context) ([]entity.App, error) // SetStatus sets the given status for a given app id. SetStatus(ctx context.Context, id, status string) error // ListByStatus returns a list of entity.App matching the given list of status ListByStatus(ctx context.Context, statuses []string) ([]entity.App, error) }
Repository encapsulates the logic to access apps from the data source.
func NewRepository ¶
func NewRepository(db *dbcontext.DB, logger log.Logger) Repository
NewRepository creates a new app repository
type Service ¶
type Service interface { List(ctx context.Context) []entity.App ListByStatus(ctx context.Context, statuses []string) ([]entity.App, error) Get(ctx context.Context, id string) (App, error) Create(ctx context.Context, input CreateAppRequest) (App, error) Update(ctx context.Context, id string, input UpdateAppRequest) (App, error) Delete(ctx context.Context, id string) (App, error) }
Service encapsulates usecase logic for apps.
func NewService ¶
NewService creates a new app service.
type UpdateAppRequest ¶
type UpdateAppRequest struct { Callback string `json:"callback"` CallbackSecret string `json:"callback_secret"` }
func (UpdateAppRequest) Validate ¶
func (m UpdateAppRequest) Validate() *response.Error
Validate validates the CreateAppRequest fields.
Click to show internal directories.
Click to hide internal directories.