public ToxicityAnnotationType(ToxicityData data)
        {
            Name        = "ToxicityAnnotationType";
            Description = "A data point associating an id to a toxicity measurement.";

            Field(d => d.RevId, nullable: true).Description("Rev Id.");
            Field(d => d.WorkerId, nullable: true).Description("Worker Id.");
            Field(d => d.Toxicity, nullable: true).Description("Is the item toxic?");
            Field(d => d.ToxicityScore, nullable: true).Description("How toxic is the item?");

            Interface <ToxicityAnnotationInterface>();
        }
Exemple #2
0
        public ToxicityQuery(ToxicityData data)
        {
            Name = "Query";

            Field <ToxicityAnnotationType>(
                "toxicity_annotation",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <StringGraphType> > {
                Name = "rev_id", Description = "id of the toxicity annotation"
            }
                    ),
                resolve: context => data.GetDataByIdAsync(context.GetArgument <decimal>("rev_id"))
                );
        }
        public ToxicityMutation(ToxicityData data)
        {
            Name = "Mutation";

            Field <ToxicityAnnotationType>(
                "createAnnotation",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <ToxicityAnnotationInputType> > {
                Name = "toxicity_annotation"
            }
                    ),
                resolve: context =>
            {
                var arg = context.GetArgument <ToxicityAnnotations>("toxicity_annotation");
                return(data.AddToxicityAnnotation(arg));
            });
        }