text: "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.paginateListProjects = void 0;
  const CodeBuild_1 = require("../CodeBuild");
  const CodeBuildClient_1 = require("../CodeBuildClient");
  const ListProjectsCommand_1 = require("../commands/ListProjectsCommand");
  const makePagedClientRequest = async (client, input, ...args) => {
      return await client.send(new ListProjectsCommand_1.ListProjectsCommand(input), ...args);
  };
  const makePagedRequest = async (client, input, ...args) => {
      return await client.listProjects(input, ...args);
  };
  async function* paginateListProjects(config, input, ...additionalArguments) {
      let token = config.startingToken || undefined;
      let hasNext = true;
      let page;
      while (hasNext) {
          input.nextToken = token;
          if (config.client instanceof CodeBuild_1.CodeBuild) {
              page = await makePagedRequest(config.client, input, ...additionalArguments);
          }
          else if (config.client instanceof CodeBuildClient_1.CodeBuildClient) {
              page = await makePagedClientRequest(config.client, input, ...additionalArguments);
          }
          else {
              throw new Error("Invalid client, expected CodeBuild | CodeBuildClient");
          }
          yield page;
          token = page.nextToken;
          hasNext = !!token;
      }
      return undefined;
  }
  exports.paginateListProjects = paginateListProjects;
  