main

mattermost/focalboard

Last updated at: 29/12/2023 09:46

team.go

TLDR

This file contains the definition of a Team struct which represents information global to a team. It also includes two methods TeamFromJSON and TeamsFromJSON for decoding JSON data into a single team object or a slice of team objects, respectively.

Classes

There are no classes in this file.

Methods

TeamFromJSON

This method takes an io.Reader object as input and decodes the JSON data into a Team object. It returns a pointer to the decoded Team.

TeamsFromJSON

This method takes an io.Reader object as input and decodes the JSON data into a slice of Team objects. It returns a pointer to the decoded slice of teams.

package model

import (
	"encoding/json"
	"io"
)

// Team is information global to a team
// swagger:model
type Team struct {
	// ID of the team
	// required: true
	ID string `json:"id"`

	// Title of the team
	// required: false
	Title string `json:"title"`

	// Token required to register new users
	// required: true
	SignupToken string `json:"signupToken"`

	// Team settings
	// required: false
	Settings map[string]interface{} `json:"settings"`

	// ID of user who last modified this
	// required: true
	ModifiedBy string `json:"modifiedBy"`

	// Updated time in miliseconds since the current epoch
	// required: true
	UpdateAt int64 `json:"updateAt"`
}

func TeamFromJSON(data io.Reader) *Team {
	var team *Team
	_ = json.NewDecoder(data).Decode(&team)
	return team
}

func TeamsFromJSON(data io.Reader) []*Team {
	var teams []*Team
	_ = json.NewDecoder(data).Decode(&teams)
	return teams
}