UNPKG

@nekiro/kick-api

Version:

Efortlessly query kick.com api using easy to use interface with properly typed responses.

61 lines (60 loc) 1.88 kB
import type { Category } from "../types"; import { KickClient } from "../client"; export declare class CategoriesModule { private client; private readonly baseRoute; constructor(client: KickClient); /** * Get categories based on search query * * Returns up to 100 results at a time; use the `page` parameter to get more results. * * @param params - Search parameters * @param params.q - Search query (required) * @param params.page - Page number (defaults to 1 if not provided) * * @returns Promise that resolves to array of categories * * @example Basic search * ```typescript * const categories = await client.categories.getCategories({ * q: "gaming" * }); * ``` * * @example Search with pagination * ```typescript * const categories = await client.categories.getCategories({ * q: "music", * page: 2 * }); * ``` * * @throws {KickBadRequestError} When search query (q) is missing * * @see https://docs.kick.com/apis/categories#get-categories */ getCategories(params: { q: string; page?: number; }): Promise<Category[]>; /** * Get a specific category by ID * * @param categoryId - The ID of the category to retrieve * * @returns Promise that resolves to the category details * * @example Get category by ID * ```typescript * const category = await client.categories.getCategory(1); * console.log(category.name); // e.g., "Gaming" * ``` * * @throws {KickNotFoundError} When category with the given ID doesn't exist * @throws {KickBadRequestError} When category ID is invalid * * @see https://docs.kick.com/apis/categories#get-category */ getCategory(categoryId: number): Promise<Category>; }