Documentation
¶
Overview ¶
Package randomuser is the library behind the randomuser command line: the HTTP client, request shaping, and the typed data models for randomuser.me.
The Client sets a real User-Agent, paces requests so a busy session stays polite, and retries the transient failures (429 and 5xx) that any public site throws under load.
Index ¶
Constants ¶
const Host = "randomuser.me"
Host is the site this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to randomuser.me over HTTP.
type Config ¶ added in v0.1.1
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds all tunable parameters for the Client.
func DefaultConfig ¶ added in v0.1.1
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Domain ¶
type Domain struct{}
Domain is the randomuser driver.
func (Domain) Classify ¶
Classify turns an input into the canonical (type, id). Numeric input is classified as "count"; otherwise "nationality".
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type GenerateParams ¶ added in v0.1.1
GenerateParams holds all parameters for the generate API call.
type User ¶ added in v0.1.1
type User struct {
UUID string `kit:"id" json:"uuid"` // login.uuid
Name string `json:"name"` // "First Last"
Email string `json:"email"`
Phone string `json:"phone"`
Gender string `json:"gender"`
Age int `json:"age"` // dob.age
City string `json:"city"` // location.city
State string `json:"state"` // location.state
Country string `json:"country"` // location.country
Nat string `json:"nat"`
Username string `json:"username"` // login.username
}
User is one randomly generated user profile from randomuser.me.