Esempio n. 1
0
 private static IObjectFieldDescriptor AddOffsetBasedPagingArguments(
     this IObjectFieldDescriptor descriptor)
 {
     return(descriptor
            .Argument("pageNumber", a => a.Type <NonNullType <IntType> >())
            .Argument("pageSize", a => a.Type <NonNullType <IntType> >()));
 }
Esempio n. 2
0
 public static IObjectFieldDescriptor AddFilterArguments <TFilter>(
     this IObjectFieldDescriptor descriptor)
     where TFilter : class, IInputType, IFilterInputType
 {
     return(descriptor.Argument(_whereArgumentName,
                                a => a.Type <TFilter>()));
 }
 public static IObjectFieldDescriptor AddFilterArguments <TFilter>(
     this IObjectFieldDescriptor descriptor)
     where TFilter : class, IInputType, IFilterInputType
 {
     return(descriptor.Argument(_whereArgumentNamePlaceholder,
                                a => a.Type <TFilter>().Extend().ConfigureArgumentName()));
 }
Esempio n. 4
0
 private static IObjectFieldDescriptor AddFilterArguments(
     this IObjectFieldDescriptor descriptor,
     Type filterType)
 {
     return(descriptor.Argument(_whereArgumentName, a =>
                                a.Extend().OnBeforeCreate(d =>
                                                          d.Type = new ClrTypeReference(
                                                              filterType, TypeContext.Input))));
 }
Esempio n. 5
0
 private static IObjectFieldDescriptor AddFilterArguments(
     this IObjectFieldDescriptor descriptor,
     Type filterType)
 {
     return(descriptor.Argument(_whereArgumentNamePlaceholder, a =>
                                a.Extend()
                                .OnBeforeCreate((c, d) =>
                                                d.ConfigureArgumentName().Type =
                                                    c.TypeInspector.GetTypeRef(filterType, TypeContext.Input))));
 }
Esempio n. 6
0
    /// <summary>
    /// Adds the offset paging arguments to an object field.
    /// </summary>
    public static IObjectFieldDescriptor AddOffsetPagingArguments(
        this IObjectFieldDescriptor descriptor)
    {
        if (descriptor is null)
        {
            throw new ArgumentNullException(nameof(descriptor));
        }

        return(descriptor
               .Argument(OffsetPagingArgumentNames.Skip, a => a.Type <IntType>())
               .Argument(OffsetPagingArgumentNames.Take, a => a.Type <IntType>()));
    }
Esempio n. 7
0
        public override void OnConfigure(IDescriptorContext context, IObjectFieldDescriptor descriptor, MemberInfo member)
        {
            var parms = new Dictionary <string, (MemberInfo Member, Type Type)>();

            foreach (var prop in context.TypeInspector.GetMembers(ParamsType))
            {
                var argName = context.Naming.GetMemberName(prop, MemberKind.InputObjectField);
                descriptor.Argument(argName, desc =>
                {
                    var t = context.TypeInspector.GetReturnTypeRef(prop, TypeContext.Input);
                    desc.Type(t.Type.Type);
                    desc.Description(context.Naming.GetMemberDescription(prop, MemberKind.InputObjectField));
                    parms[argName] = (prop, t.Type.Type);
                });
        public static IObjectFieldDescriptor AddPagingArguments(
            this IObjectFieldDescriptor descriptor)
        {
            if (descriptor == null)
            {
                throw new ArgumentNullException(nameof(descriptor));
            }

            return(descriptor
                   .Argument(CursorPagingArgumentNames.First, a => a.Type <IntType>())
                   .Argument(CursorPagingArgumentNames.After, a => a.Type <StringType>())
                   .Argument(CursorPagingArgumentNames.Last, a => a.Type <IntType>())
                   .Argument(CursorPagingArgumentNames.Before, a => a.Type <StringType>()));
        }
Esempio n. 9
0
 private void DeclareFieldArguments(
     IObjectFieldDescriptor fieldDescriptor,
     FieldDefinitionNode fieldDefinition)
 {
     foreach (InputValueDefinitionNode inputFieldDefinition in
              fieldDefinition.Arguments)
     {
         fieldDescriptor.Argument(inputFieldDefinition.Name.Value,
                                  a =>
         {
             a.Description(inputFieldDefinition.Description?.Value)
             .Type(inputFieldDefinition.Type)
             .DefaultValue(inputFieldDefinition.DefaultValue)
             .SyntaxNode(inputFieldDefinition);
         });
     }
 }
Esempio n. 10
0
 public static IObjectFieldDescriptor AddPaginationArguments(this IObjectFieldDescriptor descriptor)
 {
     return(descriptor
            .Argument("pageNumber", a => a.Type <IntType>())
            .Argument("limit", a => a.Type <IntType>()));
 }
 public void ConfigFieldDescriptor(IObjectFieldDescriptor descriptor)
 {
     descriptor.Argument("id", a => a.Type <IdType>());
 }
Esempio n. 12
0
 public static IObjectFieldDescriptor AddPaginationArgument(
     this IObjectFieldDescriptor descriptor)
 {
     return(descriptor
            .Argument(PaginationArgumentName, a => a.Type <NonNullType <PaginationQueryType> >()));
 }
Esempio n. 13
0
 public void ConfigFieldDescriptor(IObjectFieldDescriptor descriptor)
 {
     descriptor
     .Argument("descending", a => a.Type <BooleanType>())
     .UsePaging <PropertyType>();
 }
Esempio n. 14
0
 public static IObjectFieldDescriptor AddSortingArguments <TSortType>(this IObjectFieldDescriptor descriptor)
     where TSortType : IInputType
 {
     return(descriptor.Argument(SortObjectFieldDescriptorExtensions.OrderByArgumentName,
                                a => a.Type <TSortType>()));
 }
Esempio n. 15
0
 public static IObjectFieldDescriptor AddPagingArguments(this IObjectFieldDescriptor descriptor)
 {
     return(descriptor
            .Argument("page", a => a.Type <IntType>())
            .Argument("pageSize", a => a.Type <IntType>()));
 }