Documentation
¶
Overview ¶
This package handles the versioning in the API for the various clients (prerecorded, live, etc.)
Index ¶
- Constants
- Variables
- func GetAgentAPI(ctx context.Context, host, version, path string, args ...interface{}) (string, error)
- func GetAnalyzeAPI(ctx context.Context, host, version, path string, ...) (string, error)
- func GetAuthAPI(ctx context.Context, host, version, path string, vals interface{}, ...) (string, error)
- func GetFluxAPI(ctx context.Context, host, version, path string, ...) (string, error)
- func GetLiveAPI(ctx context.Context, host, version, path string, ...) (string, error)
- func GetManageAPI(ctx context.Context, host, version, path string, vals interface{}, ...) (string, error)
- func GetPrerecordedAPI(ctx context.Context, host, version, path string, ...) (string, error)
- func GetSpeakAPI(ctx context.Context, host, version, path string, ...) (string, error)
- func GetSpeakStreamAPI(ctx context.Context, host, version, path string, ...) (string, error)
Constants ¶
const ( // APIVersion current supported version AgentAPIVersion string = "v1" // AgentPath is the current path for agent API AgentPath string = "agent/converse" )
const ( // version AuthAPIVersion string = "v1" // grant token GrantTokenURI string = "auth/grant" )
const ( // APIProtocol default protocol HTTPProtocol string = "https" // WSProtocol default protocol WSProtocol string = "wss" // APIPathListen APIPathListen string = "listen" // APITypeAgent APITypeAgent string = "agent" // APITypeLive APITypeLive string = "live" // APITypeSpeakStream APITypeSpeakStream string = "speak-stream" )
const ( // FluxAPIVersion is the default API version for the Flux endpoint FluxAPIVersion string = "v2" // FluxPath is the path for the Flux listen endpoint FluxPath string = "listen" )
const ( // LiveAPIVersion current supported version LiveAPIVersion string = "v1" // LivePath is the current path for live transcription LivePath string = "listen" )
const ( // version ManageAPIVersion string = "v1" // balances BalancesURI string = "projects/%s/balances" BalancesByIDURI string = "projects/%s/balances/%s" // invitations InvitationsURI string = "projects/%s/invites" InvitationsByIDURI string = "projects/%s/invites/%s" InvitationsLeaveURI string = "projects/%s/leave" // Keys KeysURI string = "projects/%s/keys" KeysByIDURI string = "projects/%s/keys/%s" // Members MembersURI string = "projects/%s/members" MembersByIDURI string = "projects/%s/members/%s" // models ModelsURI string = "models" ModelsByIDURI string = "models/%s" ModelsProjectURI string = "projects/%s/models" ModelsProjectByIDURI string = "projects/%s/models/%s" // projects ProjectsURI string = "projects" ProjectsByIDURI string = "projects/%s" // scopes MembersScopeByIDURI string = "projects/%s/members/%s/scopes" // usage UsageRequestURI string = "projects/%s/requests" UsageRequestByIDURI string = "projects/%s/requests/%s" UsageURI string = "projects/%s/usage" UsageFieldsURI string = "projects/%s/usage/fields" )
const ( // SpeakStreamAPIVersion current supported version SpeakStreamAPIVersion string = "v1" // SpeakStreamPath is the current path SpeakStreamPath string = "speak-stream" )
const ( // DefaultAPIVersion is the current supported default version for APIs DefaultAPIVersion string = "v1" )
Variables ¶
var ( // ErrInvalidPath invalid path ErrInvalidPath = errors.New("invalid path") // APIPathMap maps the API types to their default paths APIPathMap = map[string]string{ "agent": "agent", "analyze": "read", "prerecorded": APIPathListen, "speak": "speak", "speak-stream": "speak", "manage": "", "live": APIPathListen, } )
Functions ¶
func GetAgentAPI ¶
func GetAgentAPI(ctx context.Context, host, version, path string, args ...interface{}) (string, error)
GetAgentAPI is a function which controls the versioning of the agent API and provides mechanism for:
- overriding the host endpoint - overriding the version used - overriding the endpoint path - additional arguments to the query string/parameters
The return value is the complete URL endpoint to be used for the agent API
func GetAnalyzeAPI ¶
func GetAnalyzeAPI(ctx context.Context, host, version, path string, options *interfaces.AnalyzeOptions, args ...interface{}) (string, error)
GetAnalyzeAPI is a function which controls the versioning of the live transcription API and provides mechanism for:
- overriding the host endpoint - overriding the version used - overriding the endpoint path - additional arguments to the query string/parameters
The return value is the complete URL endpoint to be used for the live transcription
func GetAuthAPI ¶
func GetAuthAPI(ctx context.Context, host, version, path string, vals interface{}, args ...interface{}) (string, error)
GetAuthAPI is a function which controls the versioning of the auth API and provides mechanism for:
- overriding the host endpoint - overriding the version used - overriding the endpoint path - additional arguments to the query string/parameters
The return value is the complete URL endpoint to be used for auth
func GetFluxAPI ¶ added in v3.6.0
func GetFluxAPI(ctx context.Context, host, version, path string, options *interfaces.FluxTranscriptionOptions, args ...interface{}) (string, error)
GetFluxAPI builds the WebSocket URL for the Deepgram Flux (v2/listen) endpoint. It produces: wss://host/v2/listen?<FluxTranscriptionOptions>
Overrides:
- host: defaults to api.deepgram.com if empty
- version: defaults to "v2" if empty (can be overridden via ClientOptions.APIVersion)
- path: defaults to "listen" if empty (can be overridden via ClientOptions.Path)
func GetLiveAPI ¶
func GetLiveAPI(ctx context.Context, host, version, path string, options *interfaces.LiveTranscriptionOptions, args ...interface{}) (string, error)
GetLiveAPI is a function which controls the versioning of the live transcription API and provides mechanism for:
- overriding the host endpoint - overriding the version used - overriding the endpoint path - additional arguments to the query string/parameters
The return value is the complete URL endpoint to be used for the live transcription
func GetManageAPI ¶
func GetManageAPI(ctx context.Context, host, version, path string, vals interface{}, args ...interface{}) (string, error)
GetManageAPI is a function which controls the versioning of the manage API and provides mechanism for:
- overriding the host endpoint - overriding the version used - overriding the endpoint path - additional arguments to the query string/parameters
The return value is the complete URL endpoint to be used for manage
func GetPrerecordedAPI ¶
func GetPrerecordedAPI(ctx context.Context, host, version, path string, options *interfaces.PreRecordedTranscriptionOptions, args ...interface{}) (string, error)
GetPrerecordedAPI is a function which controls the versioning of the live transcription API and provides mechanism for:
- overriding the host endpoint - overriding the version used - overriding the endpoint path - additional arguments to the query string/parameters
The return value is the complete URL endpoint to be used for the live transcription
func GetSpeakAPI ¶
func GetSpeakAPI(ctx context.Context, host, version, path string, options *interfaces.SpeakOptions, args ...interface{}) (string, error)
GetSpeakAPI is a function which controls the versioning of the live transcription API and provides mechanism for:
- overriding the host endpoint - overriding the version used - overriding the endpoint path - additional arguments to the query string/parameters
The return value is the complete URL endpoint to be used for the live transcription
func GetSpeakStreamAPI ¶
func GetSpeakStreamAPI(ctx context.Context, host, version, path string, options *interfaces.WSSpeakOptions, args ...interface{}) (string, error)
GetSpeakStreamAPI is a function which controls the versioning of the text-to-speech API and provides mechanism for:
- overriding the host endpoint - overriding the version used - overriding the endpoint path - additional arguments to the query string/parameters
The return value is the complete URL endpoint to be used for the text-to-speech
Types ¶
This section is empty.