forked from koltyakov/gosip
/
field_gen.go
40 lines (32 loc) · 964 Bytes
/
field_gen.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
// Code generated by `ggen -ent Field -conf -mods Select,Expand -helpers Data,Normalized`; DO NOT EDIT.
package api
import (
"encoding/json"
)
// Conf receives custom request config definition, e.g. custom headers, custom OData mod
func (field *Field) Conf(config *RequestConfig) *Field {
field.config = config
return field
}
// Select adds $select OData modifier
func (field *Field) Select(oDataSelect string) *Field {
field.modifiers.AddSelect(oDataSelect)
return field
}
// Expand adds $expand OData modifier
func (field *Field) Expand(oDataExpand string) *Field {
field.modifiers.AddExpand(oDataExpand)
return field
}
/* Response helpers */
// Data response helper
func (fieldResp *FieldResp) Data() *FieldInfo {
data := NormalizeODataItem(*fieldResp)
res := &FieldInfo{}
json.Unmarshal(data, &res)
return res
}
// Normalized returns normalized body
func (fieldResp *FieldResp) Normalized() []byte {
return NormalizeODataItem(*fieldResp)
}