# Categories (*categories*) ### Available Operations * [createCategory](#createcategory) - Creates a category * [getCategory](#getcategory) - Show category * [getSite](#getsite) - Get site info * [listCategories](#listcategories) - Retrieves a list of categories * [listCategoryTopics](#listcategorytopics) - List topics * [updateCategory](#updatecategory) - Updates a category ## createCategory Creates a category ### Example Usage ```typescript import { SDK } from "@lukehagar/discoursejs"; async function run() { const sdk = new SDK(); const res = await sdk.categories.createCategory({ color: "49d9e9", formTemplateIds: [ "", ], name: "", permissions: { "key": "", }, textColor: "f0fcfd", }); if (res.statusCode == 200) { // handle response } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | | `request` | [operations.CreateCategoryRequestBody](../../sdk/models/operations/createcategoryrequestbody.md) | :heavy_check_mark: | The request object to use for the request. | | `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. | ### Response **Promise<[operations.CreateCategoryResponse](../../sdk/models/operations/createcategoryresponse.md)>** ### Errors | Error Object | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4xx-5xx | */* | ## getCategory Show category ### Example Usage ```typescript import { SDK } from "@lukehagar/discoursejs"; import { GetCategoryRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations"; async function run() { const sdk = new SDK(); const id: number = 39147; const res = await sdk.categories.getCategory(id); if (res.statusCode == 200) { // handle response } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | `id` | *number* | :heavy_check_mark: | N/A | | `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. | ### Response **Promise<[operations.GetCategoryResponse](../../sdk/models/operations/getcategoryresponse.md)>** ### Errors | Error Object | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4xx-5xx | */* | ## getSite Can be used to fetch all categories and subcategories ### Example Usage ```typescript import { SDK } from "@lukehagar/discoursejs"; async function run() { const sdk = new SDK(); const res = await sdk.categories.getSite(); if (res.statusCode == 200) { // handle response } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. | ### Response **Promise<[operations.GetSiteResponse](../../sdk/models/operations/getsiteresponse.md)>** ### Errors | Error Object | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4xx-5xx | */* | ## listCategories Retrieves a list of categories ### Example Usage ```typescript import { SDK } from "@lukehagar/discoursejs"; import { ListCategoriesRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations"; async function run() { const sdk = new SDK(); const includeSubcategories: boolean = false; const res = await sdk.categories.listCategories(includeSubcategories); if (res.statusCode == 200) { // handle response } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | `includeSubcategories` | *boolean* | :heavy_minus_sign: | N/A | | `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. | ### Response **Promise<[operations.ListCategoriesResponse](../../sdk/models/operations/listcategoriesresponse.md)>** ### Errors | Error Object | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4xx-5xx | */* | ## listCategoryTopics List topics ### Example Usage ```typescript import { SDK } from "@lukehagar/discoursejs"; import { ListCategoryTopicsRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations"; async function run() { const sdk = new SDK(); const id: number = 394133; const slug: string = ""; const res = await sdk.categories.listCategoryTopics(id, slug); if (res.statusCode == 200) { // handle response } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | `id` | *number* | :heavy_check_mark: | N/A | | `slug` | *string* | :heavy_check_mark: | N/A | | `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. | ### Response **Promise<[operations.ListCategoryTopicsResponse](../../sdk/models/operations/listcategorytopicsresponse.md)>** ### Errors | Error Object | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4xx-5xx | */* | ## updateCategory Updates a category ### Example Usage ```typescript import { SDK } from "@lukehagar/discoursejs"; import { UpdateCategoryRequest, UpdateCategoryRequestBody } from "@lukehagar/discoursejs/dist/sdk/models/operations"; async function run() { const sdk = new SDK(); const id: number = 353500; const requestBody: UpdateCategoryRequestBody = { color: "49d9e9", formTemplateIds: [ "", ], name: "", permissions: { "key": "", }, textColor: "f0fcfd", }; const res = await sdk.categories.updateCategory(id, requestBody); if (res.statusCode == 200) { // handle response } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | | `id` | *number* | :heavy_check_mark: | N/A | | `requestBody` | [operations.UpdateCategoryRequestBody](../../sdk/models/operations/updatecategoryrequestbody.md) | :heavy_minus_sign: | N/A | | `config` | [AxiosRequestConfig](https://axios-http.com/docs/req_config) | :heavy_minus_sign: | Available config options for making requests. | ### Response **Promise<[operations.UpdateCategoryResponse](../../sdk/models/operations/updatecategoryresponse.md)>** ### Errors | Error Object | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4xx-5xx | */* |