# get()

Canonical URL: https://developers.iagenify.com/pt/sdk/ref/storage/get/
Language: pt

`api.storage.get({ id }) → Promise<ConnectedStorage | null>`

Un storage, pronto per l'uso. Senza argumento, il default del conto.

Status: GET /api/storage/:id · free · null, never a throw

## Parâmetros {#parameters}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `id` | string |  | Quale stoccatura. Esclude-lo per il predefinit del cont. |

```javascript
const target = await api.storage.get();            // the default
const one = await api.storage.get({ id });         // a particular one
```

## Responde null e non lance {#null}

Un id sconosciut, un malformat, o un identificat di un altro conto, da `null`. Quindi il check è un test de valore, non un test/catch — e `null` non significa mai «è di qualcun altro».

```javascript
const storage = await api.storage.get({ id });

if (!storage) {
  throw new Error("that storage is not on this account");
}
```

## Isto, o getStorage() {#versus}

|  | api.storage.get() | api.getStorage() |
| --- | --- | --- |
| Dà | Un archivament connesso, con metodi | Quattro campis simples |
| Usar-lo a | leg, scrivi, list files | Mostra qual è la predefinit |
| Prende un id | si | no — sempre il predefinit |

## Ce pots fare con ce che torna {#doing}

```javascript
const storage = await api.storage.get({ id });

// Any storage: read and write through run()
await storage.run({ action: "collections" });

// A computer only: its own files, on that machine
const pc = await api.storage.get({ id: computerId });
await pc.files.list();
```

> **Fichier e terminales existen solo in un computer**
>
> Assegnîs per loro su ningun altro get storage_not_local, e su un telefono storage_is_phone — i suoi files sono in suo browser. Teste tipo prima di arrivi.

```javascript
if (storage.type === "filesystem") {
  await storage.files.list();
} else {
  await storage.run({ action: "objects" });
}
```

## Ce porta {#fields}

| Campo | Is |
| --- | --- |
| id · étiquette | Identità, e nome di mostra. |
| tipo | sistema de fiches · telefono · navegador · base de datos · objeto |
| provider · gestitBy | Cenès isquit e chi lo opera. |
| servizio | Nosql · sql · objete su un IaGenify Storage cloud; null other. |
| isdefault | Se un salvatèn senza alza va aquí. |
| idmachine · nomede l'host · dispositivo | Su un dispositivo: qual. |

Nada qui porta un credential: quello che tu providenzis in connezion e usat dal servèr e non restituit.

- [ConnectadStorage](/pt/sdk/ref/connected-storage): Tutto sobre l'oggetto que restitue.
- [api.getStorage()](/pt/sdk/ref/iagenify/get-storage): Il predefinit, come quattro campi simples.

```python
target = api.storage.get()                # the default
one = api.storage.get(id=storage_id)      # a particular one
```

```python
storage = api.storage.get(id=storage_id)

if storage is None:
    raise LookupError("that storage is not on this account")
```

```python
storage = api.storage.get(id=storage_id)

# Any storage: read and write through run()
storage.run(action="collections")

# A computer only: its own files, on that machine
pc = api.storage.get(id=computer_id)
pc.files.list()
```

```python
if storage.type == "filesystem":
    storage.files.list()
else:
    storage.run(action="objects")
```
