github.com/haalcala/mattermost-server-change-repo/v5@v5.33.2/model/command_request.go (about)

     1  // Copyright (c) 2015-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 CommandMoveRequest struct {
    12  	TeamId string `json:"team_id"`
    13  }
    14  
    15  func CommandMoveRequestFromJson(data io.Reader) (*CommandMoveRequest, error) {
    16  	decoder := json.NewDecoder(data)
    17  	var cmr CommandMoveRequest
    18  	err := decoder.Decode(&cmr)
    19  	if err != nil {
    20  		return nil, err
    21  	}
    22  	return &cmr, nil
    23  }
    24  
    25  func (cmr *CommandMoveRequest) ToJson() string {
    26  	b, err := json.Marshal(cmr)
    27  	if err != nil {
    28  		return ""
    29  	}
    30  	return string(b)
    31  }