This example assumes using Speechmatics; is in scope and apiKey contains your Speechmatics API key.
1 2 3 4 5 6 7 8 91011121314
varapiKey=Environment.GetEnvironmentVariable("SPEECHMATICS_API_KEY")is{Length:>0}value?value:thrownewAssertInconclusiveException("SPEECHMATICS_API_KEY environment variable is not found.");// Create a Speechmatics client that implements ISpeechToTextClient.usingvarclient=newSpeechmaticsClient(apiKey);ISpeechToTextClientsttClient=client;// Verify the client provides proper metadata.varmetadata=sttClient.GetService<SpeechToTextClientMetadata>();// The client can also be retrieved via GetService.varself=sttClient.GetService<SpeechmaticsClient>();