Commit adb1da20 authored by mingyard's avatar mingyard

feat:tx token dto

parent 43a9976e
......@@ -16,6 +16,7 @@ import { RegisterDto } from './dto/req/register.dto';
import { Auth } from '@/common/decorators/auth.decorator';
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
import { LoginResDto } from './dto/res/loginRes.dto';
import { TxAsrResDto } from './dto/res/txAsrRes.dto';
@ApiTags('auth')
@Controller('auth')
......@@ -76,10 +77,14 @@ export class AuthController {
// 获取ASR token
@ApiOperation({ summary: '获取ASR token' })
@ApiResponse({ status: 200, description: '获取ASR token成功' })
@ApiResponse({
status: 200,
description: '获取ASR token成功',
type: TxAsrResDto,
})
@Auth()
@Post('getAsrToken')
async getAsrToken(): Promise<any> {
async getAsrToken(): Promise<TxAsrResDto> {
return await this.authService.getTxAsrToken();
}
}
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
class CredentialsDto {
@ApiProperty({
description: '临时凭证',
example:
'7eRLMGMgdgO3dz3AT3FoFffZmSi4iaVaa772328643dbf876ce3b26670de0028ah9qYwLfndpoPilupmpzO4bEQYzKylSjiQe8JwhR4p88AEvzX2tOTYESaw9bAOLZwC9vytsGv0-e2Zun3TuPCHHYA0M8oxN1c6kKEW21071QK0Vi7XRErouyjx0HBBsVsE19JMAQqwm9CKziLyooOCWB_DqV0UkhGKJS4treZSXT3osKkqrokS61b52XxTQIh2HvdaoQy9UHob-TXMzDtkG24wJlpeMFttM4tvk3KOWBxp1gdinhKjZcFuxuqBRVAlrX5EO5jWslcZjNjnwKPphzGAoWMcAJkVacXnCpqWXPD7ghrJa-Y7VVuCBSU2By3XMG5Jp-W-hZAl-H0KUpeow',
})
Token: string;
@ApiProperty({
description: '临时凭证',
example:
'AKIDotjS9M7qTbyk8AIZ3T8mnPXqX5MNVilKyFXe4H280hBPLyUEvTsT6_2TiCsbt5Bu',
})
TmpSecretId: string;
@ApiProperty({
description: '临时凭证',
example: '0/PGctEjFv4lartXTmNCvi4hEn9vd1MBGG5HVdb2SWE=',
})
TmpSecretKey: string;
}
export class TxAsrResDto {
@ApiProperty({
description: '过期时间',
type: Number,
example: 1708249279,
})
ExpiredTime: number;
@ApiProperty({
description: '过期时间',
type: String,
example: '2024-02-18T09:41:19Z',
})
Expiration: string;
@ApiProperty({
description: '临时凭证',
type: Object,
example: {
Token:
'7eRLMGMgdgO3dz3AT3FoFffZmSi4iaVaa772328643dbf876ce3b26670de0028ah9qYwLfndpoPilupmpzO4bEQYzKylSjiQe8JwhR4p88AEvzX2tOTYESaw9bAOLZwC9vytsGv0-e2Zun3TuPCHHYA0M8oxN1c6kKEW21071QK0Vi7XRErouyjx0HBBsVsE19JMAQqwm9CKziLyooOCWB_DqV0UkhGKJS4treZSXT3osKkqrokS61b52XxTQIh2HvdaoQy9UHob-TXMzDtkG24wJlpeMFttM4tvk3KOWBxp1gdinhKjZcFuxuqBRVAlrX5EO5jWslcZjNjnwKPphzGAoWMcAJkVacXnCpqWXPD7ghrJa-Y7VVuCBSU2By3XMG5Jp-W-hZAl-H0KUpeow',
TmpSecretId:
'AKIDotjS9M7qTbyk8AIZ3T8mnPXqX5MNVilKyFXe4H280hBPLyUEvTsT6_2TiCsbt5Bu',
TmpSecretKey: '0/PGctEjFv4lartXTmNCvi4hEn9vd1MBGG5HVdb2SWE=',
},
})
@Type(() => CredentialsDto)
Credentials: CredentialsDto;
@ApiProperty({
description: '请求ID',
type: String,
example: '425928a3-dc93-4f3e-8ad8-9713b1ee14dc',
})
RequestId: string;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment