All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.larksuite.oapi.service.speech_to_text.v1.SpeechToTextService Maven / Gradle / Ivy

Go to download

Larksuite open platform facilitates the integration of enterprise applications and larksuite, making collaboration and management more efficient

There is a newer version: 1.0.18-rc8
Show newest version
// Code generated by lark suite oapi sdk gen
package com.larksuite.oapi.service.speech_to_text.v1;

import com.larksuite.oapi.core.api.AccessTokenType;
import com.larksuite.oapi.core.api.Api;
import com.larksuite.oapi.core.api.ReqCaller;
import com.larksuite.oapi.core.api.request.*;
import com.larksuite.oapi.core.api.response.*;
import com.larksuite.oapi.core.Config;
import com.larksuite.oapi.service.speech_to_text.v1.model.*;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;

public class SpeechToTextService {

    private final Config config;
    private final Speechs speechs;

    public SpeechToTextService(Config config) {
        this.config = config;
        this.speechs = new Speechs(this);
    }

    public Speechs getSpeechs() {
        return speechs;
    }

    public static class Speechs {

        private final SpeechToTextService service;

        public Speechs(SpeechToTextService service) {
            this.service = service;
        }
    
        public SpeechFileRecognizeReqCall fileRecognize(SpeechFileRecognizeReqBody body, RequestOptFn... optFns) {
            return new SpeechFileRecognizeReqCall(this, body, optFns);
        }
    
        public SpeechStreamRecognizeReqCall streamRecognize(SpeechStreamRecognizeReqBody body, RequestOptFn... optFns) {
            return new SpeechStreamRecognizeReqCall(this, body, optFns);
        }
    
    }
    public static class SpeechFileRecognizeReqCall extends ReqCaller {
        private final Speechs speechs;
        
        private final SpeechFileRecognizeReqBody body;
        private final List optFns;
        private SpeechFileRecognizeResult result;
        
        private SpeechFileRecognizeReqCall(Speechs speechs, SpeechFileRecognizeReqBody body, RequestOptFn... optFns) {
        
            this.body = body;
            this.optFns = new ArrayList<>();
            this.optFns.addAll(Arrays.asList(optFns));
            this.result = new SpeechFileRecognizeResult();
            this.speechs = speechs;
        }
        

        @Override
        public Response execute() throws Exception {
            Request request = Request.newRequest("speech_to_text/v1/speech/file_recognize", "POST",
                    new AccessTokenType[]{AccessTokenType.Tenant},
                    this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
            return Api.send(this.speechs.service.config, request);
        }
    }
    public static class SpeechStreamRecognizeReqCall extends ReqCaller {
        private final Speechs speechs;
        
        private final SpeechStreamRecognizeReqBody body;
        private final List optFns;
        private SpeechStreamRecognizeResult result;
        
        private SpeechStreamRecognizeReqCall(Speechs speechs, SpeechStreamRecognizeReqBody body, RequestOptFn... optFns) {
        
            this.body = body;
            this.optFns = new ArrayList<>();
            this.optFns.addAll(Arrays.asList(optFns));
            this.result = new SpeechStreamRecognizeResult();
            this.speechs = speechs;
        }
        

        @Override
        public Response execute() throws Exception {
            Request request = Request.newRequest("speech_to_text/v1/speech/stream_recognize", "POST",
                    new AccessTokenType[]{AccessTokenType.Tenant},
                    this.body, this.result, this.optFns.toArray(new RequestOptFn[]{}));
            return Api.send(this.speechs.service.config, request);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy