UNPKG

@softchef/cdk-iot-device-management

Version:

IoT device management is composed of things, thing types, thing groups, jobs, files API services. The constructs can be used independently, that are based on full-managed service to create an API Gateway & Lambda function.

36 lines (35 loc) 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.paginateListThings = void 0; const ListThingsCommand_1 = require("../commands/ListThingsCommand"); const IoT_1 = require("../IoT"); const IoTClient_1 = require("../IoTClient"); const makePagedClientRequest = async (client, input, ...args) => { return await client.send(new ListThingsCommand_1.ListThingsCommand(input), ...args); }; const makePagedRequest = async (client, input, ...args) => { return await client.listThings(input, ...args); }; async function* paginateListThings(config, input, ...additionalArguments) { let token = config.startingToken || undefined; let hasNext = true; let page; while (hasNext) { input.nextToken = token; input["maxResults"] = config.pageSize; if (config.client instanceof IoT_1.IoT) { page = await makePagedRequest(config.client, input, ...additionalArguments); } else if (config.client instanceof IoTClient_1.IoTClient) { page = await makePagedClientRequest(config.client, input, ...additionalArguments); } else { throw new Error("Invalid client, expected IoT | IoTClient"); } yield page; token = page.nextToken; hasNext = !!token; } return undefined; } exports.paginateListThings = paginateListThings;