Removing old signup team API (#4950)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
b3f2ab654e
Коммит
635628cf30
@@ -299,22 +299,6 @@ func (c *Client) GetPing() (map[string]string, *AppError) {
|
||||
|
||||
// Team Routes Section
|
||||
|
||||
// SignupTeam sends an email with a team sign-up link to the provided address if email
|
||||
// verification is enabled, otherwise it returns a map with a "follow_link" entry
|
||||
// containing the team sign-up link.
|
||||
func (c *Client) SignupTeam(email string, displayName string) (*Result, *AppError) {
|
||||
m := make(map[string]string)
|
||||
m["email"] = email
|
||||
m["display_name"] = displayName
|
||||
if r, err := c.DoApiPost("/teams/signup", MapToJson(m)); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
defer closeBody(r)
|
||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
||||
}
|
||||
}
|
||||
|
||||
// CreateTeam creates a team based on the provided Team struct. On success it returns
|
||||
// the Team struct with the Id, CreateAt and other server-decided fields populated.
|
||||
func (c *Client) CreateTeam(team *Team) (*Result, *AppError) {
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTeamSignupJson(t *testing.T) {
|
||||
team := Team{Id: NewId(), DisplayName: NewId()}
|
||||
o := TeamSignup{Team: team, Data: "data"}
|
||||
json := o.ToJson()
|
||||
ro := TeamSignupFromJson(strings.NewReader(json))
|
||||
|
||||
if o.Team.Id != ro.Team.Id {
|
||||
t.Fatal("Ids do not match")
|
||||
}
|
||||
}
|
||||
Ссылка в новой задаче
Block a user