package protocol import ( "spark-server/internal/pkg/i18n" "spark-server/internal/pkg/reply" ) func EncodeOK(requestID string, data any) []byte { return reply.MustMarshal(reply.StampID(reply.OK(data), requestID)) } func EncodeErr(requestID string, err error) []byte { return EncodeErrLang(requestID, i18n.Default, err) } func EncodeErrLang(requestID string, lang i18n.Lang, err error) []byte { return reply.MustMarshal(reply.StampID(reply.FromErrorLang(lang, err), requestID)) } func DecodeEnvelope(body []byte) (reply.Envelope, error) { return reply.Unmarshal(body) }