ms_fetch_key {conrad}R Documentation

Find API Key for Microsoft Cognitive Services Text To Speech (TTS)

Description

Determines if option(ms_tts_key) is set or key is stored in an environment variable (MS_TTS_API_KEY, MS_TTS_API_KEY1, MS_TTS_API_KEY2). If not found, stops and returns an error. If found, returns the value.

Usage

ms_fetch_key(api_key = NULL, error = TRUE)

ms_exist_key(api_key = NULL)

ms_set_key(api_key)

ms_valid_key(api_key = NULL, region = "westus")

Arguments

api_key

Microsoft Cognitive Services API key

error

Should the function error if api_key = NULL?

region

Subscription region for API key. For more info, see https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/regions

Value

API key

Logical vector, indicating whether user has API key.

Logical vector, indicating whether API key is valid.

Functions

Note

You can either set the API key using option(ms_tts_key) or have it accessible by api_key = Sys.getenv('MS_TTS_API_KEY")}, or \code{api_key = Sys.getenv('MS_TTS_API_KEY1")}, or \code{api_key = Sys.getenv('MS_TTS_API_KEY2")

Examples


res = ms_fetch_key(api_key = NULL, error = FALSE)


# Don't provide api key but fetch it programmatically
ms_exist_key(api_key = NULL)

# Provide api key XXX
ms_exist_key(api_key = "XXX")


# Set api key XXX
ms_set_key(api_key = "XXX")


# Check whether API key is valid in westus
ms_valid_key(region = "westus")


[Package conrad version 1.0.0 Index]