Files
lingniu-platform/sdk/frontend/oauth2-login-sdk/dist/utils/url.d.ts
2026-02-09 11:24:51 +08:00

55 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* URL处理工具
* 用于生成授权URL、解析URL参数等功能
*/
/**
* 生成随机字符串
* @param length 字符串长度默认32位
* @returns 随机字符串
*/
export declare function generateRandomString(length?: number): string;
/**
* 解析URL查询参数
* @param url URL字符串默认为当前URL
* @returns 查询参数对象
*/
export declare function parseQueryParams(url?: string): Record<string, string>;
/**
* 构建URL查询参数
* @param params 查询参数对象
* @returns 查询参数字符串
*/
export declare function buildQueryParams(params: Record<string, any>): string;
/**
* 生成OAuth2授权URL
* @param authorizationEndpoint 授权端点URL
* @param clientId 客户端ID
* @param redirectUri 重定向URL
* @param options 可选参数
* @returns 授权URL
*/
export declare function generateAuthorizationUrl(authorizationEndpoint: string, clientId: string, redirectUri: string, options?: {
responseType?: string;
scope?: string;
state?: string;
[key: string]: any;
}): string;
/**
* 检查当前URL是否为授权回调
* @param url URL字符串默认为当前URL
* @returns 是否为授权回调
*/
export declare function isCallbackUrl(url?: string): boolean;
/**
* 获取当前URL的路径名
* @param url URL字符串默认为当前URL
* @returns 路径名
*/
export declare function getPathname(url?: string): string;
/**
* 获取当前URL的主机名
* @param url URL字符串默认为当前URL
* @returns 主机名
*/
export declare function getHostname(url?: string): string;
//# sourceMappingURL=url.d.ts.map