mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
[iobroker] add getObjectList[Async] to the adapter interface (#41272)
This commit is contained in:
committed by
Ryan Cavanaugh
parent
98feb5a0f0
commit
1d52577a72
Vendored
+25
-1
@@ -332,7 +332,7 @@ declare global {
|
||||
/** Parameters for @link{Objects.getObjectList} */
|
||||
interface GetObjectListParams extends GetObjectViewParams {
|
||||
/** Whether docs should be included in the return list */ // TODO: What are docs?
|
||||
include_docs: boolean;
|
||||
include_docs?: boolean;
|
||||
}
|
||||
|
||||
type LogLevel = 'silly' | 'debug' | 'info' | 'warn' | 'error';
|
||||
@@ -839,6 +839,30 @@ declare global {
|
||||
options?: unknown,
|
||||
): Promise<NonNullCallbackReturnTypeOf<GetObjectViewCallback>>;
|
||||
|
||||
/**
|
||||
* Returns a list of objects with id between params.startkey and params.endkey
|
||||
* @param params Parameters determining the objects included in the return list. Null to include all objects
|
||||
* @param options If the returned list should be sorted. And some internal options.
|
||||
* @param callback Is called when the operation has finished (successfully or not)
|
||||
*/
|
||||
// TODO: options should be optional: https://github.com/ioBroker/ioBroker.js-controller/issues/574
|
||||
// getObjectList(params: GetObjectListParams | null, callback: GetObjectListCallback): void;
|
||||
getObjectList(
|
||||
params: GetObjectListParams | null,
|
||||
options: { sorted?: boolean } | Record<string, any>,
|
||||
callback: GetObjectListCallback,
|
||||
): void;
|
||||
/**
|
||||
* Returns a list of objects with id between params.startkey and params.endkey
|
||||
* @param params Parameters determining the objects included in the return list. Null to include all objects
|
||||
* @param options If the returned list should be sorted. And some internal options.
|
||||
* @param callback Is called when the operation has finished (successfully or not)
|
||||
*/
|
||||
getObjectListAsync(
|
||||
params: GetObjectListParams | null,
|
||||
options: { sorted?: boolean } | Record<string, any>,
|
||||
): Promise<NonNullCallbackReturnTypeOf<GetObjectListCallback>>;
|
||||
|
||||
// ==============================
|
||||
// states
|
||||
|
||||
|
||||
@@ -198,6 +198,15 @@ adapter.getObjectViewAsync("system", "admin", {startkey: "foo", endkey: "bar"}).
|
||||
docs && docs.rows[0] && docs.rows[0].id.toLowerCase();
|
||||
});
|
||||
|
||||
// TODO: https://github.com/ioBroker/ioBroker.js-controller/issues/574
|
||||
// {} should be left out or undefined
|
||||
adapter.getObjectList({startkey: "foo", endkey: "bar"}, {}, (err, result) => {
|
||||
result && result.rows[0] && result.rows[0].id.toLowerCase();
|
||||
});
|
||||
adapter.getObjectListAsync({startkey: "foo", endkey: "bar"}, {}).then(result => {
|
||||
result && result.rows[0] && result.rows[0].id.toLowerCase();
|
||||
});
|
||||
|
||||
adapter.subscribeObjects("*");
|
||||
adapter.subscribeStates("*");
|
||||
adapter.subscribeForeignObjects("*");
|
||||
|
||||
Reference in New Issue
Block a user