@squidcloud/client
Version:
A typescript implementation of the Squid client
64 lines (63 loc) • 2.58 kB
TypeScript
import { 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;
/**
* 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 url The URL to shorten. It must be a valid URL and should include the protocol (start with http:// or
* https://).
* @param secondsToLive Seconds to live for the shortened URL. If set to 0, the URL will never expire. Defaults to 30
* days.
*/
createShortUrl(url: string, secondsToLive?: number): 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.
*
* The parameter arrays should be of the same length and in the same order
*
* @param urls The URLs to shorten. It must be a valid URL and should include the protocol (start with http:// or
* https://).
* @param secondsToLive Seconds to live for each shortened URL. If set to 0, the URL will never expire.
*/
createShortUrls(urls: string[], secondsToLive?: number): 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>;
}