func (c *Client) ListTeamRepositories(id int64, opt ListTeamRepositoriesOptions) ([]*Repository, *Response, error) {
	opt.setDefaults()
	repos := make([]*Repository, 0, opt.PageSize)
	resp, err := c.getParsedResponse("GET", fmt.Sprintf("/teams/%d/repos?%s", id, opt.getURLQuery().Encode()), nil, nil, &repos)
	return repos, resp, err
}
ListTeamRepositories lists all repositories of a team
package gitea
import (
	"bytes"
	"encoding/json"
	"fmt"
)
type Team struct {
	ID                      int64          `json:"id"`
	Name                    string         `json:"name"`
	Description             string         `json:"description"`
	Organization            *Organization  `json:"organization"`
	Permission              AccessMode     `json:"permission"`
	CanCreateOrgRepo        bool           `json:"can_create_org_repo"`
	IncludesAllRepositories bool           `json:"includes_all_repositories"`
	Units                   []RepoUnitType `json:"units"`
}
type RepoUnitType string
const (
	RepoUnitCode RepoUnitType = "repo.code"
	RepoUnitIssues RepoUnitType = "repo.issues"
	RepoUnitPulls RepoUnitType = "repo.pulls"
	RepoUnitExtIssues RepoUnitType = "repo.ext_issues"
	RepoUnitWiki RepoUnitType = "repo.wiki"
	RepoUnitExtWiki RepoUnitType = "repo.ext_wiki"
	RepoUnitReleases RepoUnitType = "repo.releases"
	RepoUnitProjects RepoUnitType = "repo.projects"
)
type ListTeamsOptions struct {
	ListOptions
}
func (c *Client) ListOrgTeams(org string, opt ListTeamsOptions) ([]*Team, *Response, error) {
	if err := escapeValidatePathSegments(&org); err != nil {
		return nil, nil, err
	}
	opt.setDefaults()
	teams := make([]*Team, 0, opt.PageSize)
	resp, err := c.getParsedResponse("GET", fmt.Sprintf("/orgs/%s/teams?%s", org, opt.getURLQuery().Encode()), nil, nil, &teams)
	return teams, resp, err
}
func (c *Client) ListMyTeams(opt *ListTeamsOptions) ([]*Team, *Response, error) {
	opt.setDefaults()
	teams := make([]*Team, 0, opt.PageSize)
	resp, err := c.getParsedResponse("GET", fmt.Sprintf("/user/teams?%s", opt.getURLQuery().Encode()), nil, nil, &teams)
	return teams, resp, err
}
func (c *Client) GetTeam(id int64) (*Team, *Response, error) {
	t := new(Team)
	resp, err := c.getParsedResponse("GET", fmt.Sprintf("/teams/%d", id), nil, nil, t)
	return t, resp, err
}
type CreateTeamOption struct {
	Name                    string         `json:"name"`
	Description             string         `json:"description"`
	Permission              AccessMode     `json:"permission"`
	CanCreateOrgRepo        bool           `json:"can_create_org_repo"`
	IncludesAllRepositories bool           `json:"includes_all_repositories"`
	Units                   []RepoUnitType `json:"units"`
}
func (opt CreateTeamOption) Validate() error {
	if opt.Permission == AccessModeOwner {
		opt.Permission = AccessModeAdmin
	} else if opt.Permission != AccessModeRead && opt.Permission != AccessModeWrite && opt.Permission != AccessModeAdmin {
		return fmt.Errorf("permission mode invalid")
	}
	if len(opt.Name) == 0 {
		return fmt.Errorf("name required")
	}
	if len(opt.Name) > 30 {
		return fmt.Errorf("name to long")
	}
	if len(opt.Description) > 255 {
		return fmt.Errorf("description to long")
	}
	return nil
}
func (c *Client) CreateTeam(org string, opt CreateTeamOption) (*Team, *Response, error) {
	if err := escapeValidatePathSegments(&org); err != nil {
		return nil, nil, err
	}
	if err := opt.Validate(); err != nil {
		return nil, nil, err
	}
	body, err := json.Marshal(&opt)
	if err != nil {
		return nil, nil, err
	}
	t := new(Team)
	resp, err := c.getParsedResponse("POST", fmt.Sprintf("/orgs/%s/teams", org), jsonHeader, bytes.NewReader(body), t)
	return t, resp, err
}
type EditTeamOption struct {
	Name                    string         `json:"name"`
	Description             *string        `json:"description"`
	Permission              AccessMode     `json:"permission"`
	CanCreateOrgRepo        *bool          `json:"can_create_org_repo"`
	IncludesAllRepositories *bool          `json:"includes_all_repositories"`
	Units                   []RepoUnitType `json:"units"`
}
func (opt EditTeamOption) Validate() error {
	if opt.Permission == AccessModeOwner {
		opt.Permission = AccessModeAdmin
	} else if opt.Permission != AccessModeRead && opt.Permission != AccessModeWrite && opt.Permission != AccessModeAdmin {
		return fmt.Errorf("permission mode invalid")
	}
	if len(opt.Name) == 0 {
		return fmt.Errorf("name required")
	}
	if len(opt.Name) > 30 {
		return fmt.Errorf("name to long")
	}
	if opt.Description != nil && len(*opt.Description) > 255 {
		return fmt.Errorf("description to long")
	}
	return nil
}
func (c *Client) EditTeam(id int64, opt EditTeamOption) (*Response, error) {
	if err := opt.Validate(); err != nil {
		return nil, err
	}
	body, err := json.Marshal(&opt)
	if err != nil {
		return nil, err
	}
	_, resp, err := c.getResponse("PATCH", fmt.Sprintf("/teams/%d", id), jsonHeader, bytes.NewReader(body))
	return resp, err
}
func (c *Client) DeleteTeam(id int64) (*Response, error) {
	_, resp, err := c.getResponse("DELETE", fmt.Sprintf("/teams/%d", id), nil, nil)
	return resp, err
}
type ListTeamMembersOptions struct {
	ListOptions
}
func (c *Client) ListTeamMembers(id int64, opt ListTeamMembersOptions) ([]*User, *Response, error) {
	opt.setDefaults()
	members := make([]*User, 0, opt.PageSize)
	resp, err := c.getParsedResponse("GET", fmt.Sprintf("/teams/%d/members?%s", id, opt.getURLQuery().Encode()), nil, nil, &members)
	return members, resp, err
}
func (c *Client) GetTeamMember(id int64, user string) (*User, *Response, error) {
	if err := escapeValidatePathSegments(&user); err != nil {
		return nil, nil, err
	}
	m := new(User)
	resp, err := c.getParsedResponse("GET", fmt.Sprintf("/teams/%d/members/%s", id, user), nil, nil, m)
	return m, resp, err
}
func (c *Client) AddTeamMember(id int64, user string) (*Response, error) {
	if err := escapeValidatePathSegments(&user); err != nil {
		return nil, err
	}
	_, resp, err := c.getResponse("PUT", fmt.Sprintf("/teams/%d/members/%s", id, user), nil, nil)
	return resp, err
}
func (c *Client) RemoveTeamMember(id int64, user string) (*Response, error) {
	if err := escapeValidatePathSegments(&user); err != nil {
		return nil, err
	}
	_, resp, err := c.getResponse("DELETE", fmt.Sprintf("/teams/%d/members/%s", id, user), nil, nil)
	return resp, err
}
type ListTeamRepositoriesOptions struct {
	ListOptions
}