UNPKG

@squidcloud/client

Version:

A typescript implementation of the Squid client

59 lines (58 loc) 2.39 kB
import { CreateShortUrlOptions, CreateShortUrlsOptions, WebAiSearchResponse, WebShortUrlBulkResponse, WebShortUrlResponse } from '../../internal-common/src/public-types/web.public-types'; /** * WebClient provides methods to interact with web-related functionalities. * @category Platform */ export declare class WebClient { private readonly rpcManager; private readonly region; private readonly appId; private readonly apiKey; private readonly consoleRegion; /** Headers for short URL API requests. Only use after asserting apiKey is defined. */ private get shortUrlHeaders(); /** * Search the web using AI. Returns a response containing Markdown text and cited URLs. * @param query The keywords or query string to search for. */ aiSearch(query: string): Promise<WebAiSearchResponse>; /** * Fetch content from a URL. * @param url The URL to fetch content from. */ getUrlContent(url: string): Promise<string>; /** * Creates a shortened URL for the given URL. * * Defaults to a 1-day expiration if no expiry is provided via the `secondsToLive` field. * If `secondsToLive` is set to 0, the URL will never expire. * * @param urlOrOptions - Either a URL string or an options object with url and all available options. */ createShortUrl(urlOrOptions: string | CreateShortUrlOptions): Promise<WebShortUrlResponse>; /** * Creates shortened URLs for the given URLs. * * Defaults to a 1-day expiration if no expiry is provided via the `secondsToLive` field. * If `secondsToLive` is set to 0, the URL will never expire. * * @param urlsOrOptions - Either an array of URL strings or an options object and all available options. */ createShortUrls(urlsOrOptions: string[] | CreateShortUrlsOptions): Promise<WebShortUrlBulkResponse>; /** * Deletes a shortened URL by its ID. * * The ID is the unique identifier at the end of the shortened URL. * * @param id The ID of the shortened URL to delete. */ deleteShortUrl(id: string): Promise<void>; /** * Deletes shortened URLs by their IDs. * * The ID is the unique identifier at the end of the shortened URL. * * @param ids The IDs of the shortened URL to delete. */ deleteShortUrls(ids: string[]): Promise<void>; }