@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.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.paginateListThingGroupsForThing = void 0;
const ListThingGroupsForThingCommand_1 = require("../commands/ListThingGroupsForThingCommand");
const IoT_1 = require("../IoT");
const IoTClient_1 = require("../IoTClient");
const makePagedClientRequest = async (client, input, ...args) => {
return await client.send(new ListThingGroupsForThingCommand_1.ListThingGroupsForThingCommand(input), ...args);
};
const makePagedRequest = async (client, input, ...args) => {
return await client.listThingGroupsForThing(input, ...args);
};
async function* paginateListThingGroupsForThing(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.paginateListThingGroupsForThing = paginateListThingGroupsForThing;