Documentation
¶
Overview ¶
Package api provides shared voice gateway API infrastructure.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteError ¶
WriteError writes e as the JSON error response to r with its HTTP status and the request ID that apidto.RequestIDHandler set on r. The body omits the cause. Under the same rid, it logs a 5xx e as an error and another e with a cause as a warning, both with the cause.
Types ¶
type ErrorCode ¶
type ErrorCode string
ErrorCode is a machine-readable error identifier.
const ( CodeBadRequest ErrorCode = "BAD_REQUEST" CodeForbidden ErrorCode = "FORBIDDEN" CodeNotFound ErrorCode = "NOT_FOUND" CodeConflict ErrorCode = "CONFLICT" CodeInternalError ErrorCode = "INTERNAL_ERROR" CodeVoiceOfferFailed ErrorCode = "VOICE_OFFER_FAILED" // CodeRateLimited answers 429; its Retry-After header, when present, says when to retry. CodeRateLimited ErrorCode = "RATE_LIMITED" )
Standard error codes.
type ErrorResponse ¶
type ErrorResponse = apidto.ErrorResponse[ErrorCode]
ErrorResponse is the JSON body of a voice gateway error response.
type ProtocolVersion ¶
type ProtocolVersion uint8
ProtocolVersion identifies a published voice gateway wire contract.
const ProtocolV2 ProtocolVersion = 0
ProtocolV2 is the current gateway contract.
func ProtocolVersions ¶ added in v0.5.0
func ProtocolVersions() []ProtocolVersion
ProtocolVersions returns the published gateway contracts, oldest first. Hosts mount one route prefix per entry, so retiring a version needs no host edit.
func (ProtocolVersion) AcceptsTextSubprotocol ¶
func (v ProtocolVersion) AcceptsTextSubprotocol(headers []string) bool
AcceptsTextSubprotocol permits native clients to omit negotiation. Otherwise the route-selected protocol must appear among the offered alternatives.
func (ProtocolVersion) String ¶
func (v ProtocolVersion) String() string
String returns the route version name.
func (ProtocolVersion) TextSubprotocol ¶
func (v ProtocolVersion) TextSubprotocol() string
TextSubprotocol returns the WebSocket subprotocol for this wire version.