mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-10 13:20:27 +00:00
41 lines
693 B
Go
41 lines
693 B
Go
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
package model
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"io"
|
|
)
|
|
|
|
type TeamSignup struct {
|
|
Team Team `json:"team"`
|
|
User User `json:"user"`
|
|
Invites []string `json:"invites"`
|
|
Data string `json:"data"`
|
|
Hash string `json:"hash"`
|
|
}
|
|
|
|
func TeamSignupFromJson(data io.Reader) *TeamSignup {
|
|
decoder := json.NewDecoder(data)
|
|
var o TeamSignup
|
|
err := decoder.Decode(&o)
|
|
if err == nil {
|
|
return &o
|
|
} else {
|
|
fmt.Println(err)
|
|
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func (o *TeamSignup) ToJson() string {
|
|
b, err := json.Marshal(o)
|
|
if err != nil {
|
|
return ""
|
|
} else {
|
|
return string(b)
|
|
}
|
|
}
|