UNPKG

apify-client

Version:
72 lines 2.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StoreCollectionClient = void 0; const tslib_1 = require("tslib"); const ow_1 = tslib_1.__importDefault(require("ow")); const resource_collection_client_1 = require("../base/resource_collection_client"); /** * Client for browsing Actors in the Apify Store. * * The Apify Store contains publicly available Actors that can be used by anyone. * This client provides methods to search and list Actors from the Store. * * @example * ```javascript * const client = new ApifyClient(); * const storeClient = client.store(); * * // Search for Actors in the Store * const { items } = await storeClient.list({ search: 'web scraper' }); * * // Get details about a specific Store Actor * const actor = await storeClient.list({ username: 'apify', actorName: 'web-scraper' }); * ``` * * @see https://docs.apify.com/platform/actors/publishing */ class StoreCollectionClient extends resource_collection_client_1.ResourceCollectionClient { /** * @hidden */ constructor(options) { super({ resourcePath: 'store', ...options, }); } /** * Lists Actors from the Apify Store. * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. * ```javascript * const paginatedList = await client.list(options); * ``` * * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` * * @param options - Search and pagination options. * @returns A paginated iterator of store Actors. * @see https://docs.apify.com/api/v2/store-get */ list(options = {}) { (0, ow_1.default)(options, ow_1.default.object.exactShape({ limit: ow_1.default.optional.number.not.negative, offset: ow_1.default.optional.number.not.negative, search: ow_1.default.optional.string, sortBy: ow_1.default.optional.string, category: ow_1.default.optional.string, username: ow_1.default.optional.string, pricingModel: ow_1.default.optional.string, includeUnrunnableActors: ow_1.default.optional.boolean, })); return this._listPaginated(options); } } exports.StoreCollectionClient = StoreCollectionClient; //# sourceMappingURL=store_collection.js.map