refactor: python -> go
All checks were successful
ci/woodpecker/tag/release Pipeline was successful

This commit is contained in:
Felipe M 2025-04-20 13:54:22 +02:00
parent 9c78ea2d48
commit 7c684af8c3
Signed by: fmartingr
GPG key ID: CCFBC5637D4000A8
79 changed files with 3594 additions and 3257 deletions

View file

@ -0,0 +1,46 @@
package model
import (
"errors"
"net/http"
"git.nakama.town/fmartingr/butterrobot/internal/config"
)
var (
// ErrPlatform is a general platform error
ErrPlatform = errors.New("platform error")
// ErrPlatformInit is an error during platform initialization
ErrPlatformInit = errors.New("platform initialization error")
// ErrPlatformAuth is an authentication error
ErrPlatformAuth = errors.New("platform authentication error")
// ErrPlatformNotFound is returned when a requested platform doesn't exist
ErrPlatformNotFound = errors.New("platform not found")
)
// AuthResponse represents a platform authentication response
type AuthResponse struct {
Data map[string]any
StatusCode int
}
// Platform defines the interface all chat platforms must implement
type Platform interface {
// Init initializes the platform
Init(cfg *config.Config) error
// ParseIncomingMessage parses the incoming HTTP request into a Message
ParseIncomingMessage(r *http.Request) (*Message, error)
// ParseChannelNameFromRaw extracts a human-readable channel name from raw data
ParseChannelNameFromRaw(channelRaw map[string]any) string
// ParseChannelFromMessage extracts channel data from a message
ParseChannelFromMessage(body []byte) (map[string]any, error)
// SendMessage sends a message through the platform
SendMessage(msg *Message) error
}