Documentation
¶
Index ¶
Constants ¶
View Source
const ( HubAPIEndpointScheme = "https://" HubAPIEndpointDomain = "huggingface.co" )
Variables ¶
This section is empty.
Functions ¶
func IsHfAPIError ¶
Types ¶
type HfAPI ¶
type HfAPI interface {
WhoAmI(ctx context.Context, token string) (*HfAPIWhoAmIResponse, error)
}
type HfAPIAccessToken ¶
type HfAPIClient ¶
type HfAPIClient struct {
// contains filtered or unexported fields
}
func (*HfAPIClient) GetTokenPermission ¶
Documentations: https://huggingface.co/docs/huggingface_hub/quick-start#authentication Source code: https://github.com/huggingface/huggingface_hub/blob/8d1ffc6d78827aa18c4fec3f73843ac7bb64a153/src/huggingface_hub/hf_api.py#L1609-L1629 References: - https://github.com/huggingface/huggingface_hub/blob/8d1ffc6d78827aa18c4fec3f73843ac7bb64a153/src/huggingface_hub/_login.py#L50-L115 - https://github.com/huggingface/huggingface_hub/blob/8d1ffc6d78827aa18c4fec3f73843ac7bb64a153/src/huggingface_hub/_login.py#L299-L330
func (*HfAPIClient) WhoAmI ¶
func (c *HfAPIClient) WhoAmI(ctx context.Context, token string) (*HfAPIWhoAmIResponse, error)
WhoAmI returns the current user.
type HfAPIError ¶
type HfAPIError struct {
HfAPIErrorResponse
}
func (*HfAPIError) Error ¶
func (e *HfAPIError) Error() string
type HfAPIErrorResponse ¶
type HfAPIErrorResponse struct {
Error string `json:"error"`
}
type HfAPIWhoAmIResponse ¶
type HfAPIWhoAmIResponse struct {
Auth HfAPIWhoAmIResponseAuth `json:"auth"`
AvatarURL string `json:"avatarUrl"`
CanPay bool `json:"canPay"`
Email string `json:"email"`
EmailVerified bool `json:"emailVerified"`
Fullname string `json:"fullname"`
ID string `json:"id"`
IsPro bool `json:"isPro"`
Name string `json:"name"`
Type string `json:"type"`
}
type HfAPIWhoAmIResponseAuth ¶
type HfAPIWhoAmIResponseAuth struct {
AccessToken HfAPIAccessToken `json:"accessToken"`
Type string `json:"type"`
}
Click to show internal directories.
Click to hide internal directories.