Adding etag to channel extra_info api call.

Этот коммит содержится в:
Christopher Speller
2015-07-29 11:30:56 -04:00
родитель 0f54233f66
Коммит 3f97e06bf8
7 изменённых файлов: 178 добавлений и 25 удалений

Просмотреть файл

@@ -27,6 +27,7 @@ type Channel struct {
Description string `json:"description"`
LastPostAt int64 `json:"last_post_at"`
TotalMsgCount int64 `json:"total_msg_count"`
ExtraUpdateAt int64 `json:"extra_update_at"`
}
func (o *Channel) ToJson() string {
@@ -50,7 +51,11 @@ func ChannelFromJson(data io.Reader) *Channel {
}
func (o *Channel) Etag() string {
return Etag(o.Id, o.LastPostAt)
return Etag(o.Id, o.UpdateAt)
}
func (o *Channel) ExtraEtag() string {
return Etag(o.Id, o.ExtraUpdateAt)
}
func (o *Channel) IsValid() *AppError {
@@ -97,8 +102,13 @@ func (o *Channel) PreSave() {
o.CreateAt = GetMillis()
o.UpdateAt = o.CreateAt
o.ExtraUpdateAt = o.CreateAt
}
func (o *Channel) PreUpdate() {
o.UpdateAt = GetMillis()
}
func (o *Channel) ExtraUpdated() {
o.ExtraUpdateAt = GetMillis()
}

Просмотреть файл

@@ -457,8 +457,8 @@ func (c *Client) UpdateLastViewedAt(channelId string) (*Result, *AppError) {
}
}
func (c *Client) GetChannelExtraInfo(id string) (*Result, *AppError) {
if r, err := c.DoGet("/channels/"+id+"/extra_info", "", ""); err != nil {
func (c *Client) GetChannelExtraInfo(id string, etag string) (*Result, *AppError) {
if r, err := c.DoGet("/channels/"+id+"/extra_info", "", etag); err != nil {
return nil, err
} else {
return &Result{r.Header.Get(HEADER_REQUEST_ID),