Collection
资源列表(Collection)类,相对于单个的资源(Resource)或者实体(Entity),资源列表(Collection)包含了一个或多个资源或者实体
成员函数:
item(id: string) → {Entity | null}
根据id获取实体或资源
参数:
参数名称 | 参数类型 | 描述 |
---|
id | string | 传入需要获取实体的id |
at(index: number) → {Entity | null}
根据下表index返回列表(Collection)中的实体(Entity)
create(params: Object) → {Promise.<any>}
创建此列表类型的一个实体,对映REST API的post方法
参数:
参数名称 | 参数类型 | 描述 |
---|
params | Object | 需要创建的实体的属性 |
size() → {number}
返回这个列表的长度
list() → {Array.<Entity>}
返回整个列表