public AssistantMutation(AssistantData data) { Name = "Mutation"; Field <IssueType>( "createIssue", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IssueInputType> > { Name = "issue" } ), resolve: context => { var issue = context.GetArgument <issue>("issue"); return(data.AddIssue(issue)); }); }
public AssistantQuery(AssistantData data) { Name = "Query"; Field <IssueType>( "issue", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "id", Description = "Id of the issue" } ), resolve: context => data.GetIssueByIdAsync(context.GetArgument <string>("id")) ); Field <ListGraphType <IssueType> >( "myissues", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "startdate", Description = "Start date to filter by" }, new QueryArgument <StringGraphType> { Name = "enddate", Description = "End date to filter by" }, new QueryArgument <IntGraphType> { Name = "first", Description = "Number of items to select." }, new QueryArgument <IntGraphType> { Name = "offset", Description = "Number of items to skip." } ), resolve: context => data.GetIssuesFromEndpoint(context.GetArgument <string>("startdate"), context.GetArgument <string>("enddate"), context.GetArgument <int>("first"), context.GetArgument <int>("offset")) ); Field <ListGraphType <IssueType> >( "openissues", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "startdate", Description = "Start date to filter by" }, new QueryArgument <StringGraphType> { Name = "enddate", Description = "End date to filter by" }, new QueryArgument <IntGraphType> { Name = "first", Description = "Number of items to select." }, new QueryArgument <IntGraphType> { Name = "offset", Description = "Number of items to skip." } ), resolve: context => data.GetOpenIssuesFromEndpoint(context.GetArgument <string>("startdate"), context.GetArgument <string>("enddate"), context.GetArgument <int>("first"), context.GetArgument <int>("offset")) ); Field <ListGraphType <IssueType> >( "myissuesstatic", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "startdate", Description = "Start date to filter by" }, new QueryArgument <StringGraphType> { Name = "enddate", Description = "End date to filter by" }, new QueryArgument <IntGraphType> { Name = "first", Description = "Number of items to select." }, new QueryArgument <IntGraphType> { Name = "offset", Description = "Number of items to skip." } ), resolve: context => data.GetIssuesFromStaticList(context.GetArgument <string>("startdate"), context.GetArgument <string>("enddate"), context.GetArgument <int>("first"), context.GetArgument <int>("offset")) ); }