
class API_TextRecognising {

    constructor() {
        this.URL_TextRecognising = "/TextRecognising/Recognising";
        this.URL_TextRecognising_Learn = "/TextRecognising/Learn";
    }



    async Request_TextRecognising(file) {

        console.log("Api request:" + this.URL_TextRecognising);

        let response = await fetch(this.URL_TextRecognising,
            {
                method: 'POST',
                headers: {
                    "Content-Type": "application/json"
                },
                body: JSON.stringify({
                    file: file
                })                
            }
        );
        let json = await response.json();


        return json;
    }

    async Request_TextRecognising_Learn(file, number) {

        console.log("Api request:" + this.URL_TextRecognising_Learn);

        let response = await fetch(this.URL_TextRecognising_Learn,
            {
                method: 'POST',
                headers: {
                    "Content-Type": "application/json"
                },
                body: JSON.stringify({
                    file: file,
                    number: number
                })
            }
        );
        let json = await response.json();


        return json;
    }

}