30 lines
560 B
Go
30 lines
560 B
Go
package pierre
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"bitbucket.bit.admin.ch/scm/~u80859501/pierre-bot/internal/chatter"
|
|
)
|
|
|
|
type Service struct {
|
|
git GitAdapter
|
|
chat ChatAdapter
|
|
}
|
|
|
|
func New(chat ChatAdapter, git GitAdapter) *Service {
|
|
return &Service{
|
|
git: git,
|
|
chat: chat,
|
|
}
|
|
}
|
|
|
|
type GitAdapter interface {
|
|
GetDiff(owner, repo string, prID int) (io.Reader, error)
|
|
AddComment(owner, repo string, prID int, comment Comment) error
|
|
}
|
|
|
|
type ChatAdapter interface {
|
|
GenerateStructured(ctx context.Context, messages []chatter.Message, target interface{}) error
|
|
}
|