QueryBuilder
n8n-nodes-semble / services/SembleQueryService / QueryBuilder
Interface: QueryBuilder¶
Defined in: services/SembleQueryService.ts:109
Interface for building structured GraphQL queries programmatically
Provides a structured way to construct GraphQL queries with support for fragments, directives, variables, and different operation types.
Example¶
const queryBuilder: QueryBuilder = {
resource: 'patients',
operation: 'query',
fields: ['id', 'firstName', 'lastName', 'dateOfBirth'],
variables: {
limit: 20,
offset: 0
},
fragments: {
PatientInfo: 'on Patient { contactDetails { email phone } }'
},
directives: {
include: { if: '$includeDetails' }
}
};
const query = queryService.buildQuery(queryBuilder);
QueryBuilder
Since¶
2.0.0
Properties¶
resource¶
resource:
string
Defined in: services/SembleQueryService.ts:111
The GraphQL resource/type to query (e.g., 'patients', 'bookings')
operation¶
operation:
"query"
|"mutation"
|"subscription"
Defined in: services/SembleQueryService.ts:113
The type of GraphQL operation to perform
fields¶
fields:
string
[]
Defined in: services/SembleQueryService.ts:115
Array of field names to include in the query
variables?¶
optional
variables:Record
\<string
,any
>
Defined in: services/SembleQueryService.ts:117
Optional variables to pass to the query
fragments?¶
optional
fragments:Record
\<string
,string
>
Defined in: services/SembleQueryService.ts:119
Optional GraphQL fragments to include
directives?¶
optional
directives:Record
\<string
,any
>
Defined in: services/SembleQueryService.ts:121
Optional GraphQL directives to apply