"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.listFacesPaginate = void 0;
const tslib_1 = require("tslib");
const Rekognition_1 = require("../Rekognition");
const RekognitionClient_1 = require("../RekognitionClient");
const ListFacesCommand_1 = require("../commands/ListFacesCommand");
const makePagedClientRequest = async (client, input, ...args) => {
    // @ts-ignore
    return await client.send(new ListFacesCommand_1.ListFacesCommand(input, ...args));
};
const makePagedRequest = async (client, input, ...args) => {
    // @ts-ignore
    return await client.listFaces(input, ...args);
};
function listFacesPaginate(config, input, ...additionalArguments) {
    return tslib_1.__asyncGenerator(this, arguments, function* listFacesPaginate_1() {
        let token = config.startingToken || "";
        let hasNext = true;
        let page;
        while (hasNext) {
            input["NextToken"] = token;
            input["MaxResults"] = config.pageSize;
            if (config.client instanceof Rekognition_1.Rekognition) {
                page = yield tslib_1.__await(makePagedRequest(config.client, input, ...additionalArguments));
            }
            else if (config.client instanceof RekognitionClient_1.RekognitionClient) {
                page = yield tslib_1.__await(makePagedClientRequest(config.client, input, ...additionalArguments));
            }
            else {
                throw new Error("Invalid client, expected Rekognition | RekognitionClient");
            }
            yield yield tslib_1.__await(page);
            token = page["NextToken"];
            hasNext = !!token;
        }
        // @ts-ignore
        return yield tslib_1.__await(undefined);
    });
}
exports.listFacesPaginate = listFacesPaginate;
//# sourceMappingURL=ListFacesPaginator.js.map