UNPKG

@spider-cloud/spider-client

Version:

Isomorphic Javascript SDK for Spider Cloud services

70 lines (69 loc) 2.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.setBaseUrl = exports.APISchema = exports.APIRoutes = exports.ApiVersion = exports.Collection = exports.RedirectPolicy = void 0; // The HTTP redirect policy to use. Loose allows all domains and Strict only allows relative requests to the domain. var RedirectPolicy; (function (RedirectPolicy) { RedirectPolicy["Loose"] = "Loose"; RedirectPolicy["Strict"] = "Strict"; })(RedirectPolicy || (exports.RedirectPolicy = RedirectPolicy = {})); // records that you can query var Collection; (function (Collection) { Collection["Websites"] = "websites"; Collection["Pages"] = "pages"; Collection["PagesMetadata"] = "pages_metadata"; // Leads Collection["Contacts"] = "contacts"; Collection["CrawlState"] = "crawl_state"; Collection["CrawlLogs"] = "crawl_logs"; Collection["Profiles"] = "profiles"; Collection["Credits"] = "credits"; Collection["Webhooks"] = "webhooks"; Collection["APIKeys"] = "api_keys"; })(Collection || (exports.Collection = Collection = {})); // The API version for Spider var ApiVersion; (function (ApiVersion) { ApiVersion["V1"] = "v1"; })(ApiVersion || (exports.ApiVersion = ApiVersion = {})); // The API routes paths. var APIRoutes; (function (APIRoutes) { // Crawl a website to collect the contents. Can be one page or many. APIRoutes["Crawl"] = "crawl"; // Crawl a website to collect the links. Can be one page or many. APIRoutes["Links"] = "links"; // Crawl a website to collect screenshots. Can be one page or many. APIRoutes["Screenshot"] = "screenshot"; // Search for something and optionally crawl the pages or get the results of the search. APIRoutes["Search"] = "search"; // Transform HTML to markdown or text. APIRoutes["Transform"] = "transform"; // Dynamic collection routes. APIRoutes["Data"] = "data"; // Get the credits remaining for an account. APIRoutes["DataCredits"] = "data/credits"; })(APIRoutes || (exports.APIRoutes = APIRoutes = {})); // The base API target info for Spider Cloud. exports.APISchema = { url: "https://api.spider.cloud", versions: { current: ApiVersion.V1, v1: { routes: APIRoutes, end_date: "", }, latest: { routes: APIRoutes, end_date: "", }, }, }; // Adjust the Spider Cloud endpoint. const setBaseUrl = (url) => { if (url) { exports.APISchema["url"] = url; } }; exports.setBaseUrl = setBaseUrl;