28 lines
496 B
Go
28 lines
496 B
Go
|
|
package main
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/nicklaw5/helix/v2"
|
||
|
|
)
|
||
|
|
|
||
|
|
func getUsersByName(client *helix.Client, names []string) ([]helix.User, error) {
|
||
|
|
resp, err := client.GetUsers(&helix.UsersParams{
|
||
|
|
Logins: names,
|
||
|
|
})
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
return resp.Data.Users, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func getUsersByID(client *helix.Client, IDs []string) ([]helix.User, error) {
|
||
|
|
resp, err := client.GetUsers(&helix.UsersParams{
|
||
|
|
IDs: IDs,
|
||
|
|
})
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
return resp.Data.Users, nil
|
||
|
|
}
|