Spaces:
Runtime error
Runtime error
Download src/modules/catalog/catalog.controller.ts from MuhammadNoman7600/qwen_2.5_model: direct link, hf CLI and curl.
- Browser
- Download file 3.14 kB
-
https://huggingface.co/spaces/MuhammadNoman7600/qwen_2.5_model/resolve/main/src/modules/catalog/catalog.controller.ts
- Command line
-
hf download hf://spaces/MuhammadNoman7600/qwen_2.5_model/src/modules/catalog/catalog.controller.ts
-
curl -L -o catalog.controller.ts https://huggingface.co/spaces/MuhammadNoman7600/qwen_2.5_model/resolve/main/src/modules/catalog/catalog.controller.ts
3.14 kB
| import { Controller, Get, Post, Param, Body, Query } from '@nestjs/common'; | |
| import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger'; | |
| import { CatalogService } from './catalog.service'; | |
| import { SendProductDto, SendCatalogDto, ProductQueryDto } from './dto/send-product.dto'; | |
| import { RequireRole } from '../auth/decorators/auth.decorators'; | |
| import { ApiKeyRole } from '../auth/entities/api-key.entity'; | |
| ('catalog') | |
| ('sessions/:sessionId') | |
| export class CatalogController { | |
| constructor(private readonly catalogService: CatalogService) {} | |
| ('catalog') | |
| ({ summary: 'Get business catalog info (not implemented by any engine)' }) | |
| ({ | |
| status: 200, | |
| description: 'Always null on whatsapp-web.js: catalog reads are not implemented on either engine.', | |
| }) | |
| ({ | |
| status: 501, | |
| description: 'Not supported by the active engine: Baileys does not implement catalog reads.', | |
| }) | |
| async getCatalog(('sessionId') sessionId: string) { | |
| return this.catalogService.getCatalog(sessionId); | |
| } | |
| ('catalog/products') | |
| ({ summary: 'List catalog products (not implemented by any engine)' }) | |
| ({ | |
| status: 200, | |
| description: 'Always an empty page on whatsapp-web.js: catalog reads are not implemented on either engine.', | |
| }) | |
| ({ | |
| status: 501, | |
| description: 'Not supported by the active engine: Baileys does not implement catalog reads.', | |
| }) | |
| async getProducts(('sessionId') sessionId: string, () query: ProductQueryDto) { | |
| return this.catalogService.getProducts(sessionId, query.page, query.limit); | |
| } | |
| ('catalog/products/:productId') | |
| ({ summary: 'Get a specific product (not implemented by any engine)' }) | |
| ({ | |
| status: 200, | |
| description: 'Always null on whatsapp-web.js: catalog reads are not implemented on either engine.', | |
| }) | |
| ({ | |
| status: 501, | |
| description: 'Not supported by the active engine: Baileys does not implement catalog reads.', | |
| }) | |
| async getProduct(('sessionId') sessionId: string, ('productId') productId: string) { | |
| return this.catalogService.getProduct(sessionId, productId); | |
| } | |
| ('messages/send-product') | |
| (ApiKeyRole.OPERATOR) | |
| ({ summary: 'Send a product message (not supported by any engine)' }) | |
| ({ status: 501, description: 'Not supported by the active engine: no engine can send product messages.' }) | |
| async sendProduct(('sessionId') sessionId: string, () dto: SendProductDto) { | |
| return this.catalogService.sendProduct(sessionId, dto.chatId, dto.productId, dto.body); | |
| } | |
| ('messages/send-catalog') | |
| (ApiKeyRole.OPERATOR) | |
| ({ summary: 'Send catalog link (not supported by any engine)' }) | |
| ({ status: 501, description: 'Not supported by the active engine: no engine can send catalog links.' }) | |
| async sendCatalog(('sessionId') sessionId: string, () dto: SendCatalogDto) { | |
| return this.catalogService.sendCatalog(sessionId, dto.chatId, dto.body); | |
| } | |
| } | |