IBM Speech to Text v0.3.0 IBMSpeechToText.Token View Source

This module provides a way to get IAM tokens used for authenticated requests to IBM Cloud Services

Link to this section Summary

Functions

Creates "Authorization" header using token that can be used when making requests to IBM Cloud Service API

Gets access token for the given IAM API key

Checks if the token should be refreshed

Link to this section Types

Link to this type

t() View Source
t() :: %IBMSpeechToText.Token{
  expiration: non_neg_integer(),
  scope: String.t(),
  token: String.t(),
  type: String.t()
}

Link to this section Functions

Creates "Authorization" header using token that can be used when making requests to IBM Cloud Service API

Link to this function

get(api_key \\ System.get_env("SPEECH_TO_TEXT_IAM_APIKEY")) View Source
get(api_key :: String.t()) ::
  {:ok, IBMSpeechToText.Token.t()} | {:error, reason}
when reason:
       :timeout
       | {:unexpected_trailers, any()}
       | {:unknown_response, any()}
       | {:response, Keyword.t()}
       | any()

Gets access token for the given IAM API key

If the API key is not provided, it is taken from environment variable SPEECH_TO_TEXT_IAM_APIKEY

More info on tokens and authentication can be found here

Link to this function

should_refresh?(token) View Source
should_refresh?(t()) :: boolean()

Checks if the token should be refreshed