summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/platform/model/team_signup.go
blob: e364204491506a04e6c5fdd5b244b2f4955761a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// 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)
	}
}