From d6c661825fff4da14645b669d2896921b7e7ebb2 Mon Sep 17 00:00:00 2001 From: Kravets <57632712+kravetsone@users.noreply.github.com> Date: Sat, 11 May 2024 17:44:10 +0300 Subject: [PATCH] chore: improve JSDoc comments --- package.json | 2 +- scripts/generate.ts | 6 +++++- src/index.ts | 2 ++ src/media-input.ts | 6 +++++- src/media-methods-helper.ts | 8 ++++++-- src/media-upload.ts | 6 +++++- 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index ee2235e..ebf7ffb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@gramio/files", "main": "./dist/index.js", - "version": "0.0.7", + "version": "0.0.8", "type": "commonjs", "description": "Set of utils for work with files and Telegram Bot API", "keywords": [ diff --git a/scripts/generate.ts b/scripts/generate.ts index 5416ab1..493ac6f 100644 --- a/scripts/generate.ts +++ b/scripts/generate.ts @@ -126,7 +126,11 @@ fs.writeFile( return file instanceof File || file instanceof Promise; } - /** @codegenerated */ + /** + * A set of methods with the function of checking whether a file has been passed in the parameters + * + * @codegenerated + * */ export const MEDIA_METHODS: MethodsWithMediaUpload = {${Object.entries( methods, ) diff --git a/src/index.ts b/src/index.ts index ce7d5b8..b6d77a0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,6 +3,8 @@ * * Set of utils for work with files and Telegram Bot API * + * [Documentation](https://gramio.netlify.app/files/overview.html) + * * @example * ```typescript * import { MediaInput, MediaUpload } from "@gramio/files"; diff --git a/src/media-input.ts b/src/media-input.ts index a37914d..26e982d 100644 --- a/src/media-input.ts +++ b/src/media-input.ts @@ -6,7 +6,11 @@ import type { TelegramInputMediaVideo, } from "@gramio/types"; -/** Class-helper with static methods that represents the content of a media message to be sent. */ +/** + * Class-helper with static methods that represents the content of a media message to be sent. + * + * [Documentation](https://gramio.netlify.app/files/media-input.html) + */ export class MediaInput { /** * Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. diff --git a/src/media-methods-helper.ts b/src/media-methods-helper.ts index 4e19a02..269fd84 100644 --- a/src/media-methods-helper.ts +++ b/src/media-methods-helper.ts @@ -16,14 +16,18 @@ type MethodsWithMediaUpload = { ]; }; -/** Guard for check is it File or Promise */ +/** Guard for check is it {@link File} or {@link Promise} */ export function isFile(file?: TelegramInputFile | object | string) { if (!file || typeof file !== "object") return false; return file instanceof File || file instanceof Promise; } -/** @codegenerated */ +/** + * A set of methods with the function of checking whether a {@link File} has been passed in the parameters + * + * @codegenerated + * */ export const MEDIA_METHODS: MethodsWithMediaUpload = { setWebhook: [(params) => isFile(params.certificate), null], sendPhoto: [(params) => isFile(params.photo), null], diff --git a/src/media-upload.ts b/src/media-upload.ts index 5942226..87aa9dd 100644 --- a/src/media-upload.ts +++ b/src/media-upload.ts @@ -3,7 +3,11 @@ import { basename } from "node:path"; import type { Readable } from "node:stream"; import { convertStreamToBuffer } from "./utils"; -/** Class-helper with static methods for file uploading. */ +/** + * Class-helper with static methods for file uploading. + * + * [Documentation](https://gramio.netlify.app/files/media-upload.html) + */ export class MediaUpload { /** * Method for uploading Media File by local path.