git-subtree-dir: services/core git-subtree-mainline:6f5e3a119fgit-subtree-split:6fdbc73753
60 lines
1.2 KiB
Go
60 lines
1.2 KiB
Go
package plane
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"log/slog"
|
|
)
|
|
|
|
var ErrNotImplemented = errors.New("plane adapter not implemented")
|
|
|
|
type Config struct {
|
|
BaseURL string
|
|
Token string
|
|
}
|
|
|
|
type Client struct {
|
|
cfg Config
|
|
logger *slog.Logger
|
|
}
|
|
|
|
type CreateIssueInput struct {
|
|
Title string
|
|
Description string
|
|
}
|
|
|
|
type AddCommentInput struct {
|
|
IssueID string
|
|
Body string
|
|
}
|
|
|
|
type UpdateIssueStatusInput struct {
|
|
IssueID string
|
|
Status string
|
|
}
|
|
|
|
func NewClient(cfg Config, logger *slog.Logger) *Client {
|
|
return &Client{cfg: cfg, logger: logger}
|
|
}
|
|
|
|
func (c *Client) CreateIssue(ctx context.Context, input CreateIssueInput) error {
|
|
c.log(ctx, "plane create issue skipped", "title", input.Title)
|
|
return ErrNotImplemented
|
|
}
|
|
|
|
func (c *Client) AddComment(ctx context.Context, input AddCommentInput) error {
|
|
c.log(ctx, "plane add comment skipped", "issue_id", input.IssueID)
|
|
return ErrNotImplemented
|
|
}
|
|
|
|
func (c *Client) UpdateIssueStatus(ctx context.Context, input UpdateIssueStatusInput) error {
|
|
c.log(ctx, "plane update issue status skipped", "issue_id", input.IssueID, "status", input.Status)
|
|
return ErrNotImplemented
|
|
}
|
|
|
|
func (c *Client) log(ctx context.Context, message string, args ...any) {
|
|
_ = ctx
|
|
if c.logger != nil {
|
|
c.logger.Info(message, args...)
|
|
}
|
|
}
|