cli/api/queries_user.go
2020-07-07 17:53:40 +02:00

16 lines
295 B
Go

package api
import (
"context"
)
func CurrentLoginName(client *Client) (string, error) {
var query struct {
Viewer struct {
Login string
}
}
gql := graphQLClient(client.http)
err := gql.QueryNamed(context.Background(), "UserCurrent", &query, nil)
return query.Viewer.Login, err
}