-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresponse_ffjson.go
52 lines (49 loc) · 1.05 KB
/
response_ffjson.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// DO NOT EDIT!
// Code generated by ffjson <https://github.com/pquerna/ffjson>
// source: response.go
// DO NOT EDIT!
package auth
import (
fflib "github.com/pquerna/ffjson/fflib/v1"
)
func (mj *Response) MarshalJSON() ([]byte, error) {
var buf fflib.Buffer
if mj == nil {
buf.WriteString("null")
return buf.Bytes(), nil
}
err := mj.MarshalJSONBuf(&buf)
if err != nil {
return nil, err
}
return buf.Bytes(), nil
}
func (mj *Response) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
if mj == nil {
buf.WriteString("null")
return nil
}
var err error
var obj []byte
_ = obj
_ = err
buf.WriteString(`{ `)
if len(mj.Error) != 0 {
buf.WriteString(`"error":`)
fflib.WriteJsonString(buf, string(mj.Error))
buf.WriteByte(',')
}
if len(mj.Token) != 0 {
buf.WriteString(`"token":`)
fflib.WriteJsonString(buf, string(mj.Token))
buf.WriteByte(',')
}
if len(mj.RefreshToken) != 0 {
buf.WriteString(`"refresh_token":`)
fflib.WriteJsonString(buf, string(mj.RefreshToken))
buf.WriteByte(',')
}
buf.Rewind(1)
buf.WriteByte('}')
return nil
}