This example assumes using RevAI; is in scope and apiKey contains your RevAI API key.
1 2 3 4 5 6 7 8 910111213141516171819202122
varapiKey=Environment.GetEnvironmentVariable("REVAI_API_KEY")is{Length:>0}value?value:thrownewAssertInconclusiveException("REVAI_API_KEY environment variable is not found.");usingvarclient=newRevAIClient(apiKey);// Submit a transcription job by providing a URL to an audio file.varjob=awaitclient.TranscriptionJobs.SubmitTranscriptionJobAsync(mediaUrl:"https://www.rev.ai/FTC_Sample_1.mp3");// The job runs asynchronously. Poll until it completes.while(job.Status==TranscriptionJobStatus.InProgress){awaitTask.Delay(TimeSpan.FromSeconds(5));job=awaitclient.TranscriptionJobs.GetTranscriptionJobByIdAsync(id:job.Id!);}// Retrieve the transcript once the job is complete.vartranscript=awaitclient.Transcript.GetTranscriptAsync(id:job.Id!);Console.WriteLine($"Transcript has {transcript.Monologues.Count} monologues");