# kinds()

Canonical URL: https://developers.iagenify.com/zh/sdk/ref/hosts/kinds/
Language: zh

`api.hosts.kinds() → Promise<Kind[]>`

存在哪种类型, 哪些是可用的, 以及为什么其他的不是。 阅读它, 而不是将列表写入页面 。

Status: free · availability per kind · suffixes come from here

```javascript
const kinds = await api.hosts.kinds();
// [{ kind: "site", hostSuffix: "…", deploy: "files", available: true, reason: null }, …]

const usable = kinds.filter((k) => k.available);
```

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `kind` | string |  | 要传递到的识别标识符 `create()`. |
| `hostSuffix` | string |  | 地址级别为此等。 |
| `deploy` | string |  | 部署需要什么——文件或代码。 |
| `available` | boolean |  | 能否创建它 。 |
| `reason` | string|null |  | 为什么,当它不能。 |

## 为什么可用性是一个字段 {#why}

> **无法服务的那种在创建时被拒绝**
>
> 从未创建过“现在 ” : 不回答的地址读作断线。 这个列表让界面只显示什么有效, 并解释为什么其余部分, 而不是在改变页面时更改。

## 不要硬编码后缀 {#suffix}

一种水平是蓄意的,它阻止顾客使用平台本身所回答的名字。 后缀被退回到这里,所以没有页次重复。

## 建造拾拾器 {#picker}

```javascript
for (const k of await api.hosts.kinds()) {
  render({ value: k.kind, label: k.kind, hint: k.hostSuffix, disabled: !k.available, why: k.reason });
}
```

- [create()](/zh/sdk/ref/hosts/create): 使用一个。
- [usage()](/zh/sdk/ref/hosts/usage): 你可能有多少个

```python
kinds = api.hosts.kinds()
# [{"kind": "site", "hostSuffix": "…", "deploy": "files", "available": True, "reason": None}, …]

usable = [k for k in kinds if k["available"]]
```

```python
for k in api.hosts.kinds():
    render(value=k["kind"], label=k["kind"], hint=k.get("hostSuffix"), disabled=not k["available"], why=k.get("reason"))
```
