talisik-shortener
Version:
JavaScript/TypeScript client for Talisik URL Shortener - A privacy-focused URL shortening service
64 lines • 1.88 kB
TypeScript
/**
* React hooks for Talisik URL Shortener
*
* These hooks are optional and only available if React is installed.
* They provide an easy way to integrate Talisik with React applications.
*
* @example
* ```typescript
* import { useTalisik } from 'talisik-shortener';
*
* function MyComponent() {
* const { shortenUrl, loading, error } = useTalisik({
* baseUrl: 'https://api.talisik.com'
* });
*
* const handleShorten = async () => {
* const result = await shortenUrl({ url: 'https://example.com' });
* console.log(result.shortUrl);
* };
*
* return (
* <button onClick={handleShorten} disabled={loading}>
* {loading ? 'Shortening...' : 'Shorten URL'}
* </button>
* );
* }
* ```
*/
import { TalisikClient } from "./client";
import { TalisikConfig, UseTalisikResult, UseTalisikOptions } from "./types";
/**
* React hook for using Talisik URL Shortener
*
* @param options - Configuration options
* @returns Object with shortening functions, loading state, and errors
*/
export declare function useTalisik(options: UseTalisikOptions): UseTalisikResult | undefined;
/**
* React hook for creating a Talisik client instance
*
* @param config - Client configuration
* @returns Memoized TalisikClient instance
*
* @example
* ```typescript
* function MyComponent() {
* const client = useTalisikClient({
* baseUrl: 'https://api.talisik.com'
* });
*
* const handleShorten = async () => {
* const result = await client.shorten({ url: 'https://example.com' });
* };
*
* return <button onClick={handleShorten}>Shorten</button>;
* }
* ```
*/
export declare function useTalisikClient(config: TalisikConfig): TalisikClient | undefined;
export declare const hooks: {
useTalisik: typeof useTalisik;
useTalisikClient: typeof useTalisikClient;
};
//# sourceMappingURL=hooks.d.ts.map