package plugin import ( "encoding/json" "strings" ) func OKEnvelope(value any) ([]byte, error) { raw, err := json.Marshal(value) if err != nil { return nil, err } return json.Marshal(Envelope{OK: true, Result: raw}) } func ErrorEnvelope(code, message string, status int) []byte { raw, _ := json.Marshal(Envelope{ OK: false, Error: &EnvelopeError{ Code: strings.TrimSpace(code), Message: strings.TrimSpace(message), HTTPStatus: status, }, }) return raw }