UNPKG

osu-api-extended

Version:

Advanced osu! api wrapper cover all V2 and V1 endpoints, and provide useful tools

50 lines (49 loc) 1.84 kB
import { auth_params, auth_response, auth_scopes, IError, lazer_auth_response, Modes_names } from '../types/index'; import { UserAuth } from '../types/v2/users_details'; export declare const settings: { timeout: number; throwErrors: boolean; }; export declare const credentials: { type: any; api_key: string; client_id: number | string; client_secret: string; login: string; password: string; redirect_url: string; state: string; cached_token_path: string; scopes: auth_scopes; }; export declare const cache: { v1: string; v2: string; 'ratelimit-remaining': number; 'ratelimit-limit': number; }; type ResponseLogin<T extends auth_params['type']> = T extends 'v2' ? Promise<auth_response & IError> : T extends 'v1' ? string : T extends 'lazer' ? Promise<lazer_auth_response & IError> : T extends 'cli' ? Promise<auth_response & IError> : null; export declare function login<T extends auth_params>(params: auth_params): ResponseLogin<T['type']>; export declare function set_v2(token: string): string; export declare function refresh_token(): Promise<string | (auth_response & IError) | (lazer_auth_response & IError)>; export declare function build_url({ client_id, redirect_url, scopes, state }: { client_id: number | string; redirect_url: string; scopes: auth_scopes; state?: string; }): string; export declare function authorize(params: { code: string; mode?: Modes_names; client_id: number | string; client_secret: string; redirect_url: string; }): Promise<UserAuth>; export declare function refresh_session(params: { client_id: number | string; client_secret: string; mode?: Modes_names; refresh_token: string; scopes?: auth_scopes; }): Promise<UserAuth>; export {};