本文整理汇总了Golang中github.com/mattermost/platform/api.CreateTeam函数的典型用法代码示例。如果您正苦于以下问题:Golang CreateTeam函数的具体用法?Golang CreateTeam怎么用?Golang CreateTeam使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CreateTeam函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: cmdCreateTeam
func cmdCreateTeam() {
if flagCmdCreateTeam {
if len(flagTeamName) == 0 {
fmt.Fprintln(os.Stderr, "flag needs an argument: -team_name")
flag.Usage()
os.Exit(1)
}
if len(flagEmail) == 0 {
fmt.Fprintln(os.Stderr, "flag needs an argument: -email")
flag.Usage()
os.Exit(1)
}
c := getMockContext()
team := &model.Team{}
team.DisplayName = flagTeamName
team.Name = flagTeamName
team.Email = flagEmail
team.Type = model.TEAM_OPEN
api.CreateTeam(c, team)
if c.Err != nil {
if c.Err.Id != "store.sql_team.save.domain_exists.app_error" {
l4g.Error("%v", c.Err)
flushLogAndExit(1)
}
}
os.Exit(0)
}
}
开发者ID:lfbrock,项目名称:platform,代码行数:33,代码来源:mattermost.go
示例2: cmdCreateTeam
func cmdCreateTeam() {
if flagCmdCreateTeam {
if len(flagTeamName) == 0 {
fmt.Fprintln(os.Stderr, "flag needs an argument: -team_name")
flag.Usage()
os.Exit(1)
}
if len(flagEmail) == 0 {
fmt.Fprintln(os.Stderr, "flag needs an argument: -email")
flag.Usage()
os.Exit(1)
}
c := &api.Context{}
c.RequestId = model.NewId()
c.IpAddress = "cmd_line"
team := &model.Team{}
team.DisplayName = flagTeamName
team.Name = flagTeamName
team.Email = flagEmail
team.Type = model.TEAM_INVITE
api.CreateTeam(c, team)
if c.Err != nil {
if c.Err.Message != "A team with that domain already exists" {
l4g.Error("%v", c.Err)
flushLogAndExit(1)
}
}
os.Exit(0)
}
}
开发者ID:cbayleOL,项目名称:platform,代码行数:35,代码来源:mattermost.go
示例3: createTeamCmdF
func createTeamCmdF(cmd *cobra.Command, args []string) error {
initDBCommandContextCobra(cmd)
name, errn := cmd.Flags().GetString("name")
if errn != nil || name == "" {
return errors.New("Name is required")
}
displayname, errdn := cmd.Flags().GetString("display_name")
if errdn != nil || displayname == "" {
return errors.New("Display Name is required")
}
email, _ := cmd.Flags().GetString("email")
useprivate, _ := cmd.Flags().GetBool("private")
teamType := model.TEAM_OPEN
if useprivate {
teamType = model.TEAM_INVITE
}
team := &model.Team{
Name: name,
DisplayName: displayname,
Email: email,
Type: teamType,
}
c := getMockContext()
api.CreateTeam(c, team)
if c.Err != nil {
return errors.New("Team creation failed: " + c.Err.Error())
}
return nil
}
开发者ID:Rudloff,项目名称:platform,代码行数:34,代码来源:team.go
注:本文中的github.com/mattermost/platform/api.CreateTeam函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论