Closed miladazhdehnia closed 1 year ago
@jeangovil
About Multiple query exec at once
what is the method arguments type?
Because I have seen in Unbody GraphQL API that we can't query multiple documents of the same type.
For example we can't query multiple google docs in a single GET query.
Can you provide an example of how this method should works?
@jeangovil About
Multiple query exec at once
what is the method arguments type? Because I have seen in Unbody GraphQL API that we can't query multiple documents of the same type. For example we can't query multiple google docs in a single GET query. Can you provide an example of how this method should works?
Here's what I have in mind for the 'exec' method:
const query1 = unbody.get.googleDoc.select("originalName", "remoteId", "text")
const query2 = unbody.get.googleDoc.select("text")
const query3 = unbody.aggregate.googleDoc;
const [result1, result2, result3] = await unbody.exec(query1, query2, query3)
And, here's how you can execute multiple queries in a single GraphQL request:
query {
q0: Get {
GoogleDoc {
originalName
remoteId
text
}
}
q1: Get {
TextBlock {
text
}
}
q2: Aggregate {
GoogleDoc {
meta {
count
}
}
}
}
It's also possible to execute multiple queries for the same type of object within a Get
, or Aggregate
query:
query {
Get {
a: GoogleDoc {
originalName
remoteId
text
}
b: GoogleDoc {
originalName
remoteId
text
}
}
}
Hi there,
This update enables the usage of:
I welcome any suggestions and feedback for a thorough review. Please ensure that you review the changes meticulously, as there might be some aspects that I might have inadvertently missed.
Thank you for your time and attention to this pull request! https://github.com/unbody-io/ts-client/issues/2