2024-03-24 20:52:32 +03:00
|
|
|
package gogs
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2024-04-02 22:54:15 +03:00
|
|
|
"fmt"
|
2024-03-24 20:52:32 +03:00
|
|
|
|
2024-12-07 02:35:30 +03:00
|
|
|
"go.unistack.org/micro/v3/logger"
|
|
|
|
"go.unistack.org/pkgdash/internal/configcli"
|
|
|
|
"go.unistack.org/pkgdash/internal/modules"
|
2024-03-24 20:52:32 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
type Gogs struct {
|
2024-12-07 02:35:30 +03:00
|
|
|
logger logger.Logger
|
2024-04-03 17:29:57 +03:00
|
|
|
Username string
|
|
|
|
Password string
|
2024-03-24 20:52:32 +03:00
|
|
|
}
|
|
|
|
|
2024-12-07 02:35:30 +03:00
|
|
|
func NewGogs(cfg configcli.Config, log logger.Logger) *Gogs {
|
2024-03-24 20:52:32 +03:00
|
|
|
return &Gogs{
|
2024-12-07 02:35:30 +03:00
|
|
|
logger: log,
|
2024-04-03 17:29:57 +03:00
|
|
|
Username: cfg.Source.Username,
|
2024-12-07 02:35:30 +03:00
|
|
|
Password: cfg.Source.Password,
|
2024-03-24 20:52:32 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-02 22:54:15 +03:00
|
|
|
func (g *Gogs) Name() string {
|
|
|
|
return "gogs"
|
|
|
|
}
|
|
|
|
|
2024-03-24 20:52:32 +03:00
|
|
|
func (g *Gogs) RequestOpen(ctx context.Context, branch string, path string, mod modules.Update) error {
|
2024-04-02 22:54:15 +03:00
|
|
|
return fmt.Errorf("implement me")
|
2024-03-24 20:52:32 +03:00
|
|
|
}
|
2024-12-07 02:35:30 +03:00
|
|
|
|
2024-03-24 20:52:32 +03:00
|
|
|
func (g *Gogs) RequestClose(ctx context.Context, branch string, path string) error {
|
2024-04-02 22:54:15 +03:00
|
|
|
return fmt.Errorf("implement me")
|
2024-03-24 20:52:32 +03:00
|
|
|
}
|
2024-12-07 02:35:30 +03:00
|
|
|
|
2024-03-24 20:52:32 +03:00
|
|
|
func (g *Gogs) RequestUpdate(ctx context.Context, branch string, path string, mod modules.Update) error {
|
2024-04-02 22:54:15 +03:00
|
|
|
return fmt.Errorf("implement me")
|
2024-03-24 20:52:32 +03:00
|
|
|
}
|
2024-12-07 02:35:30 +03:00
|
|
|
|
2024-03-24 20:52:32 +03:00
|
|
|
func (g *Gogs) RequestList(ctx context.Context, branch string) (map[string]string, error) {
|
2024-04-02 22:54:15 +03:00
|
|
|
return nil, fmt.Errorf("implement me")
|
2024-03-24 20:52:32 +03:00
|
|
|
}
|