public static OffsetPagingArguments GetOffsetPagingArgsSafely(this IResolverContext context, int?defaultSkip = null, int?defaultTake = null) { int?skip = context?.ArgumentValueSafely <int?>(OffsetPagingArgNames.Skip); int?take = context?.ArgumentValueSafely <int?>(OffsetPagingArgNames.Take); //Initialize with default values that enable default behaviour to retrieve all results anytime // the values are not specified; consistent with Cursor based paging where all params are optional. var pagingArgs = new OffsetPagingArguments(skip ?? defaultSkip, take ?? defaultTake); return(pagingArgs); }
public static CursorPagingArguments GetCursorPagingArgsSafely(this IResolverContext context) { var pagingArgs = new CursorPagingArguments( first: context?.ArgumentValueSafely <int?>(CursorPagingArgNames.First), after: context?.ArgumentValueSafely <string>(CursorPagingArgNames.After), last: context?.ArgumentValueSafely <int?>(CursorPagingArgNames.Last), before: context?.ArgumentValueSafely <string>(CursorPagingArgNames.Before) ); return(pagingArgs); }