parseGraphQLConnectionArgumentsWithWhere
talawa-api • Docs
talawa-api / utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithWhere / parseGraphQLConnectionArgumentsWithWhere
Function: parseGraphQLConnectionArgumentsWithWhere()
> parseGraphQLConnectionArgumentsWithWhere<T0
, T1
>(__namedParameters
): ParseGraphQLConnectionArgumentsWithWhereResult
<T0
, T1
>
This function handles validating and transforming arguments for a custom graphQL connection that also provides filtering capabilities.
Type Parameters
• T0
• T1
Parameters
• __namedParameters
• __namedParameters.args: DefaultGraphQLConnectionArguments
• __namedParameters.maximumLimit?: number
= MAXIMUM_FETCH_LIMIT
• __namedParameters.parseCursor: ParseGraphQLConnectionCursor
<T0
>
• __namedParameters.parseWhereResult: ParseGraphQLConnectionWhereResult
<T1
>
Returns
ParseGraphQLConnectionArgumentsWithWhereResult
<T0
, T1
>
Example
const result = await parseGraphQLConnectionArgumentsWithSortedBy(\{
args: \{
after,
first,
\},
maximumLimit: 20,
parseCursor,
parseSortedBy,
\})
if (result.isSuccessful === false) \{
throw new GraphQLError("Invalid arguments provided.", \{
extensions: \{
code: "INVALID_ARGUMENTS",
errors: result.errors
\}
\})
\}
const \{ parsedArgs: \{ cursor, direction, filter, limit \} \} = result;
Defined in
src/utilities/graphQLConnection/parseGraphQLConnectionArgumentsWithWhere.ts:70