Move body of Client.graphql_requests to State._graphql_requests
This commit is contained in:
@@ -111,8 +111,8 @@ class Client(object):
|
|||||||
def _get(self, url, params):
|
def _get(self, url, params):
|
||||||
return self._state._get(url, params)
|
return self._state._get(url, params)
|
||||||
|
|
||||||
def _post(self, url, params, files=None, as_graphql=False):
|
def _post(self, url, params, files=None):
|
||||||
return self._state._post(url, params, files=files, as_graphql=as_graphql)
|
return self._state._post(url, params, files=files)
|
||||||
|
|
||||||
def _payload_post(self, url, data, files=None):
|
def _payload_post(self, url, data, files=None):
|
||||||
return self._state._payload_post(url, data, files=files)
|
return self._state._payload_post(url, data, files=files)
|
||||||
@@ -129,12 +129,7 @@ class Client(object):
|
|||||||
Raises:
|
Raises:
|
||||||
FBchatException: If request failed
|
FBchatException: If request failed
|
||||||
"""
|
"""
|
||||||
data = {
|
return tuple(self._state._graphql_requests(*queries))
|
||||||
"method": "GET",
|
|
||||||
"response_format": "json",
|
|
||||||
"queries": _graphql.queries_to_json(*queries),
|
|
||||||
}
|
|
||||||
return tuple(self._post("/api/graphqlbatch/", data, as_graphql=True))
|
|
||||||
|
|
||||||
def graphql_request(self, query):
|
def graphql_request(self, query):
|
||||||
"""Shorthand for ``graphql_requests(query)[0]``.
|
"""Shorthand for ``graphql_requests(query)[0]``.
|
||||||
|
@@ -247,3 +247,11 @@ class State(object):
|
|||||||
return j["payload"]
|
return j["payload"]
|
||||||
except (KeyError, TypeError):
|
except (KeyError, TypeError):
|
||||||
raise _exception.FBchatException("Missing payload: {}".format(j))
|
raise _exception.FBchatException("Missing payload: {}".format(j))
|
||||||
|
|
||||||
|
def _graphql_requests(self, *queries):
|
||||||
|
data = {
|
||||||
|
"method": "GET",
|
||||||
|
"response_format": "json",
|
||||||
|
"queries": _graphql.queries_to_json(*queries),
|
||||||
|
}
|
||||||
|
return self._post("/api/graphqlbatch/", data, as_graphql=True)
|
||||||
|
Reference in New Issue
Block a user