@@ -20,9 +20,8 @@ import type {
2020 TranslationHelp ,
2121} from "./types/yandex" ;
2222
23- // Export the encoding and decoding functions
24- export const yandexProtobuf = {
25- encodeTranslationRequest (
23+ export abstract class YandexVOTProtobuf {
24+ static encodeTranslationRequest (
2625 url : string ,
2726 duration : number ,
2827 requestLang : string ,
@@ -53,11 +52,13 @@ export const yandexProtobuf = {
5352 useNewModel,
5453 videoTitle,
5554 } ) . finish ( ) ;
56- } ,
57- decodeTranslationResponse ( response : ArrayBuffer ) {
55+ }
56+
57+ static decodeTranslationResponse ( response : ArrayBuffer ) {
5858 return VideoTranslationResponse . decode ( new Uint8Array ( response ) ) ;
59- } ,
60- encodeTranslationAudioRequest (
59+ }
60+
61+ static encodeTranslationAudioRequest (
6162 url : string ,
6263 translationId : string ,
6364 audioBuffer : AudioBufferObject ,
@@ -77,41 +78,55 @@ export const yandexProtobuf = {
7778 audioInfo : audioBuffer ,
7879 } ) ,
7980 } ) . finish ( ) ;
80- } ,
81- decodeTranslationAudioResponse ( response : ArrayBuffer ) {
81+ }
82+
83+ static decodeTranslationAudioResponse ( response : ArrayBuffer ) {
8284 return VideoTranslationAudioResponse . decode ( new Uint8Array ( response ) ) ;
83- } ,
84- encodeSubtitlesRequest ( url : string , requestLang : string ) {
85+ }
86+
87+ static encodeSubtitlesRequest ( url : string , requestLang : string ) {
8588 return SubtitlesRequest . encode ( {
8689 url,
8790 language : requestLang ,
8891 } ) . finish ( ) ;
89- } ,
90- decodeSubtitlesResponse ( response : ArrayBuffer ) {
92+ }
93+
94+ static decodeSubtitlesResponse ( response : ArrayBuffer ) {
9195 return SubtitlesResponse . decode ( new Uint8Array ( response ) ) ;
92- } ,
93- encodeStreamPingRequest ( pingId : number ) {
96+ }
97+
98+ static encodeStreamPingRequest ( pingId : number ) {
9499 return StreamPingRequest . encode ( {
95100 pingId,
96101 } ) . finish ( ) ;
97- } ,
98- encodeStreamRequest ( url : string , requestLang : string , responseLang : string ) {
102+ }
103+
104+ static encodeStreamRequest (
105+ url : string ,
106+ requestLang : string ,
107+ responseLang : string ,
108+ ) {
99109 return StreamTranslationRequest . encode ( {
100110 url,
101111 language : requestLang ,
102112 responseLanguage : responseLang ,
103113 } ) . finish ( ) ;
104- } ,
105- decodeStreamResponse ( response : ArrayBuffer ) {
114+ }
115+
116+ static decodeStreamResponse ( response : ArrayBuffer ) {
106117 return StreamTranslationResponse . decode ( new Uint8Array ( response ) ) ;
107- } ,
108- encodeYandexSessionRequest ( uuid : string , module : SessionModule ) {
118+ }
119+ }
120+
121+ export abstract class YandexSessionProtobuf {
122+ static encodeSessionRequest ( uuid : string , module : SessionModule ) {
109123 return YandexSessionRequest . encode ( {
110124 uuid,
111125 module,
112126 } ) . finish ( ) ;
113- } ,
114- decodeYandexSessionResponse ( response : ArrayBuffer ) {
127+ }
128+
129+ static decodeSessionResponse ( response : ArrayBuffer ) {
115130 return YandexSessionResponse . decode ( new Uint8Array ( response ) ) ;
116- } ,
117- } ;
131+ }
132+ }
0 commit comments