mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
https://mattermost.atlassian.net/browse/MM-22051 ```release-note Removed the following methods/functions: (ad *AccessData) ToJson() (ar *AccessResponse) ToJson() (ar *AnalyticsRow) ToJson() (ar AnalyticsRows) ToJson() (o *Audit) ToJson() (o Audits) ToJson() (ad *AuthData) ToJson() (ar *AuthorizeRequest) ToJson() (o *ChannelPatch) ToJson() (o *ChannelsWithCount) ToJson() (o *ChannelCounts) ToJson() (o *ChannelData) ToJson() (o *ChannelMembers) ToJson() (o *ChannelUnread) ToJson() (o *ChannelUnreadAt) ToJson() (o *ChannelStats) ToJson() (o *ChannelView) ToJson() (o *ChannelViewResponse) ToJson() (o *ClusterDiscovery) ToJson() (ci *ClusterInfo) ToJson() (cs *ClusterStats) ToJson() (o *Command) ToJson() CommandListToJson(l []*Command) string (o *CommandArgs) ToJson() (cmr *CommandMoveRequest) ToJson() (o *CommandResponse) ToJson() (c *Compliance) ToJson() (c Compliances) ToJson() (o *Config) ToJson() EmojiListToJson(emojiList []*Emoji) ```
55 lines
1.6 KiB
Go
55 lines
1.6 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package model
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io"
|
|
|
|
"github.com/mattermost/mattermost-server/v6/shared/i18n"
|
|
)
|
|
|
|
type CommandArgs struct {
|
|
UserId string `json:"user_id"`
|
|
ChannelId string `json:"channel_id"`
|
|
TeamId string `json:"team_id"`
|
|
RootId string `json:"root_id"`
|
|
ParentId string `json:"parent_id"`
|
|
TriggerId string `json:"trigger_id,omitempty"`
|
|
Command string `json:"command"`
|
|
SiteURL string `json:"-"`
|
|
T i18n.TranslateFunc `json:"-"`
|
|
UserMentions UserMentionMap `json:"-"`
|
|
ChannelMentions ChannelMentionMap `json:"-"`
|
|
|
|
// DO NOT USE Session field is deprecated. MM-26398
|
|
Session Session `json:"-"`
|
|
}
|
|
|
|
func CommandArgsFromJson(data io.Reader) *CommandArgs {
|
|
var o *CommandArgs
|
|
json.NewDecoder(data).Decode(&o)
|
|
return o
|
|
}
|
|
|
|
// AddUserMention adds or overrides an entry in UserMentions with name username
|
|
// and identifier userId
|
|
func (o *CommandArgs) AddUserMention(username, userId string) {
|
|
if o.UserMentions == nil {
|
|
o.UserMentions = make(UserMentionMap)
|
|
}
|
|
|
|
o.UserMentions[username] = userId
|
|
}
|
|
|
|
// AddChannelMention adds or overrides an entry in ChannelMentions with name
|
|
// channelName and identifier channelId
|
|
func (o *CommandArgs) AddChannelMention(channelName, channelId string) {
|
|
if o.ChannelMentions == nil {
|
|
o.ChannelMentions = make(ChannelMentionMap)
|
|
}
|
|
|
|
o.ChannelMentions[channelName] = channelId
|
|
}
|