This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
e621-sdk-go/e621/users.go

22 lines
539 B
Go
Raw Normal View History

2023-05-24 14:05:27 +00:00
package e621
2023-05-22 11:08:08 +00:00
import (
2023-05-24 14:05:27 +00:00
"e621_to_neo4j/e621/models"
2023-05-22 11:08:08 +00:00
"fmt"
2023-06-21 11:29:23 +00:00
log "github.com/sirupsen/logrus"
2023-05-22 11:08:08 +00:00
)
// GetUserInfo retrieves the users information from e621 API.
2023-06-17 18:51:04 +00:00
func (c *Client) GetUserInfo(username string) (models.E621User, error) {
URIPath := fmt.Sprintf("users/%s.json", username)
2023-06-21 11:29:23 +00:00
log.WithFields(log.Fields{
"username": username,
"uri": URIPath,
}).Debug("Requesting API for user details")
2023-06-17 18:51:04 +00:00
user, err := ExecuteGetAPIRequest[models.E621User](c, URIPath)
2023-05-22 11:08:08 +00:00
if err != nil {
2023-06-17 18:51:04 +00:00
return models.E621User{}, err
2023-05-22 11:08:08 +00:00
}
2023-06-17 18:51:04 +00:00
return *user, nil
2023-05-22 11:08:08 +00:00
}