namespace folksprak.words.services { /** */ export function _abstract ( action_name : string, input : any ) : Promise { return ( fetch ( lib_url.encode ( { "protocol": "http", "host": folksprak.words.conf.get("server.host"), "port": folksprak.words.conf.get("server.port"), "path": folksprak.words.conf.get("server.path"), } ), { "method": "POST", "headers": { "Content-Type": "application/json", }, "body": lib_json.encode ( { "action": action_name, "input": input, } ), } ) .then(x => x.json()) ); } /** */ export type type_translate = Array< { language_from : string; value_from : string; language_to : string; value_to : string; } >; export async function translate ( language_from : string, language_to : string, token : string ) : Promise { const result : any = await _abstract ( 'translate', { 'language_from': language_from, 'language_to': language_to, 'token': token, } ); return Promise.resolve((result)); } }