pub struct Client {
pub http_client: Client,
pub subgraph_url: Url,
pub auth_token: Option<String>,
/* private fields */
}👎Deprecated since 0.8.1: Use the
thegraph-client-subgraphs crate insteadAvailable on crate feature
subgraph-client only.Expand description
A client for interacting with a subgraph.
Fields§
§http_client: Client👎Deprecated since 0.8.1: Use the
§thegraph-client-subgraphs crate insteadsubgraph_url: Url👎Deprecated since 0.8.1: Use the
§thegraph-client-subgraphs crate insteadauth_token: Option<String>👎Deprecated since 0.8.1: Use the
thegraph-client-subgraphs crate insteadThe request authentication bearer token.
This is token is inserted in the Authentication header.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(http_client: Client, subgraph_url: Url) -> Self
👎Deprecated since 0.8.1: Use the thegraph-client-subgraphs crate instead
pub fn new(http_client: Client, subgraph_url: Url) -> Self
thegraph-client-subgraphs crate insteadCreate a new client with default settings.
The default settings are:
- No authentication token
- Latest block number of 0
Sourcepub fn builder(http_client: Client, subgraph_url: Url) -> ClientBuilder
👎Deprecated since 0.8.1: Use the thegraph-client-subgraphs crate instead
pub fn builder(http_client: Client, subgraph_url: Url) -> ClientBuilder
thegraph-client-subgraphs crate insteadCreate a new client builder.
The builder allows for configuring the client before building it.
Example:
let client = SubgraphClient::builder(http_client, subgraph_url)
.with_auth_token(Some(ticket))
.with_subgraph_latest_block(18627000)
.build();Sourcepub async fn query<T: for<'de> Deserialize<'de>>(
&self,
query: impl IntoRequestParameters + Send,
) -> Result<T, String>
👎Deprecated since 0.8.1: Use the thegraph-client-subgraphs crate instead
pub async fn query<T: for<'de> Deserialize<'de>>( &self, query: impl IntoRequestParameters + Send, ) -> Result<T, String>
thegraph-client-subgraphs crate insteadSend a query to the subgraph.
Sourcepub async fn paginated_query<T: for<'de> Deserialize<'de>>(
&self,
query: impl IntoDocument + Clone,
page_size: usize,
) -> Result<Vec<T>, PaginatedQueryError>
👎Deprecated since 0.8.1: Use the thegraph-client-subgraphs crate instead
pub async fn paginated_query<T: for<'de> Deserialize<'de>>( &self, query: impl IntoDocument + Clone, page_size: usize, ) -> Result<Vec<T>, PaginatedQueryError>
thegraph-client-subgraphs crate insteadSend a paginated query to the subgraph.
The query is sent with a page size of page_size and the latest block number that the
subgraph has progressed to.
In the case of a reorg, the function will return an error.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more