public PeopleGraphType(Swapi api) { _api = api; Name = "People"; Id(p => p.Id); Field(p => p.Name); Field(p => p.Height); Field(p => p.Mass); Field(p => p.HairColor); Field(p => p.SkinColor); Field(p => p.EyeColor); Field(p => p.BirthYear); Field(p => p.Gender); Field( name: "homeworld", type: typeof(PlanetGraphType), resolve: ctx => _api.GetEntity <Planets>(ctx.Source.Homeworld) ); Connection <FilmGraphType>() .Name("films") .Unidirectional() .Resolve(ctx => api .GetMany <Films>(ctx.Source.Films) .ContinueWith(t => ConnectionUtils.ToConnection(t.Result, ctx)) ); Connection <SpeciesGraphType>() .Name("species") .Unidirectional() .Resolve(ctx => api .GetMany <Species>(ctx.Source.Species) .ContinueWith(t => ConnectionUtils.ToConnection(t.Result, ctx)) ); Connection <StarshipGraphType>() .Name("starships") .Unidirectional() .Resolve(ctx => api .GetMany <Starships>(ctx.Source.Starships) .ContinueWith(t => ConnectionUtils.ToConnection(t.Result, ctx)) ); Connection <VehicleGraphType>() .Name("vehicles") .Unidirectional() .Resolve(ctx => api .GetMany <Vehicles>(ctx.Source.Vehicles) .ContinueWith(t => ConnectionUtils.ToConnection(t.Result, ctx)) ); }
public SpeciesGraphType(Swapi api) { _api = api; Name = "Species"; Id(p => p.Id); Field(p => p.Name); Field(p => p.Classification); Field(p => p.Designation); Field(p => p.AverageHeight); Field(p => p.SkinColors); Field(p => p.HairColors); Field(p => p.EyeColors); Field(p => p.AverageLifespan); Field(p => p.Language); Field( name: "homeworld", type: typeof(PlanetGraphType), resolve: ctx => _api.GetEntity <Planets>(ctx.Source.Homeworld) ); Connection <PeopleGraphType>() .Name("people") .Unidirectional() .Resolve(ctx => api .GetMany <People>(ctx.Source.People) .ContinueWith(t => ConnectionUtils.ToConnection(t.Result, ctx)) ); Connection <FilmGraphType>() .Name("films") .Unidirectional() .Resolve(ctx => api .GetMany <Films>(ctx.Source.Films) .ContinueWith(t => ConnectionUtils.ToConnection(t.Result, ctx)) ); }
public override Task <Starships> GetById(IResolveFieldContext <object> context, string id) => _api.GetEntity <Starships>(id);
public override Task <Vehicles> GetById(string id) => _api.GetEntity <Vehicles>(id);
public override Task <Films> GetById(string id) => _api.GetEntity <Films>(id);
public override Task <People> GetById(IResolveFieldContext <object> context, string id) => _api.GetEntity <People>(id);
public override Task <Starships> GetById(string id) => _api.GetEntity <Starships>(id);
public override Task <Planets> GetById(string id) => _api.GetEntity <Planets>(id);
public override Task <People> GetById(string id) => _api.GetEntity <People>(id);
public override Task <Species> GetById(string id) => _api.GetEntity <Species>(id);