Skip to content

Commit

Permalink
New translations querying-from-an-application.mdx (Italian)
Browse files Browse the repository at this point in the history
  • Loading branch information
benface committed Dec 28, 2023
1 parent 9e85c52 commit 6930802
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions website/pages/it/querying/querying-from-an-application.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: Querying from an Application
title: Eseguire una query da un'applicazione
---

Once a subgraph is deployed to the Subgraph Studio or to The Graph Explorer, you will be given the endpoint for your GraphQL API that should look something like this:
Una volta che un subgraph è stato distribuito in Subgraph Studio o in The Graph Explorer, verrà fornito l'endpoint per GraphQL API, che dovrebbe avere un aspetto simile a questo:

**Subgraph Studio (testing endpoint)**
**Subgraph Studio (endpoint di test)**

```sh
Queries (HTTP)
Expand All @@ -18,34 +18,34 @@ Queries (HTTP)
https://gateway.thegraph.com/api/<API_KEY>/subgraphs/id/<SUBGRAPH_ID>
```

Using the GraphQL endpoint, you can use various GraphQL Client libraries to query the subgraph and populate your app with the data indexed by the subgraph.
Utilizzando il GraphQL endpoint, si possono usare varie librerie GraphQL Client per interrogare il subgraph e popolare l'applicazione con i dati indicizzati dal subgraph.

Here are a couple of the more popular GraphQL clients in the ecosystem and how to use them:
Ecco un paio dei GraphQL client più diffusi nell'ecosistema e come utilizzarli:

## GraphQL clients
## I GraphQL client

### Graph client

The Graph is providing it own GraphQL client, `graph-client` that supports unique features such as:
Graph fornisce il proprio client GraphQL, `graph-client`, che supporta caratteristiche uniche come:

- Gestione dei subgraph a cross-chain: effettuare query di più subgraph in un'unica query
- [Tracciamento automatico dei blocchi](https://github.com/graphprotocol/graph-client/blob/main/packages/block-tracking/README.md)
- [Paginazione automatica](https://github.com/graphprotocol/graph-client/blob/main/packages/auto-pagination/README.md)
- Risultato completamente tipizzato

Also integrated with popular GraphQL clients such as Apollo and URQL and compatible with all environments (React, Angular, Node.js, React Native), using `graph-client` will give you the best experience for interacting with The Graph.
Integrato anche con i client GraphQL più diffusi, come Apollo e URQL, e compatibile con tutti gli ambienti (React, Angular, Node.js, React Native), l'uso di `graph-client` vi darà la migliore esperienza di interazione con The Graph.

Let's look at how to fetch data from a subgraph with `graphql-client`.
Vediamo come recuperare i dati da un subgraph con `graphql-client`.

To get started, make sure to install The Graph Client CLI in your project:
Per iniziare, assicuratevi di installare il Graph Client CLI nel vostro progetto:

```sh
yarn add -D @graphprotocol/client-cli
# or, with NPM:
npm install --save-dev @graphprotocol/client-cli
```

Define your query in a `.graphql` file (or inlined in your `.js` or `.ts` file):
Definire la query in un file `.graphql` (o in un file `.js` o `.ts`):

```graphql
query ExampleQuery {
Expand All @@ -72,7 +72,7 @@ query ExampleQuery {
}
```

Then, create a configuration file (called `.graphclientrc.yml`) and point to your GraphQL endpoints provided by The Graph, for example:
Quindi, creare un file di configurazione (chiamato `.graphclientrc.yml`) e puntare agli endpoint GraphQL forniti da The Graph, ad esempio:

```yaml
# .graphclientrc.yml
Expand All @@ -90,13 +90,13 @@ documents:
- ./src/example-query.graphql
```
Running the following The Graph Client CLI command will generate typed and ready to use JavaScript code:
L'esecuzione del seguente comando The Graph Client CLI genererà codice JavaScript digitato e pronto all'uso:
```sh
graphclient build
costruzione del graphclient
```

Finally, update your `.ts` file to use the generated typed GraphQL documents:
Infine, aggiornare il file `.ts` per utilizzare i documenti GraphQL digitati generati:

```tsx
import React, { useEffect } from 'react'
Expand Down Expand Up @@ -134,33 +134,33 @@ function App() {
export default App
```

**⚠️ Important notice**
**⚠️ Avviso importante**

`graph-client` is perfectly integrated with other GraphQL clients such as Apollo client, URQL, or React Query; you will [find examples in the official repository](https://github.com/graphprotocol/graph-client/tree/main/examples).
`graph-client` è perfettamente integrato con altri client GraphQL come Apollo client, URQL o React Query; troverete degli esempi nel repository ufficiale</a>.

However, if you choose to go with another client, keep in mind that **you won't be able to get to use Cross-chain Subgraph Handling or Automatic Pagination, which are core features for querying The Graph**.
Tuttavia, se scegliete un altro client, tenete presente che **non sarete in grado di utilizzare la gestione dei Subgraph Cross-chain o la Paginazione Automatica, che sono caratteristiche fondamentali per effettuare query di The Graph**.

### Apollo client

[Apollo client](https://www.apollographql.com/docs/) is the ubiquitous GraphQL client on the front-end ecosystem.
[Client Apollo](https://www.apollographql.com/docs/) è il client GraphQL onnipresente nell'ecosistema front-end.

Available for React, Angular, Vue, Ember, iOS, and Android, Apollo Client, although the heaviest client, brings many features to build advanced UI on top of GraphQL:
Disponibile per React, Angular, Vue, Ember, iOS e Android, Apollo Client, sebbene sia il client più pesante, offre molte funzionalità per costruire UI avanzate in cima a GraphQL:

- advanced error handling
- pagination
- data prefetching
- optimistic UI
- local state management
- gestione avanzata degli errori
- paginazione
- prefetching dei dati
- UI ottimistica
- gestione statale locale

Let's look at how to fetch data from a subgraph with Apollo client in a web project.
Vediamo come recuperare i dati da un subgraph con il Apollo client in un progetto web.

First, install `@apollo/client` and `graphql`:
Per prima cosa, installare `@apollo/client` e `graphql`:

```sh
npm install @apollo/client graphql
```

Then you can query the API with the following code:
Quindi è possibile effettuare query del'API con il seguente codice:

```javascript
import { ApolloClient, InMemoryCache, gql } from '@apollo/client'
Expand Down Expand Up @@ -193,7 +193,7 @@ client
})
```

To use variables, you can pass in a `variables` argument to the query:
Per usare le variabili, si può passare un argomento `variables` alla query:

```javascript
const tokensQuery = `
Expand Down Expand Up @@ -226,22 +226,22 @@ client

### URQL

Another option is [URQL](https://formidable.com/open-source/urql/) which is available within Node.js, React/Preact, Vue, and Svelte environments, with more advanced features:
Un'altra opzione è [URQL](https://formidable.com/open-source/urql/), disponibile negli ambienti Node.js, React/Preact, Vue e Svelte, con caratteristiche più avanzate:

- Flexible cache system
- Extensible design (easing adding new capabilities on top of it)
- Lightweight bundle (~5x lighter than Apollo Client)
- Support for file uploads and offline mode
- Sistema di cache flessibile
- Design estensibile (facilita l'aggiunta di nuove funzionalità)
- Bundle leggero (~5 volte più leggero del Apollo Сlient)
- Supporto per il caricamento di file e la modalità offline

Let's look at how to fetch data from a subgraph with URQL in a web project.
Vediamo come recuperare i dati da un subgraph con il URQL in un progetto web.

First, install `urql` and `graphql`:
Per prima cosa, installare `urql` e `graphql`:

```sh
npm install urql graphql
```

Then you can query the API with the following code:
Quindi è possibile effettuare query del'API con il seguente codice:

```javascript
import { createClient } from 'urql'
Expand Down

0 comments on commit 6930802

Please sign in to comment.