Skip to content

Commit

Permalink
fix: fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rahmatrhd committed Jul 23, 2024
1 parent d87a10b commit 7a6d272
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions plugins/notifiers/lark/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ const (
larkHost = "https://open.larksuite.com"
)

type user struct {
ID string `json:"id"`
TeamID string `json:"team_id"`
Name string `json:"name"`
RealName string `json:"real_name"`
}

type tokenResponse struct {
OK string `json:"msg"`
Token string `json:"tenant_access_token"`
Expand Down Expand Up @@ -146,6 +139,9 @@ func (n *Notifier) findTenantAccessToken(clientId string, clientSecret string, w
AppSecret: clientSecret,
}
data, err := json.Marshal(payload)
if err != nil {
return "", err
}
req, err := http.NewRequest(http.MethodPost, larkURL, bytes.NewBuffer(data))
if err != nil {
return "", err
Expand All @@ -156,7 +152,7 @@ func (n *Notifier) findTenantAccessToken(clientId string, clientSecret string, w
return "", fmt.Errorf("error get tenant access token for workspace: %s - %s", ws.WorkspaceName, err)
}
if result.OK != "ok" {
return "", errors.New(fmt.Sprintf("could not get token for workspace: %s - %s", ws.WorkspaceName, result.OK))
return "", fmt.Errorf("could not get token for workspace: %s - %s", ws.WorkspaceName, result.OK)
}
return result.Token, nil
}
Expand Down

0 comments on commit 7a6d272

Please sign in to comment.