креативы

This commit is contained in:
Artem Tsyrulnikov
2026-01-03 16:11:05 +03:00
parent 841a8b5aaa
commit c04faf8132
15 changed files with 597 additions and 59 deletions

View File

@@ -135,6 +135,35 @@ func (c *Client) GetJWTByTelegramID(
return resp.AccessToken, err
}
func (c *Client) GetJWTByTelegramUser(
ctx context.Context,
telegramID int64,
username *string,
firstName *string,
lastName *string,
) (string, error) {
q := url.Values{}
q.Set("telegram_id", fmt.Sprint(telegramID))
if username != nil && *username != "" {
q.Set("username", *username)
}
if firstName != nil && *firstName != "" {
q.Set("first_name", *firstName)
}
if lastName != nil && *lastName != "" {
q.Set("last_name", *lastName)
}
path := "api/v1/internal/auth/jwt?" + q.Encode()
var resp struct {
AccessToken string `json:"access_token"`
}
err := c.do(ctx, http.MethodGet, path, nil, &resp)
return resp.AccessToken, err
}
type Workspace struct {
ID string `json:"id"`
Name string `json:"name"`