< Summary

Information
Class: LiveKit.Rtc.Transcription
Assembly: LivekitRtc
File(s): /home/runner/work/livekit-server-sdk-dotnet/livekit-server-sdk-dotnet/LivekitRtc/Transcription.cs
Line coverage
61%
Covered lines: 11
Uncovered lines: 7
Coverable lines: 18
Total lines: 62
Line coverage: 61.1%
Branch coverage
50%
Covered branches: 3
Total branches: 6
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)50%66100%
FromProto(...)100%210%

File(s)

/home/runner/work/livekit-server-sdk-dotnet/livekit-server-sdk-dotnet/LivekitRtc/Transcription.cs

#LineLine coverage
 1// author: https://github.com/pabloFuente
 2
 3using System;
 4using System.Collections.Generic;
 5
 6namespace LiveKit.Rtc
 7{
 8    /// <summary>
 9    /// Represents a transcription with multiple segments.
 10    /// </summary>
 11    public class Transcription
 12    {
 13        /// <summary>
 14        /// Gets the participant identity.
 15        /// </summary>
 16        public string ParticipantIdentity { get; }
 17
 18        /// <summary>
 19        /// Gets the track SID.
 20        /// </summary>
 21        public string TrackSid { get; }
 22
 23        /// <summary>
 24        /// Gets the transcription segments.
 25        /// </summary>
 26        public IReadOnlyList<Proto.TranscriptionSegment> Segments { get; }
 27
 28        /// <summary>
 29        /// Initializes a new transcription.
 30        /// </summary>
 31        /// <param name="participantIdentity">The participant identity.</param>
 32        /// <param name="trackSid">The track SID.</param>
 33        /// <param name="segments">The transcription segments.</param>
 134        public Transcription(
 135            string participantIdentity,
 136            string trackSid,
 137            IReadOnlyList<Proto.TranscriptionSegment> segments
 138        )
 139        {
 140            ParticipantIdentity =
 141                participantIdentity ?? throw new ArgumentNullException(nameof(participantIdentity));
 142            TrackSid = trackSid ?? throw new ArgumentNullException(nameof(trackSid));
 143            Segments = segments ?? throw new ArgumentNullException(nameof(segments));
 144        }
 45
 46        /// <summary>
 47        /// Creates a transcription from proto messages.
 48        /// </summary>
 49        internal static Transcription FromProto(
 50            string participantIdentity,
 51            string trackSid,
 52            Google.Protobuf.Collections.RepeatedField<Proto.TranscriptionSegment> segments
 53        )
 054        {
 055            return new Transcription(
 056                participantIdentity,
 057                trackSid,
 058                new List<Proto.TranscriptionSegment>(segments)
 059            );
 060        }
 61    }
 62}