tiny1z
Version:
The Tiny1z API Client is a convenient and lightweight npm package that allows developers to seamlessly integrate the Tiny1z URL Shortener API into their applications. Simplify URL shortening, retrieval, and management with just a few lines of code.
46 lines (44 loc) • 1.55 kB
text/typescript
interface SingleUrlData {
original_url: string;
alias?: string;
password?: string;
expiry_duration?: number;
expiry_unit?: 'hours' | 'days' | 'months';
user_reference?: string;
}
interface BulkUrlItem {
url: string;
alias?: string;
password?: string;
expiry_duration?: number;
expiry_unit?: 'hours' | 'days' | 'months';
}
interface BulkUrlData {
original_urls: BulkUrlItem[];
global_password?: string | null;
global_expiry_duration?: number | null;
global_expiry_unit?: 'hours' | 'days' | 'months' | null;
user_reference?: string;
}
type SortOrder = 'asc' | 'desc';
interface Tiny1zClientOptions {
apiKey: string;
baseUrl?: string;
}
declare class Tiny1zClient {
private apiKey;
private baseUrl;
constructor(options: Tiny1zClientOptions | string);
private request;
/** Shorten a single URL */
createSingleUrl(data: SingleUrlData): Promise<unknown>;
/** Shorten multiple URLs in bulk */
createBulkUrl(data: BulkUrlData): Promise<unknown>;
/** Retrieve URLs created by a specific user reference */
getUserUrls(reference: string): Promise<unknown>;
/** Get detailed information about a specific short URL */
singleUrlInfo(slug: string): Promise<unknown>;
/** Fetch all URLs created by the authenticated user */
getAllUrls(offset?: number, limit?: number, sort?: SortOrder): Promise<unknown>;
}
export { type BulkUrlData, type BulkUrlItem, type SingleUrlData, type SortOrder, type Tiny1zClientOptions, Tiny1zClient as default };