# نظرة عامة

Canonical URL: https://developers.iagenify.com/ar/sdk/ref/connected-storage/
Language: ar

البيانات تقرأ و تكتب خلال التشغيل ()؛ يحصل الحاسوب على إضافات اثنين ملفين خاصين به و قاذفاته الخاصة.

Status: run() everywhere · files and terminals on a computer only

This is what `api.storage.create()`, `connect()`, `device()`, `get()` and `list()` all hand back. You never construct one. The reason it is a single type is the point of the whole resource: the code that reads a database we host is the code that reads one you connected.

## السطح {#surface}

| العضو | & & & & | الوظيفة |
| --- | --- | --- |
| تنفيذ | كل ما | يقرأ ويكتب البيانات |
| & لا شيء | )الحواسيب فقط( | تلك الآلة هي ملفاتها الخاصة |
| الميفادات | )الحواسيب فقط( | الصدفات و الخوادم التي تفوق على الإجابة |

## ما الذي يحمله {#properties}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `id` | string |  | -المحددة. `storageId` أي مكان مطلوب |
| `label` | string |  | اسم العرض. صاحب الحساب يمكن أن يغيره ، لذا لا تطابقه. |
| `type` | string |  | `filesystem` · `phone` · `browser` · `database` · `object`. **الحقل الذي يجب أن يفرع.** |
| `provider` | string |  | ما هو وراءه `mongodb`, `d1`, `r2`, `s3`, `iagenify`, `machine`, `browser`. |
| `managedBy` | string |  | الذي يعمل عليه |
| `service` | string|null |  | `nosql` · `sql` · `object` وضع IaGenify تخزين تخزين في التخزين. `null` (ب) أو |
| `isDefault` | boolean |  | IF a حفظ مع لا هدف هنا. |
| `machineId · hostname` | string|null |  | على حاسوب: أي آلة. |
| `deviceId` | string|null |  | على الهاتف: تحديد المتصفح يحتفظ به. |
| `limits` | object |  | ما هي مسارات التخزين في الفضاء الخاص بها. |
| `lastActivityAt · createdAt` | string|null |  | عندما كان يستخدم آخر مرة، وعندما كان مسجلا. |

> **لا يوجد شهادة على هذا كائن**
>
> ما زودته بالإتصال يستخدم من قبل الخادم للاتصال ولا يتم تسليمه أبداً. لا شيء هنا يمكن أن يتسرب كلمة مرور عن طريق الدخول أو الإرسال إلى صفحة.

## الفرع على أساس نوع الفرع، لا على أساس مقدِّم الخدمات {#branch}

`provider` (أ) أن تخبركم بما يوجد وراء التخزين؛ `type` و الثانية هي ما يجب أن تختبره شفرتك

```javascript
for (const storage of await api.storage.list()) {
  switch (storage.type) {
    case "database":
      await storage.run({ action: "collections" });
      break;
    case "object":
      await storage.run({ action: "list" });
      break;
    case "filesystem":
      await storage.files.list();          // this machine's own files
      break;
    case "phone":
    case "browser":
      // Its files are in its browser — reachable from the page, not from here.
      break;
  }
}
```

## A أداة a a تخزين يُبقي خاصّته أداء {#devices}

| نوع | بياناته | run() | & لا شيء |
| --- | --- | --- | --- |
| :: الجسم | على الحساب | نعم | لا: |
| أنت | على تلك الآلة | :: أن يكون محلياً | نعم - على تلك الآلة |
| ميكرو ميكرو ميكرو ميكرو ميكرو | في ذلك المتصفح | :: أن يكون محلياً | لا - انظر الجسر |

> **وملفات ومحطات طرفيات ترمي بدلاً من إعادتها فارغة**
>
> على أي شيء ليس حاسوباً، الوصول إلى الملفات storage_not_local - - - أو - storage_is_phone على الهاتف، الذي يقول أين الملفات هي في الواقع. اختبار النوع أولاً؛ نتيجة فارغة ستكون كذبة.

```javascript
import { IaGenifyError } from "iagenify";

try {
  await storage.files.list();
} catch (err) {
  if (err instanceof IaGenifyError && err.code === "storage_not_local") {
    // Not a computer. Its data is read through run().
  }
}
```

## نفس الشيء، أينما جاء من {#same}

```javascript
const ours = await api.storage.create({ service: "nosql", label: "App data" });
const yours = await api.storage.connect({ label: "Prod", type: "database", provider: "mongodb",
  endpoint: { credentials: { uri } } });

// Identical calls, different backends
for (const base of [ours, yours]) {
  await base.run({ action: "count", collection: "events" });
}
```

- [run()](/ar/sdk/ref/connected-storage/run): كل عمل، كل عمل، كل عمل، وما كل عمل، وما يكلف.
- [& لا شيء](/ar/sdk/ref/connected-storage/files): ملفات حاسوب خاصة بها على تلك الآلة
- [api.storage](/ar/sdk/ref/storage): ست طرق للحصول على واحدة من هذه

```python
for storage in api.storage.list():
    if storage.type == "database":
        storage.run(action="collections")
    elif storage.type == "object":
        storage.run(action="list")
    elif storage.type == "filesystem":
        storage.files.list()          # this machine's own files
    elif storage.type in ("phone", "browser"):
        pass  # Its files are in its browser — reachable from the page, not from here.
```

```python
# In Python, files is None on anything that is not a computer:
# its data is read through run().
if storage.files is None:
    storage.run(action="collections")
else:
    storage.files.list()
```

```python
ours = api.storage.create(service="nosql", label="App data")
yours = api.storage.connect(label="Prod", type="database", provider="mongodb",
                            endpoint={"credentials": {"uri": uri}})

# Identical calls, different backends
for base in (ours, yours):
    base.run(action="count", collection="events")
```
