merging
Этот коммит содержится в:
@@ -56,7 +56,7 @@ func (c *Client) DoPost(url, data, contentType string) (*http.Response, *AppErro
|
||||
rq.Header.Set("Content-Type", contentType)
|
||||
|
||||
if rp, err := c.HttpClient.Do(rq); err != nil {
|
||||
return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error())
|
||||
return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error())
|
||||
} else if rp.StatusCode >= 300 {
|
||||
return nil, AppErrorFromJson(rp.Body)
|
||||
} else {
|
||||
@@ -72,7 +72,7 @@ func (c *Client) DoApiPost(url string, data string) (*http.Response, *AppError)
|
||||
}
|
||||
|
||||
if rp, err := c.HttpClient.Do(rq); err != nil {
|
||||
return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error())
|
||||
return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error())
|
||||
} else if rp.StatusCode >= 300 {
|
||||
return nil, AppErrorFromJson(rp.Body)
|
||||
} else {
|
||||
@@ -92,7 +92,7 @@ func (c *Client) DoApiGet(url string, data string, etag string) (*http.Response,
|
||||
}
|
||||
|
||||
if rp, err := c.HttpClient.Do(rq); err != nil {
|
||||
return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error())
|
||||
return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error())
|
||||
} else if rp.StatusCode == 304 {
|
||||
return rp, nil
|
||||
} else if rp.StatusCode >= 300 {
|
||||
@@ -298,7 +298,7 @@ func (c *Client) login(m map[string]string) (*Result, *AppError) {
|
||||
sessionToken := getCookie(SESSION_COOKIE_TOKEN, r)
|
||||
|
||||
if c.AuthToken != sessionToken.Value {
|
||||
NewAppError("/users/login", "Authentication tokens didn't match", "")
|
||||
NewLocAppError("/users/login", "model.client.login.app_error", nil, "")
|
||||
}
|
||||
|
||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||
@@ -479,7 +479,7 @@ func (c *Client) TestEmail(config *Config) (*Result, *AppError) {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) GetAnalytics(teamId, name string) (*Result, *AppError) {
|
||||
func (c *Client) GetTeamAnalytics(teamId, name string) (*Result, *AppError) {
|
||||
if r, err := c.DoApiGet("/admin/analytics/"+teamId+"/"+name, "", ""); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
@@ -488,6 +488,15 @@ func (c *Client) GetAnalytics(teamId, name string) (*Result, *AppError) {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) GetSystemAnalytics(name string) (*Result, *AppError) {
|
||||
if r, err := c.DoApiGet("/admin/analytics/"+name, "", ""); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||
r.Header.Get(HEADER_ETAG_SERVER), AnalyticsRowsFromJson(r.Body)}, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) CreateChannel(channel *Channel) (*Result, *AppError) {
|
||||
if r, err := c.DoApiPost("/channels/create", channel.ToJson()); err != nil {
|
||||
return nil, err
|
||||
@@ -735,7 +744,7 @@ func (c *Client) UploadFile(url string, data []byte, contentType string) (*Resul
|
||||
}
|
||||
|
||||
if rp, err := c.HttpClient.Do(rq); err != nil {
|
||||
return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error())
|
||||
return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error())
|
||||
} else if rp.StatusCode >= 300 {
|
||||
return nil, AppErrorFromJson(rp.Body)
|
||||
} else {
|
||||
@@ -757,7 +766,7 @@ func (c *Client) GetFile(url string, isFullUrl bool) (*Result, *AppError) {
|
||||
}
|
||||
|
||||
if rp, err := c.HttpClient.Do(rq); err != nil {
|
||||
return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error())
|
||||
return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error())
|
||||
} else if rp.StatusCode >= 300 {
|
||||
return nil, AppErrorFromJson(rp.Body)
|
||||
} else {
|
||||
@@ -775,7 +784,7 @@ func (c *Client) GetFileInfo(url string) (*Result, *AppError) {
|
||||
}
|
||||
|
||||
if rp, err := c.HttpClient.Do(rq); err != nil {
|
||||
return nil, NewAppError(url, "We encountered an error while connecting to the server", err.Error())
|
||||
return nil, NewLocAppError(url, "model.client.connecting.app_error", nil, err.Error())
|
||||
} else if rp.StatusCode >= 300 {
|
||||
return nil, AppErrorFromJson(rp.Body)
|
||||
} else {
|
||||
|
||||
Ссылка в новой задаче
Block a user