Documentation
¶
Index ¶
- func GetFilm(urls []string) (*[]*FilmResolver, error)
- func GetIDFromURL(url string) int32
- func GetPerson(urls []string) (*[]*PersonResolver, error)
- func GetPlanet(urls []string) (*[]*PlanetResolver, error)
- func GetSpecies(urls []string) (*[]*SpeciesResolver, error)
- func GetStarship(urls []string) (*[]*StarshipResolver, error)
- func GetURL(url string, out interface{}) error
- func GetVehicle(urls []string) (*[]*VehicleResolver, error)
- func SearchFilm(url string) (*[]*FilmResolver, error)
- func SearchPerson(url string) (*[]*PersonResolver, error)
- func SearchPlanet(url string) (*[]*PlanetResolver, error)
- func SearchSpecies(url string) (*[]*SpeciesResolver, error)
- func SearchStarship(url string) (*[]*StarshipResolver, error)
- func SearchVehicle(url string) (*[]*VehicleResolver, error)
- func SplitAndTrim(s string) *[]string
- type FilmResolver
- type InfoResolver
- type PersonResolver
- func (p *PersonResolver) Films() (*[]*FilmResolver, error)
- func (p *PersonResolver) Homeworld() (*[]*PlanetResolver, error)
- func (p *PersonResolver) ID() int32
- func (p *PersonResolver) Species() (*[]*SpeciesResolver, error)
- func (p *PersonResolver) Starships() (*[]*StarshipResolver, error)
- func (p *PersonResolver) Vehicles() (*[]*VehicleResolver, error)
- type PlanetResolver
- type RootResolver
- func (r *RootResolver) Film(ctx context.Context, args struct{ ... }) (*[]*FilmResolver, error)
- func (r *RootResolver) Info() *InfoResolver
- func (r *RootResolver) Person(ctx context.Context, args struct{ ... }) (*[]*PersonResolver, error)
- func (r *RootResolver) Planet(ctx context.Context, args struct{ ... }) (*[]*PlanetResolver, error)
- func (r *RootResolver) Species(ctx context.Context, args struct{ ... }) (*[]*SpeciesResolver, error)
- func (r *RootResolver) Starship(ctx context.Context, args struct{ ... }) (*[]*StarshipResolver, error)
- func (r *RootResolver) Vehicle(ctx context.Context, args struct{ ... }) (*[]*VehicleResolver, error)
- type SearchResponse
- type SpeciesResolver
- func (s *SpeciesResolver) EyeColors() *[]string
- func (s *SpeciesResolver) Films() (*[]*FilmResolver, error)
- func (s *SpeciesResolver) HairColors() *[]string
- func (s *SpeciesResolver) Homeworld() (*[]*PlanetResolver, error)
- func (s *SpeciesResolver) ID() int32
- func (s *SpeciesResolver) People() (*[]*PersonResolver, error)
- func (s *SpeciesResolver) SkinColors() *[]string
- type StarshipResolver
- type VehicleResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFilm ¶
func GetFilm(urls []string) (*[]*FilmResolver, error)
GetFilm requests a film from the REST API or cache
func GetIDFromURL ¶
GetIDFromURL gets the id from the URL of the resource
func GetPerson ¶
func GetPerson(urls []string) (*[]*PersonResolver, error)
GetPerson requests a person from the REST API or cache
func GetPlanet ¶
func GetPlanet(urls []string) (*[]*PlanetResolver, error)
GetPlanet requests a person from the REST API or cache
func GetSpecies ¶
func GetSpecies(urls []string) (*[]*SpeciesResolver, error)
GetSpecies requests a species from the REST API or cache
func GetStarship ¶
func GetStarship(urls []string) (*[]*StarshipResolver, error)
GetStarship requests a starship from the REST API or cache
func GetVehicle ¶
func GetVehicle(urls []string) (*[]*VehicleResolver, error)
GetVehicle requests a vehicle from the REST API or cache
func SearchFilm ¶
func SearchFilm(url string) (*[]*FilmResolver, error)
SearchFilm searches for films from the REST API
func SearchPerson ¶
func SearchPerson(url string) (*[]*PersonResolver, error)
SearchPerson searches for people from the REST API
func SearchPlanet ¶
func SearchPlanet(url string) (*[]*PlanetResolver, error)
SearchPlanet searches for planets from the REST API
func SearchSpecies ¶
func SearchSpecies(url string) (*[]*SpeciesResolver, error)
SearchSpecies searches for starships from the REST API
func SearchStarship ¶
func SearchStarship(url string) (*[]*StarshipResolver, error)
SearchStarship searches for starships from the REST API
func SearchVehicle ¶
func SearchVehicle(url string) (*[]*VehicleResolver, error)
SearchVehicle searches for starships from the REST API
func SplitAndTrim ¶
SplitAndTrim splits a csv delimited string and trims the whitespace
Types ¶
type FilmResolver ¶
type FilmResolver struct {
Title string `json:"title"`
Episode int32 `json:"episode_id"`
OpeningCrawl string `json:"opening_crawl"`
Director string `json:"director"`
ProducerCSV string `json:"producer"`
ReleaseDate string `json:"release_date"`
Created string `json:"created"`
URL string `json:"url"`
CharacterURLs []string `json:"characters"`
PlanetURLs []string `json:"planets"`
SpeciesURLs []string `json:"species"`
}
FilmResolver resolves a film
func (*FilmResolver) Characters ¶
func (f *FilmResolver) Characters() (*[]*PersonResolver, error)
Characters resolves the people in the film
func (*FilmResolver) ID ¶
func (f *FilmResolver) ID() int32
ID creates the ID field equivalent to the number in parsed to SWAPI
func (*FilmResolver) Planets ¶
func (f *FilmResolver) Planets() (*[]*PlanetResolver, error)
Planets resolves the planets in the film
func (*FilmResolver) Producers ¶
func (f *FilmResolver) Producers() *[]string
Producers resolves the producers in the film
func (*FilmResolver) Species ¶
func (f *FilmResolver) Species() (*[]*SpeciesResolver, error)
Species resolves the species for a person
type InfoResolver ¶
type InfoResolver struct {
}
InfoResolver resolves the information about the service
func (*InfoResolver) Description ¶
func (i *InfoResolver) Description() string
Description gets the docker url of the service
func (*InfoResolver) DockerURL ¶
func (i *InfoResolver) DockerURL() string
DockerURL gets the docker url of the service
func (*InfoResolver) RepositoryURL ¶
func (i *InfoResolver) RepositoryURL() string
RepositoryURL gets the repository url of the service
func (*InfoResolver) RequestsServed ¶
func (i *InfoResolver) RequestsServed() string
RequestsServed returns the time the service started
func (*InfoResolver) Title ¶
func (i *InfoResolver) Title() string
Title gets the title of the service
func (*InfoResolver) UpFrom ¶
func (i *InfoResolver) UpFrom() string
UpFrom returns the time the service started
func (*InfoResolver) UpTime ¶
func (i *InfoResolver) UpTime() string
UpTime returns the time the service started
type PersonResolver ¶
type PersonResolver struct {
Name string `json:"name"`
Height string `json:"height"`
Mass string `json:"mass"`
HairColor string `json:"hair_color"`
SkinColor string `json:"skin_color"`
EyeColor string `json:"eye_color"`
BirthYear string `json:"birth_year"`
Gender string `json:"gender"`
Created string `json:"created"`
URL string `json:"url"`
FilmURLs []string `json:"films"`
StarshipURLs []string `json:"starships"`
VehicleURLs []string `json:"vehicles"`
HomeworldURL string `json:"homeworld"`
SpeciesURLs []string `json:"species"`
}
PersonResolver resolves a person from SWAPI
func (*PersonResolver) Films ¶
func (p *PersonResolver) Films() (*[]*FilmResolver, error)
Films resolves the films for a person
func (*PersonResolver) Homeworld ¶
func (p *PersonResolver) Homeworld() (*[]*PlanetResolver, error)
Homeworld resolves the planet for a person
func (*PersonResolver) ID ¶
func (p *PersonResolver) ID() int32
ID creates the ID field equivalent to the number in parsed to SWAPI
func (*PersonResolver) Species ¶
func (p *PersonResolver) Species() (*[]*SpeciesResolver, error)
Species resolves the species for a person
func (*PersonResolver) Starships ¶
func (p *PersonResolver) Starships() (*[]*StarshipResolver, error)
Starships resolves the starships for a person
func (*PersonResolver) Vehicles ¶
func (p *PersonResolver) Vehicles() (*[]*VehicleResolver, error)
Vehicles resolves the vehicles for a person
type PlanetResolver ¶
type PlanetResolver struct {
Name string `json:"name"`
RotationPeriod string `json:"rotation_period"`
OrbitalPeriod string `json:"orbital_period"`
Diameter string `json:"diameter"`
Climate string `json:"climate"`
Gravity string `json:"gravity"`
TerrainCSV string `json:"terrain"`
SurfaceWater string `json:"surface_water"`
Population string `json:"population"`
URL string `json:"url"`
ResidentURLs []string `json:"residents"`
FilmURLs []string `json:"films"`
}
PlanetResolver resolves a plane from SWAPI
func (*PlanetResolver) Films ¶
func (p *PlanetResolver) Films() (*[]*FilmResolver, error)
Films resolves the films for a planet
func (*PlanetResolver) ID ¶
func (p *PlanetResolver) ID() int32
ID creates the ID field equivalent to the number in parsed to SWAPI
func (*PlanetResolver) Residents ¶
func (p *PlanetResolver) Residents() (*[]*PersonResolver, error)
Residents resolves the people on the planet
func (*PlanetResolver) Terrain ¶
func (p *PlanetResolver) Terrain() *[]string
Terrain resolves the planets terrain
type RootResolver ¶
type RootResolver struct {
BaseURL string
}
RootResolver is our root resolver for the GraphQL endpoint.
func (*RootResolver) Film ¶
func (r *RootResolver) Film(ctx context.Context, args struct { ID *int32 Search *string }) (*[]*FilmResolver, error)
Film resolves the film query
func (*RootResolver) Info ¶
func (r *RootResolver) Info() *InfoResolver
Info resolves the Information about the service
func (*RootResolver) Person ¶
func (r *RootResolver) Person(ctx context.Context, args struct { ID *int32 Search *string }) (*[]*PersonResolver, error)
Person resolve the People Query
func (*RootResolver) Planet ¶
func (r *RootResolver) Planet(ctx context.Context, args struct { ID *int32 Search *string }) (*[]*PlanetResolver, error)
Planet resolves the planet query
func (*RootResolver) Species ¶
func (r *RootResolver) Species(ctx context.Context, args struct { ID *int32 Search *string }) (*[]*SpeciesResolver, error)
Species resolves the species query
func (*RootResolver) Starship ¶
func (r *RootResolver) Starship(ctx context.Context, args struct { ID *int32 Search *string }) (*[]*StarshipResolver, error)
Starship resolves the starship query
func (*RootResolver) Vehicle ¶
func (r *RootResolver) Vehicle(ctx context.Context, args struct { ID *int32 Search *string }) (*[]*VehicleResolver, error)
Vehicle resolves the vehicle query
type SearchResponse ¶
type SearchResponse struct {
Count int `json:"count"`
Next string `json:"next"`
Previous string `json:"previous"`
}
SearchResponse features the top-level items in a search response. Should be used in conjunction with a resolver.
type SpeciesResolver ¶
type SpeciesResolver struct {
Name string `json:"name"`
URL string `json:"url"`
Classification string `json:"classification"`
Designation string `json:"designation"`
AverageHeight string `json:"average_height"`
AverageLifespan string `json:"average_lifespan"`
EyeColorsCSV string `json:"eye_colors"`
HairColorsCSV string `json:"hair_colors"`
SkinColorsCSV string `json:"skin_colors"`
Language string `json:"language"`
HomeworldURL string `json:"homeworld"`
PeopleURLs []string `json:"people"`
FilmURLs []string `json:"films"`
Created string `json:"created"`
Edited string `json:"edited"`
}
SpeciesResolver ...
func (*SpeciesResolver) EyeColors ¶
func (s *SpeciesResolver) EyeColors() *[]string
EyeColors resolves the common eye colors for a species
func (*SpeciesResolver) Films ¶
func (s *SpeciesResolver) Films() (*[]*FilmResolver, error)
Films ...
func (*SpeciesResolver) HairColors ¶
func (s *SpeciesResolver) HairColors() *[]string
HairColors resolves the common hair colors for a species
func (*SpeciesResolver) Homeworld ¶
func (s *SpeciesResolver) Homeworld() (*[]*PlanetResolver, error)
Homeworld ...
func (*SpeciesResolver) ID ¶
func (s *SpeciesResolver) ID() int32
ID creates the ID field equivalent to the number in parsed to SWAPI
func (*SpeciesResolver) People ¶
func (s *SpeciesResolver) People() (*[]*PersonResolver, error)
People ...
func (*SpeciesResolver) SkinColors ¶
func (s *SpeciesResolver) SkinColors() *[]string
SkinColors resolves the common skin colors for a species
type StarshipResolver ¶
type StarshipResolver struct {
Name string `json:"name"`
Model string `json:"model"`
StarshipClass string `json:"starship_class"`
ManufacturersCSV string `json:"manufacturer"`
CostInCredits string `json:"cost_in_credits"`
Length string `json:"length"`
Crew string `json:"crew"`
Passengers string `json:"passengers"`
MaxAtmospheringSpeed string `json:"max_atmosphering_speed"`
HyperdriveRating string `json:"hyperdrive_rating"`
MGLT string `json:"MGLT"`
CargoCapacity string `json:"cargo_capacity"`
Consumables string `json:"consumables"`
URL string `json:"url"`
Created string `json:"created"`
Edited string `json:"edited"`
FilmURLs []string `json:"films"`
PilotURLs []string `json:"pilots"`
}
StarshipResolver resolves a starship from SWAPI
func (*StarshipResolver) Films ¶
func (s *StarshipResolver) Films() (*[]*FilmResolver, error)
Films resolves the films for a starship
func (*StarshipResolver) ID ¶
func (s *StarshipResolver) ID() int32
ID creates the ID field equivalent to the number in parsed to SWAPI
func (*StarshipResolver) Manufacturers ¶
func (s *StarshipResolver) Manufacturers() *[]string
Manufacturers resolves the producers in the film
func (*StarshipResolver) Pilots ¶
func (s *StarshipResolver) Pilots() (*[]*PersonResolver, error)
Pilots resolves the pilots who flew the starship
type VehicleResolver ¶
type VehicleResolver struct {
Name string `json:"name"`
Model string `json:"model"`
VehicleClass string `json:"vehicle_class"`
Manufacturer string `json:"manufacturer"`
Length string `json:"length"`
CostInCredits string `json:"cost_in_credits"`
Crew string `json:"crew"`
Passengers string `json:"passengers"`
MaxAtmospheringSpeed string `json:"max_atmosphering_speed"`
CargoCapacity string `json:"capacity_crew"`
Consumables string `json:"consumables"`
Created string `json:"created"`
Edited string `json:"edited"`
URL string `json:"url"`
FilmURLs []string `json:"films"`
PilotURLs []string `json:"pilots"`
}
VehicleResolver resolves a vehicle from SWAPI
func (*VehicleResolver) Films ¶
func (v *VehicleResolver) Films() (*[]*FilmResolver, error)
Films resolves the films for a starship
func (*VehicleResolver) ID ¶
func (v *VehicleResolver) ID() int32
ID creates the ID field equivalent to the number in parsed to SWAPI
func (*VehicleResolver) Pilots ¶
func (v *VehicleResolver) Pilots() (*[]*PersonResolver, error)
Pilots resolves the pilots who flew the starship