randomuser

package module
v0.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 13 Imported by: 0

README

RandomUser SDK for Go

Build Status Go Report Card Docs License

Client SDK for Random User:

This SDK currently supports the latest version of the API (currently v1.4). Previous versions are documented here:

https://randomuser.me/documentation#previous

Documentation

Index

Constants

View Source
const (
	CountryAustralia     = "AU"
	CountryBrazil        = "BR"
	CountryCanada        = "CA"
	CountryDenmark       = "DK"
	CountryFinland       = "FI"
	CountryFrance        = "FR"
	CountryGermany       = "DE"
	CountryIran          = "IR"
	CountryIreland       = "IE"
	CountryNetherlands   = "NL"
	CountryNewZealand    = "NZ"
	CountryNorway        = "NO"
	CountrySpain         = "ES"
	CountrySwitzerland   = "CH"
	CountryTurkey        = "TR"
	CountryUnitedKingdom = "GB"
	CountryUnitedStates  = "US"
)
View Source
const (
	APIURL = "https://randomuser.me/api/"
)

Variables

This section is empty.

Functions

func Countries

func Countries() []string

func IsCountry

func IsCountry(c string) bool

func RandomCountry

func RandomCountry() string

func UserToScim

func UserToScim(rUser User) scim.User

Types

type Coordinates

type Coordinates struct {
	Latitude  string `json:"latitude,omitempty"`
	Longitude string `json:"longitude,omitempty"`
}

type DateOfBirth

type DateOfBirth struct {
	Date time.Time `json:"date,omitempty"`
	Age  int       `json:"age,omitempty"`
}

type ID

type ID struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

type Info

type Info struct {
	Seed    string `json:"seed"`
	Results int    `json:"results"`
	Page    int    `json:"page"`
	Version string `json:"version"`
}

type Location

type Location struct {
	Street      Street          `json:"street,omitempty"`
	City        string          `json:"city,omitempty"`
	State       string          `json:"state,omitempty"`
	Postcode    jsonutil.String `json:"postcode,omitempty"`
	Coordinates Coordinates     `json:"coordinates,omitempty"`
	Timezone    Timezone        `json:"timezone,omitempty"`
}

type Login

type Login struct {
	UUID     string `json:"uuid,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	Salt     string `json:"salt,omitempty"`
	MD5      string `json:"md5,omitempty"`
	SHA1     string `json:"sha1,omitempty"`
	SHA256   string `json:"sha256,omitempty"`
}

type Name

type Name struct {
	Title string `json:"title"`
	First string `json:"first"`
	Last  string `json:"last"`
}

func (*Name) IsAZSimple

func (name *Name) IsAZSimple() bool

type PasswordSettings

type PasswordSettings struct {
	Special   bool
	Upper     bool
	Lower     bool
	Number    bool
	MinLength uint8
	MaxLength uint8
}

type Picture

type Picture struct {
	Large     string `json:"large,omitempty"`
	Medium    string `json:"medium,omitempty"`
	Thumbnail string `json:"thumbnail,omitempty"`
}

type Registered

type Registered struct {
	Date time.Time `json:"date,omitempty"`
	Age  int       `json:"age,omitempty"`
}

type Request

type Request struct {
	Count            uint16
	Country          string
	Gender           string
	PasswordSettings PasswordSettings
	Seed             string
}

type Results

type Results struct {
	Results []User `json:"results,omitempty"`
	Info    Info   `json:"info,omitempty"`
	Error   string `json:"error,omitempty"`
}

func GetUsers

func GetUsers(qry *Request) (Results, *http.Response, error)

type Street

type Street struct {
	Number int    `json:"number,omitempty"`
	Name   string `json:"name,omitempty"`
}

func (*Street) String

func (street *Street) String() string

type Timezone

type Timezone struct {
	Offset      string `json:"offset,omitempty"`
	Description string `json:"description,omitempty"`
}

type User

type User struct {
	Gender      string      `json:"gender,omitempty"`
	Name        Name        `json:"name,omitempty"`
	Location    Location    `json:"location,omitempty"`
	Email       string      `json:"email,omitempty"`
	Login       Login       `json:"login,omitempty"`
	DateOfBirth DateOfBirth `json:"dob,omitempty"`
	Registered  Registered  `json:"registered,omitempty"`
	Phone       string      `json:"phone,omitempty"`
	Cell        string      `json:"cell,omitempty"`
	ID          ID          `json:"id,omitempty"`
	Picture     Picture     `json:"picture,omitempty"`
	Nationality string      `json:"nat,omitempty"`
}

func (*User) CellFormatted

func (user *User) CellFormatted() string

func (*User) PhoneFormatted

func (user *User) PhoneFormatted() string

func (*User) Scim

func (user *User) Scim() scim.User

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL