update interface of GraphQLResponse for multitenant (#760)

<!-- The PR description should answer 2 (maybe 3) important questions:
-->

### What

Update the interface of `GraphQLResponse`
- make some functions public
- added some helper functions that are used in v3-engine-multitenant
<!-- What is this PR trying to accomplish (and why, if it's not
obvious)? -->

<!-- Consider: do we need to add a changelog entry? -->

### How

<!-- How is it trying to accomplish it (what are the implementation
steps)? -->

V3_GIT_ORIGIN_REV_ID: 691ff8e3505f96ba9e9a2e8518023e4812319a05
This commit is contained in:
Anon Ray 2024-06-25 22:23:12 +05:30 committed by hasura-bot
parent e15cd1ce39
commit 91ec7bafd1

View File

@ -65,17 +65,25 @@ impl<'a> TraceableError for GraphQLErrors<'a> {
pub struct GraphQLResponse(gql::http::Response);
impl GraphQLResponse {
fn from_result(result: ExecuteQueryResult) -> Self {
pub fn from_result(result: ExecuteQueryResult) -> Self {
Self(result.to_graphql_response())
}
fn from_error(err: &error::RequestError) -> Self {
pub fn from_error(err: &error::RequestError) -> Self {
Self(Response::error(
err.to_graphql_error(),
axum::http::HeaderMap::default(),
))
}
pub fn from_response(response: gql::http::Response) -> Self {
Self(response)
}
pub fn does_contain_error(&self) -> bool {
self.0.does_contains_error()
}
pub fn inner(self) -> gql::http::Response {
self.0
}