Example #1
0
 public static IInterfaceFieldDescriptor AddFilterArguments <TFilter>(
     this IInterfaceFieldDescriptor descriptor)
     where TFilter : class, IInputType, IFilterInputType
 {
     return(descriptor.Argument(_whereArgumentName,
                                a => a.Type <TFilter>()));
 }
Example #2
0
        private static void DeclareFieldArguments(
            IReadOnlySchemaOptions schemaOptions,
            IInterfaceFieldDescriptor fieldDescriptor,
            FieldDefinitionNode fieldDefinition)
        {
            foreach (InputValueDefinitionNode inputFieldDefinition in
                     fieldDefinition.Arguments)
            {
                fieldDescriptor.Argument(inputFieldDefinition.Name.Value,
                                         a =>
                {
                    foreach (DirectiveNode directive in
                             inputFieldDefinition.Directives)
                    {
                        fieldDescriptor.Directive(directive);
                    }

                    a.Description(inputFieldDefinition.Description?.Value)
                    .Type(inputFieldDefinition.Type)
                    .DefaultValue(inputFieldDefinition.DefaultValue)
                    .SyntaxNode(schemaOptions.PreserveSyntaxNodes
                                ? inputFieldDefinition
                                : null);
                });
            }
        }
 public static IInterfaceFieldDescriptor AddFilterArguments <TFilter>(
     this IInterfaceFieldDescriptor descriptor)
     where TFilter : class, IInputType, IFilterInputType
 {
     return(descriptor.Argument(_whereArgumentNamePlaceholder,
                                a => a.Type <TFilter>().Extend().ConfigureArgumentName()));
 }
Example #4
0
 public static IInterfaceFieldDescriptor AddPagingArguments(
     this IInterfaceFieldDescriptor descriptor)
 {
     return(descriptor
            .Argument("first", a => a.Type <PaginationAmountType>())
            .Argument("after", a => a.Type <StringType>())
            .Argument("last", a => a.Type <PaginationAmountType>())
            .Argument("before", a => a.Type <StringType>()));
 }
Example #5
0
    /// <summary>
    /// Adds the offset paging arguments to an interface field.
    /// </summary>
    public static IInterfaceFieldDescriptor AddOffsetPagingArguments(
        this IInterfaceFieldDescriptor 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>()));
    }
        public static IInterfaceFieldDescriptor AddPagingArguments(
            this IInterfaceFieldDescriptor 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>()));
        }
Example #7
0
 private void DeclareFieldArguments(
     IInterfaceFieldDescriptor 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);
         });
     }
 }
Example #8
0
 public static IInterfaceFieldDescriptor AddPaginationArguments(this IInterfaceFieldDescriptor descriptor)
 {
     return(descriptor
            .Argument("pageNumber", a => a.Type <IntType>())
            .Argument("limit", a => a.Type <IntType>()));
 }