Skip to content

Instantly share code, notes, and snippets.

@mczachurski
Created October 10, 2017 08:02
Show Gist options
  • Save mczachurski/73968cb71464af331aa6b7daea19afb2 to your computer and use it in GitHub Desktop.
Save mczachurski/73968cb71464af331aa6b7daea19afb2 to your computer and use it in GitHub Desktop.
public class ResponseGraphType<TGraphType> : ObjectGraphType<Response> where TGraphType : GraphType
{
public ResponseGraphType()
{
Name = $"Response{typeof(TGraphType).Name}";
Field(x => x.StatusCode, nullable: true).Description("Status code of the request.");
Field(x => x.ErrorMessage, nullable: true).Description("Error message if requests fails.");
Field<TGraphType>(
"data",
"Data returned by query.",
resolve: context => context.Source.Data
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment