Commit 0c8968fb authored by Chris's avatar Chris Committed by Corey Hulen

unnamed return (#8170)

parent ac2e42a4
...@@ -74,41 +74,23 @@ func (me *AccessData) IsExpired() bool { ...@@ -74,41 +74,23 @@ func (me *AccessData) IsExpired() bool {
} }
func (ad *AccessData) ToJson() string { func (ad *AccessData) ToJson() string {
b, err := json.Marshal(ad) b, _ := json.Marshal(ad)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func AccessDataFromJson(data io.Reader) *AccessData { func AccessDataFromJson(data io.Reader) *AccessData {
decoder := json.NewDecoder(data) var ad *AccessData
var ad AccessData json.NewDecoder(data).Decode(&ad)
err := decoder.Decode(&ad) return ad
if err == nil {
return &ad
} else {
return nil
}
} }
func (ar *AccessResponse) ToJson() string { func (ar *AccessResponse) ToJson() string {
b, err := json.Marshal(ar) b, _ := json.Marshal(ar)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func AccessResponseFromJson(data io.Reader) *AccessResponse { func AccessResponseFromJson(data io.Reader) *AccessResponse {
decoder := json.NewDecoder(data) var ar *AccessResponse
var ar AccessResponse json.NewDecoder(data).Decode(&ar)
err := decoder.Decode(&ar) return ar
if err == nil {
return &ar
} else {
return nil
}
} }
...@@ -16,23 +16,14 @@ type AnalyticsRow struct { ...@@ -16,23 +16,14 @@ type AnalyticsRow struct {
type AnalyticsRows []*AnalyticsRow type AnalyticsRows []*AnalyticsRow
func (me *AnalyticsRow) ToJson() string { func (me *AnalyticsRow) ToJson() string {
b, err := json.Marshal(me) b, _ := json.Marshal(me)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func AnalyticsRowFromJson(data io.Reader) *AnalyticsRow { func AnalyticsRowFromJson(data io.Reader) *AnalyticsRow {
decoder := json.NewDecoder(data) var me *AnalyticsRow
var me AnalyticsRow json.NewDecoder(data).Decode(&me)
err := decoder.Decode(&me) return me
if err == nil {
return &me
} else {
return nil
}
} }
func (me AnalyticsRows) ToJson() string { func (me AnalyticsRows) ToJson() string {
...@@ -44,12 +35,7 @@ func (me AnalyticsRows) ToJson() string { ...@@ -44,12 +35,7 @@ func (me AnalyticsRows) ToJson() string {
} }
func AnalyticsRowsFromJson(data io.Reader) AnalyticsRows { func AnalyticsRowsFromJson(data io.Reader) AnalyticsRows {
decoder := json.NewDecoder(data)
var me AnalyticsRows var me AnalyticsRows
err := decoder.Decode(&me) json.NewDecoder(data).Decode(&me)
if err == nil { return me
return me
} else {
return nil
}
} }
...@@ -19,21 +19,12 @@ type Audit struct { ...@@ -19,21 +19,12 @@ type Audit struct {
} }
func (o *Audit) ToJson() string { func (o *Audit) ToJson() string {
b, err := json.Marshal(o) b, _ := json.Marshal(o)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func AuditFromJson(data io.Reader) *Audit { func AuditFromJson(data io.Reader) *Audit {
decoder := json.NewDecoder(data) var o *Audit
var o Audit json.NewDecoder(data).Decode(&o)
err := decoder.Decode(&o) return o
if err == nil {
return &o
} else {
return nil
}
} }
...@@ -28,12 +28,7 @@ func (o Audits) ToJson() string { ...@@ -28,12 +28,7 @@ func (o Audits) ToJson() string {
} }
func AuditsFromJson(data io.Reader) Audits { func AuditsFromJson(data io.Reader) Audits {
decoder := json.NewDecoder(data)
var o Audits var o Audits
err := decoder.Decode(&o) json.NewDecoder(data).Decode(&o)
if err == nil { return o
return o
} else {
return nil
}
} }
...@@ -115,43 +115,25 @@ func (ad *AuthData) PreSave() { ...@@ -115,43 +115,25 @@ func (ad *AuthData) PreSave() {
} }
func (ad *AuthData) ToJson() string { func (ad *AuthData) ToJson() string {
b, err := json.Marshal(ad) b, _ := json.Marshal(ad)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func AuthDataFromJson(data io.Reader) *AuthData { func AuthDataFromJson(data io.Reader) *AuthData {
decoder := json.NewDecoder(data) var ad *AuthData
var ad AuthData json.NewDecoder(data).Decode(&ad)
err := decoder.Decode(&ad) return ad
if err == nil {
return &ad
} else {
return nil
}
} }
func (ar *AuthorizeRequest) ToJson() string { func (ar *AuthorizeRequest) ToJson() string {
b, err := json.Marshal(ar) b, _ := json.Marshal(ar)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func AuthorizeRequestFromJson(data io.Reader) *AuthorizeRequest { func AuthorizeRequestFromJson(data io.Reader) *AuthorizeRequest {
decoder := json.NewDecoder(data) var ar *AuthorizeRequest
var ar AuthorizeRequest json.NewDecoder(data).Decode(&ar)
err := decoder.Decode(&ar) return ar
if err == nil {
return &ar
} else {
return nil
}
} }
func (ad *AuthData) IsExpired() bool { func (ad *AuthData) IsExpired() bool {
......
...@@ -61,43 +61,25 @@ func (o *Channel) DeepCopy() *Channel { ...@@ -61,43 +61,25 @@ func (o *Channel) DeepCopy() *Channel {
} }
func (o *Channel) ToJson() string { func (o *Channel) ToJson() string {
b, err := json.Marshal(o) b, _ := json.Marshal(o)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func (o *ChannelPatch) ToJson() string { func (o *ChannelPatch) ToJson() string {
b, err := json.Marshal(o) b, _ := json.Marshal(o)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func ChannelFromJson(data io.Reader) *Channel { func ChannelFromJson(data io.Reader) *Channel {
decoder := json.NewDecoder(data) var o *Channel
var o Channel json.NewDecoder(data).Decode(&o)
err := decoder.Decode(&o) return o
if err == nil {
return &o
} else {
return nil
}
} }
func ChannelPatchFromJson(data io.Reader) *ChannelPatch { func ChannelPatchFromJson(data io.Reader) *ChannelPatch {
decoder := json.NewDecoder(data) var o *ChannelPatch
var o ChannelPatch json.NewDecoder(data).Decode(&o)
err := decoder.Decode(&o) return o
if err == nil {
return &o
} else {
return nil
}
} }
func (o *Channel) Etag() string { func (o *Channel) Etag() string {
......
...@@ -43,21 +43,12 @@ func (o *ChannelCounts) Etag() string { ...@@ -43,21 +43,12 @@ func (o *ChannelCounts) Etag() string {
} }
func (o *ChannelCounts) ToJson() string { func (o *ChannelCounts) ToJson() string {
b, err := json.Marshal(o) b, _ := json.Marshal(o)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func ChannelCountsFromJson(data io.Reader) *ChannelCounts { func ChannelCountsFromJson(data io.Reader) *ChannelCounts {
decoder := json.NewDecoder(data) var o *ChannelCounts
var o ChannelCounts json.NewDecoder(data).Decode(&o)
err := decoder.Decode(&o) return o
if err == nil {
return &o
} else {
return nil
}
} }
...@@ -23,21 +23,12 @@ func (o *ChannelData) Etag() string { ...@@ -23,21 +23,12 @@ func (o *ChannelData) Etag() string {
} }
func (o *ChannelData) ToJson() string { func (o *ChannelData) ToJson() string {
b, err := json.Marshal(o) b, _ := json.Marshal(o)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func ChannelDataFromJson(data io.Reader) *ChannelData { func ChannelDataFromJson(data io.Reader) *ChannelData {
decoder := json.NewDecoder(data) var o *ChannelData
var o ChannelData json.NewDecoder(data).Decode(&o)
err := decoder.Decode(&o) return o
if err == nil {
return &o
} else {
return nil
}
} }
...@@ -41,23 +41,13 @@ func (o *ChannelList) Etag() string { ...@@ -41,23 +41,13 @@ func (o *ChannelList) Etag() string {
} }
func ChannelListFromJson(data io.Reader) *ChannelList { func ChannelListFromJson(data io.Reader) *ChannelList {
decoder := json.NewDecoder(data) var o *ChannelList
var o ChannelList json.NewDecoder(data).Decode(&o)
err := decoder.Decode(&o) return o
if err == nil {
return &o
} else {
return nil
}
} }
func ChannelSliceFromJson(data io.Reader) []*Channel { func ChannelSliceFromJson(data io.Reader) []*Channel {
decoder := json.NewDecoder(data)
var o []*Channel var o []*Channel
err := decoder.Decode(&o) json.NewDecoder(data).Decode(&o)
if err == nil { return o
return o
} else {
return nil
}
} }
...@@ -49,54 +49,31 @@ func (o *ChannelMembers) ToJson() string { ...@@ -49,54 +49,31 @@ func (o *ChannelMembers) ToJson() string {
} }
func (o *ChannelUnread) ToJson() string { func (o *ChannelUnread) ToJson() string {
b, err := json.Marshal(o) b, _ := json.Marshal(o)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func ChannelMembersFromJson(data io.Reader) *ChannelMembers { func ChannelMembersFromJson(data io.Reader) *ChannelMembers {
decoder := json.NewDecoder(data) var o *ChannelMembers
var o ChannelMembers json.NewDecoder(data).Decode(&o)
err := decoder.Decode(&o) return o
if err == nil {
return &o
} else {
return nil
}
} }
func ChannelUnreadFromJson(data io.Reader) *ChannelUnread { func ChannelUnreadFromJson(data io.Reader) *ChannelUnread {
decoder := json.NewDecoder(data) var o *ChannelUnread
var o ChannelUnread json.NewDecoder(data).Decode(&o)
err := decoder.Decode(&o) return o
if err == nil {
return &o
} else {
return nil
}
} }
func (o *ChannelMember) ToJson() string { func (o *ChannelMember) ToJson() string {
b, err := json.Marshal(o) b, _ := json.Marshal(o)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func ChannelMemberFromJson(data io.Reader) *ChannelMember { func ChannelMemberFromJson(data io.Reader) *ChannelMember {
decoder := json.NewDecoder(data) var o *ChannelMember
var o ChannelMember json.NewDecoder(data).Decode(&o)
err := decoder.Decode(&o) return o
if err == nil {
return &o
} else {
return nil
}
} }
func (o *ChannelMember) IsValid() *AppError { func (o *ChannelMember) IsValid() *AppError {
......
...@@ -14,22 +14,13 @@ type ChannelSearch struct { ...@@ -14,22 +14,13 @@ type ChannelSearch struct {
// ToJson convert a Channel to a json string // ToJson convert a Channel to a json string
func (c *ChannelSearch) ToJson() string { func (c *ChannelSearch) ToJson() string {
b, err := json.Marshal(c) b, _ := json.Marshal(c)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
// ChannelSearchFromJson will decode the input and return a Channel // ChannelSearchFromJson will decode the input and return a Channel
func ChannelSearchFromJson(data io.Reader) *ChannelSearch { func ChannelSearchFromJson(data io.Reader) *ChannelSearch {
decoder := json.NewDecoder(data) var cs *ChannelSearch
var cs ChannelSearch json.NewDecoder(data).Decode(&cs)
err := decoder.Decode(&cs) return cs
if err == nil {
return &cs
} else {
return nil
}
} }
...@@ -14,21 +14,12 @@ type ChannelStats struct { ...@@ -14,21 +14,12 @@ type ChannelStats struct {
} }
func (o *ChannelStats) ToJson() string { func (o *ChannelStats) ToJson() string {
b, err := json.Marshal(o) b, _ := json.Marshal(o)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func ChannelStatsFromJson(data io.Reader) *ChannelStats { func ChannelStatsFromJson(data io.Reader) *ChannelStats {
decoder := json.NewDecoder(data) var o *ChannelStats
var o ChannelStats json.NewDecoder(data).Decode(&o)
err := decoder.Decode(&o) return o
if err == nil {
return &o
} else {
return nil
}
} }
...@@ -14,23 +14,14 @@ type ChannelView struct { ...@@ -14,23 +14,14 @@ type ChannelView struct {
} }
func (o *ChannelView) ToJson() string { func (o *ChannelView) ToJson() string {
b, err := json.Marshal(o) b, _ := json.Marshal(o)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func ChannelViewFromJson(data io.Reader) *ChannelView { func ChannelViewFromJson(data io.Reader) *ChannelView {
decoder := json.NewDecoder(data) var o *ChannelView
var o ChannelView json.NewDecoder(data).Decode(&o)
err := decoder.Decode(&o) return o
if err == nil {
return &o
} else {
return nil
}
} }
type ChannelViewResponse struct { type ChannelViewResponse struct {
...@@ -39,21 +30,12 @@ type ChannelViewResponse struct { ...@@ -39,21 +30,12 @@ type ChannelViewResponse struct {
} }
func (o *ChannelViewResponse) ToJson() string { func (o *ChannelViewResponse) ToJson() string {
b, err := json.Marshal(o) b, _ := json.Marshal(o)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func ChannelViewResponseFromJson(data io.Reader) *ChannelViewResponse { func ChannelViewResponseFromJson(data io.Reader) *ChannelViewResponse {
decoder := json.NewDecoder(data) var o *ChannelViewResponse
var o ChannelViewResponse json.NewDecoder(data).Decode(&o)
err := decoder.Decode(&o) return o
if err == nil {
return &o
} else {
return nil
}
} }
...@@ -18,12 +18,8 @@ type ClusterInfo struct { ...@@ -18,12 +18,8 @@ type ClusterInfo struct {
} }
func (me *ClusterInfo) ToJson() string { func (me *ClusterInfo) ToJson() string {
b, err := json.Marshal(me) b, _ := json.Marshal(me)
if err != nil { return string(b)
return ""
} else {
return string(b)
}
} }
func (me *ClusterInfo) Copy() *ClusterInfo { func (me *ClusterInfo) Copy() *ClusterInfo {
...@@ -32,22 +28,14 @@ func (me *ClusterInfo) Copy() *ClusterInfo { ...@@ -32,22 +28,14 @@ func (me *ClusterInfo) Copy() *ClusterInfo {
} }
func ClusterInfoFromJson(data io.Reader) *ClusterInfo { func ClusterInfoFromJson(data io.Reader) *ClusterInfo {
decoder := json