Skip to main content

Crate videosdk

Crate videosdk 

Source
Expand description

Rust server SDK for the VideoSDK v2 REST APIs.

§Getting started

Construct a Client from your project credentials. It reads VIDEOSDK_API_KEY and VIDEOSDK_SECRET from the environment when they are not passed explicitly.

let client = videosdk::Client::builder()
    .api_key("my-key")
    .secret("my-secret")
    .build()?;

§Authentication

The client mints a short-lived HS256 JWT from your key and secret, attaches it to every request, and refreshes it before it expires. Signing happens locally — nothing is sent anywhere to authenticate. You never construct a token or set a header yourself.

To mint a token for a participant — to hand to a client-side SDK — use Client::access_token:

let token = client
    .access_token()?
    .set_participant("participant-1")
    .grant(Grant::AllowJoin)
    .for_room("room-1")
    .expires_in(Duration::from_secs(2 * 60 * 60))
    .to_jwt()?;

§Optional parameters

Request parameters are plain structs whose optional fields are Option<T>. Build them with struct-update syntax:

let params = ListRoomsParams {
    page: Some(2),
    ..Default::default()
};

§Errors

Every call returns Result<T>. Match on Error, or use the predicates:

match result {
    Ok(room) => println!("{room}"),
    Err(err) if err.is_not_found() => println!("no such room"),
    Err(err) => eprintln!("failed: {err}"),
}

§Retries

Requests are retried up to ClientBuilder::max_retries times (2 by default) with exponential backoff and jitter. A 429 is always retried, and honors the server’s Retry-After. Network errors, timeouts and 5xx responses are retried only for idempotent methods, so a POST is never replayed.

§Pagination

List endpoints return a Page. Walk it by hand with Page::next_page, or stream every item across every page with Page::into_stream.

Structs§

AbsentDataAlert
Alerts when a metric stops reporting data.
AccessTokenBuilder
Fluently builds a VideoSDK access token.
AcquireResourceParams
The parameters for ResourcePoolResource::acquire.
AgentComputeProfile
The compute profile of a deployment version.
AgentDeployment
A cloud agent deployment.
AgentDeploymentResource
Cloud agent deployments. Reached via AgentsResource::deployment.
AgentDeploymentVersion
A deployment version.
AgentInitConfig
The registry configuration a worker uses to initialize.
AgentLogEntry
A single console-log entry.
AgentRoomOptions
Per-dispatch room behavior.
AgentScaling
The replica scaling of a deployment.
AgentsResource
Dispatches deployed agents into rooms. Reached via Client::agents.
AlertConditionOperator
The comparison operator in an alert rule condition.
AlertDomain
The product domain an alert rule is scoped to.
AlertMatchType
How a condition must be met over the evaluation window.
AlertReduceTo
Collapses each series to a single value before the threshold check.
AlertRule
A configured alert rule.
AlertRuleCondition
Compares the query’s aggregated value against a threshold.
AlertRuleConfig
An alert rule’s config: a metric query and a threshold condition (both required), plus optional evaluation, absent-data alerting, and a formula over additional_queries.
AlertRuleEvaluation
Controls how often and over what window the rule runs.
AlertRuleFilter
Narrows a metric query. value is a string, number, or array of them.
AlertRuleGroupBy
Groups a metric query by an attribute key.
AlertRuleHaving
Filters on an aggregated column.
AlertRuleQuery
Selects and aggregates a metric to alert on.
AlertRuleStatus
Whether an alert rule is active or paused.
AlertRulesResource
The alert-rules API. Reached via Client::alert_rules.
AlertSeverity
An alert rule’s severity.
Api
The raw HTTP escape hatch, reachable via Client::api.
ApiError
An error returned by the API as a non-2xx HTTP response.
AutoCloseConfig
The auto-close behavior of a room’s session, as carried on a Room.
AutoCloseConfigInput
The auto-close behavior for a room’s session.
AutoCloseType
What happens when a room’s session ends.
AutoStartConfig
Compositions to start automatically when a session begins.
BatchCall
A bulk outbound phone campaign.
BatchCallCancelMode
How a batch is cancelled.
BatchCallRecord
A single per-number record in a batch.
BatchCallRecordsResource
A batch’s per-number records. Reached via BatchCallsResource::records.
BatchCallRetryConfig
Configures retries for a batch.
BatchCallRetryStatus
A call status that can trigger a retry.
BatchCallStats
A status breakdown for a batch.
BatchCallStatus
A batch’s lifecycle state.
BatchCallTiming
When a batch runs.
BatchCallWebhookConfig
Configures a batch’s webhook.
BatchCallWebhookEvent
A batch-call webhook event.
BatchCallsResource
Bulk outbound phone campaigns. Reached via Client::batch_call.
Client
The VideoSDK server SDK client.
ClientBuilder
Builds a Client.
ComposerType
The composer type a unit is acquired for.
CompositeParticipantSelector
Selects a participant, and optionally which of their tracks, to compose.
CompositeRecording
A server-side composed recording.
CompositeRecordingListParams
The query parameters for RecordingCompositeResource::list.
CompositeRecordingStartParams
The parameters for RecordingCompositeResource::start.
CompositeWatermark
A watermark applied to a composite recording.
Composition
The composition options shared by every egress: layout, priority, grid size, orientation, theme and quality.
CompositionConfig
The wire composition configuration, shared by recording, HLS and livestream.
Connector
A per-provider telephony webhook ingress.
ConnectorProvider
A telephony provider.
ConnectorsResource
Telephony connectors. Reached via Client::connectors.
CreateAlertRuleParams
The parameters for AlertRulesResource::create.
CreateBatchCallParams
The parameters for BatchCallsResource::create.
CreateConnectorParams
The parameters for ConnectorsResource::create.
CreateInboundTrunkParams
The parameters for InboundTrunkResource::create.
CreateOutboundTrunkParams
The parameters for OutboundTrunkResource::create.
CreatePhoneNumbersParams
The parameters for PhoneNumbersResource::create.
CreateRoutingRuleParams
The parameters for SipRoutingRulesResource::create.
CreateSipCallParams
The parameters for SipCallsResource::create.
CreateSipWebhookParams
The parameters for creating or updating a SIP webhook.
CreateSocketIngressParams
The parameters for SocketIngressResource::create.
CreateWhepParams
The parameters for WhepResource::create.
CreateWhipParams
The parameters for WhipResource::create.
DeleteRecordsResult
The result of a bulk record deletion.
DeployAgentParams
The parameters for AgentDeploymentResource::create.
DeployImage
A container image for a deployment version.
DeployedAgent
The result of AgentDeploymentResource::create.
DispatchAgentParams
The parameters for AgentsResource::dispatch and connect.
DispatchResult
The result of dispatching an agent.
EgressHandle
A handle to a running egress.
ExportBatchCallRecordsParams
The query parameters for BatchCallRecordsResource::export.
GeneralDispatchAgentParams
The parameters for AgentsResource::general_dispatch, a managed or low-code dispatch. Unlike the others, this ignores version_tag and wait.
GenerateTokenParams
Configures generate_token.
HlsCaptureParams
The parameters for HlsResource::capture.
HlsCaptureResult
The result of HlsResource::capture.
HlsListParams
The query parameters for HlsResource::list.
HlsResource
The HLS API. Reached via Client::hls.
HlsStartParams
The parameters for HlsResource::start.
HlsStream
An HLS stream, or a finished HLS recording.
HlsToMp4Params
The parameters for TranscodingsResource::hls_to_mp4.
InboundTrunkResource
Inbound SIP trunks: connections that receive calls for a set of numbers. Reached via SipTrunksResource::inbound.
IndividualRecording
A participant recording, or its per-track variant.
IndividualRecordingListParams
The query parameters for the participant and track recording lists.
LayoutConfig
The wire layout configuration of a composition.
ListAlertRulesParams
The query parameters for AlertRulesResource::list.
ListBatchCallRecordsParams
The query parameters for BatchCallRecordsResource::list.
ListBatchCallsParams
The query parameters for BatchCallsResource::list.
ListDeploymentLogsParams
The query parameters for AgentDeploymentResource::logs.
ListDeploymentsParams
The query parameters for AgentDeploymentResource::list.
ListParams
The pagination query parameters common to every list endpoint.
ListRealtimeTranscriptionsParams
The query parameters for RealtimeTranscriptionResource::list.
ListResourcesParams
The query parameters for ResourcePoolResource::list.
ListTranscodingsParams
The query parameters for TranscodingsResource::list.
Livestream
An RTMP-out livestream.
MeetingRecordingMergeParams
The parameters for TranscodingsResource::meeting_recording_merge.
MeetingRecordingRef
A recording reference for a meeting-recording merge.
MergeChannel
A single channel entry on a merge recording.
MergeChannelEntry
One source in a merge channel.
MergeRecording
A merged stereo-audio recording.
MergeRecordingCreateParams
The parameters for MergeRecordingResource::create.
MergeRecordingListParams
The query parameters for MergeRecordingResource::list.
MergeRecordingResource
Muxes individual recordings into stereo channels. Reached via RecordingsResource::merge.
MergeRecordingResult
The result of starting a merge job.
MergeTranscodingParams
The parameters for TranscodingsResource::merge.
MessageResponse
The plain {message} body returned by many action and delete endpoints.
Method
The Request Method (VERB)
MultiComposition
Independently starts multiple compositions of the same type.
OnFailureConfig
The behavior applied when a composition fails.
OutboundTrunkResource
Outbound SIP trunks: connections used to place calls to a SIP host. Reached via SipTrunksResource::outbound.
Page
A page of list results.
PageInfo
Normalized pagination metadata, consistent across every list endpoint.
Participant
A participant within a session.
ParticipantRecordingStartParams
The parameters for RecordingParticipantResource::start.
ParticipantTimelog
A single join/leave interval for a participant.
ParticipantsResource
A room-keyed view over a room’s live participants. Reached via Client::participants.
PhoneNumberInboundConfig
Configures a phone number’s inbound gateway.
PhoneNumberInfo
A provisioned phone number.
PhoneNumberListParams
The query parameters for PhoneNumbersResource::list.
PhoneNumberOutboundConfig
Configures a phone number’s outbound gateway.
PhoneNumberWithGateways
A phone number with the gateways attached to it.
PhoneNumbersResource
Provisioned phone numbers. Reached via SipResource::phone_numbers.
RawRequest
Configures a raw Api or Client::request call.
RealtimeSummaryConfig
A post-transcription summary configuration.
RealtimeTranscription
A realtime transcription job. Its id is the transcription id.
RealtimeTranscriptionExtension
The extension sub-object on a realtime transcription.
RealtimeTranscriptionExtensionConfig
The nested configuration of a realtime transcription’s extension.
RealtimeTranscriptionResource
Live transcription against a room’s active session. Reached via TranscriptionResource::realtime.
Recording
A composited room recording.
RecordingCompositeResource
Records a server-side composed mix. Reached via RecordingsResource::composite.
RecordingFile
A produced recording or output file.
RecordingGetParams
The parameters for RecordingsResource::get.
RecordingListParams
The query parameters for RecordingsResource::list.
RecordingParticipantResource
Records individual participants. Reached via RecordingsResource::participant.
RecordingStartParams
The parameters for RecordingsResource::start, a room recording.
RecordingTrackResource
Records individual tracks. Reached via RecordingsResource::track.
RecordingsResource
The recordings API. Reached via Client::recordings.
Region
A VideoSDK region code, accepted as a room’s geo-fence.
ReleaseResourceResult
The outcome of releasing a single unit.
ResourceMode
A unit’s capture mode.
ResourcePoolResource
The resource pool. Reached via Client::resource_pool.
ResourceQuality
A unit’s output quality.
ResourceStatus
A composition unit’s status.
ResourceUnit
A pre-acquired composition resource unit.
Room
A room, a.k.a. a “meeting”: a durable id that hosts live sessions.
RoomCreateParams
The parameters for RoomsResource::create.
RoomListParams
The query parameters for RoomsResource::list.
RoomValidation
The result of RoomsResource::validate.
RoomWebhook
A room-level webhook subscription, as carried on a Room.
RoomWebhookInput
Subscribes a room to its session events.
RoomsResource
The rooms (meetings) API. Reached via Client::rooms.
RtmpListParams
The query parameters for RtmpResource::list.
RtmpResource
The RTMP-out API: push a room to RTMP destinations. Reached via Client::rtmp.
RtmpStartParams
The parameters for RtmpResource::start.
RtmpStream
An RTMP destination.
Session
A session: a single live occupancy of a room.
SessionEndParams
The parameters for SessionsResource::end.
SessionListParams
The query parameters for SessionsResource::list.
SessionRemoveParticipantParams
The parameters for SessionsResource::remove_participant.
SessionStatus
A session’s lifecycle state.
SessionsResource
The sessions API. Reached via Client::sessions.
SipAuth
SIP credentials.
SipCall
A SIP call.
SipCallListParams
The query parameters for SipCallsResource::list.
SipCallStatus
A call’s lifecycle status.
SipCallsResource
SIP calls. Reached via SipResource::calls.
SipDirection
A routing-rule or call direction.
SipIncludeHeaders
Which SIP headers to forward.
SipMediaEncryption
Whether media is encrypted.
SipRegion
A SIP-capable region.
SipResource
The SIP / telephony API. Reached via Client::sip.
SipRoomConfig
The destination-room configuration of a routing rule, as it appears on the wire.
SipRoomPrefix
How a per-call room id is generated. A strategy, not a literal prefix.
SipRoomType
How a routing rule allocates its destination room.
SipRoutingRule
A routing rule, binding provisioned phone numbers to a dispatch target.
SipRoutingRuleListParams
The query parameters for SipRoutingRulesResource::list.
SipRoutingRulesResource
SIP routing rules. Reached via SipResource::routing_rules.
SipTransport
A SIP transport protocol.
SipTrunk
An inbound or outbound SIP trunk.
SipTrunkListParams
The query parameters for listing trunks.
SipTrunksResource
Groups the inbound and outbound trunk sub-resources. Reached via SipResource::trunks.
SipWebhook
A webhook delivering SIP call-event notifications.
SipWebhookEvent
A SIP call-lifecycle webhook event.
SipWebhookListParams
The query parameters for SipWebhooksResource::list.
SipWebhooksResource
SIP webhooks. Reached via SipResource::webhooks.
SocketIngress
A socket-ingest session.
SocketIngressAgent
Agent metadata to associate with an ingest session.
SocketIngressResource
Streams media and data frames into a room over a single-use WebSocket. To tear down, close the socket; the URL also expires on its own. Reached via Client::socket_ingress.
StartRealtimeTranscriptionParams
The parameters for RealtimeTranscriptionResource::start.
StopTarget
What to stop: an EgressHandle, or a bare room id.
SummaryConfig
A post-call AI summary configuration. Requires transcription to be enabled.
SwitchRoomParams
The parameters for SipCallsResource::switch_room.
TokenClaims
A decoded view of a token payload.
TokenOptions
Overrides applied to every token the client mints for its own requests.
TrackRecordingStartParams
The parameters for RecordingTrackResource::start.
Transcoding
A transcoding job.
TranscodingFile
A transcoding job’s output file.
TranscodingStatus
A transcoding job’s lifecycle state.
TranscodingStorage
The output storage target of an HLS-to-MP4 transcoding.
TranscodingTask
A transcoding job kind.
TranscodingWatermark
A watermark applied to a merge transcoding.
TranscodingsResource
Transcoding jobs. Reached via Client::transcodings.
TranscriptionConfig
A real-time transcription configuration.
TranscriptionResource
The transcription API. Reached via Client::transcription.
TransferSipCallParams
The parameters for SipCallsResource::transfer.
UpdateAlertRuleParams
The parameters for AlertRulesResource::update. Only the set fields change.
UpdateBatchCallParams
The editable fields of a batch: draft, scheduled or parsed.
UpdateBatchCallRecordParams
The editable fields of a pending record.
UpdateInboundTrunkParams
The parameters for InboundTrunkResource::update.
UpdateOutboundTrunkParams
The parameters for OutboundTrunkResource::update. The same reset semantics as UpdateInboundTrunkParams apply.
UpdatePhoneNumberGatewayParams
The parameters for PhoneNumbersResource::update_gateway.
UpdateRoutingRuleParams
The parameters for SipRoutingRulesResource::update. A rule’s direction is fixed at creation and cannot be changed.
UploadBatchCallParams
The parameters for BatchCallsResource::upload.
WebhookDelivery
A single webhook delivery attempt.
WebhookDeliverySummary
A summary of a resource’s webhook delivery attempts.
WhepPlayback
A WHEP playback credential.
WhepResource
WHEP egress: standards-based WebRTC pull from a room. Requires an active session. Reached via Client::whep.
WhepSource
Selects the remote participant a WHEP subscriber pulls.
WhipIngress
A WHIP ingest credential.
WhipResource
WHIP ingress: WebRTC-HTTP publish into a room. Reached via Client::whip.

Enums§

AgentImage
A container image for a deployment: either a reference string, or a full DeployImage.
CompositionLayout
A composition layout: one of the named layouts, or a custom template.
CompositionQuality
A recorder quality tier.
EgressType
The kind of egress an EgressHandle refers to.
Error
The error type returned by every fallible SDK call.
ErrorKind
A coarse classification of an Error.
Expect
What the caller expects the response body to be.
Grant
A participant permission claim — an entry in the token’s permissions.
HlsCaptureFormat
The image format of a thumbnail capture.
LayoutPriority
Which participant a layout prioritizes.
LayoutType
A composition layout style, as it appears on the wire.
Orientation
A composition’s orientation.
ParticipantFileFormat
The file format of a participant recording.
RecordingFileFormat
The file format of a room or composite recording.
RoutingRuleTarget
Where a routing rule sends the caller.
Theme
A composition’s theme.
TrackFileFormat
The file format of a track recording.
TrackKind
The media kind of a track recording.
Value
Represents any valid JSON value.

Constants§

DEFAULT_BASE_URL
The production API endpoint.
DEFAULT_TOKEN_TTL
The token lifetime used when none is specified.
VERSION
This SDK’s version, reported in the User-Agent header of every request.

Functions§

decode_token
Decodes a token’s payload without verifying its signature.
generate_token
Signs a JWT for authenticating against the VideoSDK v2 REST APIs.
parse_expires_in
Converts a duration string such as "30s", "10m", "24h", "7d", "2w" or "1y" into a Duration. A bare number is interpreted as seconds.
verify_token
Verifies an HS256 JWT against secret and returns its claims.

Type Aliases§

QualityStats
A loosely-typed quality-of-service statistics payload.
ResourceLinks
HATEOAS-style links returned on many resources.
Result
A convenience alias for a Result whose error is the SDK’s Error.