initial import of sources

This commit is contained in:
2022-06-29 14:31:00 +02:00
commit d5e5fd3700
31 changed files with 2274 additions and 0 deletions

33
request.go Normal file
View File

@@ -0,0 +1,33 @@
/*
*
* Copyright 2022 Oleg Borodin <borodin@unix7.org>
*
*/
package dsrpc
import (
"encoding/json"
)
type Request struct {
Method string `json:"method" msgpack:"method"`
Params any `json:"params,omitempty" msgpack:"params,omitempty"`
Auth *Auth `json:"auth,omitempty" msgpack:"auth,omitempty"`
}
func NewRequest() *Request {
req := &Request{}
req.Auth = &Auth{}
return req
}
func (this *Request) Pack() ([]byte, error) {
rBytes, err := json.Marshal(this)
return rBytes, err
}
func (this *Request) JSON() []byte {
jBytes, _ := json.Marshal(this)
return jBytes
}