github.com/wgh-/mattermost-server@v4.8.0-rc2+incompatible/model/channel_view.go (about)

     1  // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package model
     5  
     6  import (
     7  	"encoding/json"
     8  	"io"
     9  )
    10  
    11  type ChannelView struct {
    12  	ChannelId     string `json:"channel_id"`
    13  	PrevChannelId string `json:"prev_channel_id"`
    14  }
    15  
    16  func (o *ChannelView) ToJson() string {
    17  	b, _ := json.Marshal(o)
    18  	return string(b)
    19  }
    20  
    21  func ChannelViewFromJson(data io.Reader) *ChannelView {
    22  	var o *ChannelView
    23  	json.NewDecoder(data).Decode(&o)
    24  	return o
    25  }
    26  
    27  type ChannelViewResponse struct {
    28  	Status            string           `json:"status"`
    29  	LastViewedAtTimes map[string]int64 `json:"last_viewed_at_times"`
    30  }
    31  
    32  func (o *ChannelViewResponse) ToJson() string {
    33  	b, _ := json.Marshal(o)
    34  	return string(b)
    35  }
    36  
    37  func ChannelViewResponseFromJson(data io.Reader) *ChannelViewResponse {
    38  	var o *ChannelViewResponse
    39  	json.NewDecoder(data).Decode(&o)
    40  	return o
    41  }