nomadcode/services/core/internal/adapters/mattermost/client.go
toki 11490df648 chore: import nomadcode-core into services/core
git-subtree-dir: services/core
git-subtree-mainline: 6f5e3a119f
git-subtree-split: 6fdbc73753
2026-05-21 13:35:20 +09:00

54 lines
989 B
Go

package mattermost
import (
"context"
"log/slog"
)
type Config struct {
BaseURL string
Token string
}
type Client struct {
cfg Config
logger *slog.Logger
}
type MessageInput struct {
ChannelID string
Text string
}
type TaskNotificationInput struct {
TaskID string
Title string
Status string
Message string
}
func NewClient(cfg Config, logger *slog.Logger) *Client {
return &Client{cfg: cfg, logger: logger}
}
func (c *Client) SendMessage(ctx context.Context, input MessageInput) error {
_ = ctx
if c.logger != nil {
c.logger.Info("mattermost send message skipped", "channel_id", input.ChannelID, "text", input.Text)
}
return nil
}
func (c *Client) SendTaskNotification(ctx context.Context, input TaskNotificationInput) error {
_ = ctx
if c.logger != nil {
c.logger.Info(
"mattermost task notification skipped",
"task_id", input.TaskID,
"title", input.Title,
"status", input.Status,
"message", input.Message,
)
}
return nil
}