< Summary

Information
Class: Livekit.Server.Sdk.Dotnet.IngressServiceClient
Assembly: LivekitApi
File(s): /home/runner/work/livekit-server-sdk-dotnet/livekit-server-sdk-dotnet/LivekitApi/IngressServiceClient.cs
Line coverage
100%
Covered lines: 37
Uncovered lines: 0
Coverable lines: 37
Total lines: 91
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
CreateIngress()100%11100%
UpdateIngress()100%11100%
ListIngress()100%11100%
DeleteIngress()100%11100%

File(s)

/home/runner/work/livekit-server-sdk-dotnet/livekit-server-sdk-dotnet/LivekitApi/IngressServiceClient.cs

#LineLine coverage
 1using System.Net.Http;
 2using System.Threading.Tasks;
 3
 4namespace Livekit.Server.Sdk.Dotnet
 5{
 6    /// <summary>
 7    /// Client of the LiveKit Ingress service: brings RTMP, WHIP or URL media into rooms.
 8    /// See <see href="https://docs.livekit.io/transport/media/ingress-egress/ingress/">Ingress overview</see>.
 9    /// </summary>
 10    public class IngressServiceClient : BaseService
 11    {
 12        /// <summary>
 13        /// Creates the client.
 14        /// </summary>
 15        /// <param name="host">URL of the LiveKit server, <c>http(s)://</c> or <c>ws(s)://</c>; a subpath such as <c>htt
 16        /// <param name="apiKey">API key; the <c>LIVEKIT_API_KEY</c> environment variable when omitted.</param>
 17        /// <param name="apiSecret">API secret; the <c>LIVEKIT_API_SECRET</c> environment variable when omitted.</param>
 18        /// <param name="client">Optional <see cref="HttpClient"/> to send the requests with. The SDK never modifies it,
 19        public IngressServiceClient(
 20            string host,
 21            string apiKey = null,
 22            string apiSecret = null,
 23            HttpClient client = null
 24        )
 2425            : base(host, apiKey, apiSecret, client) { }
 26
 27        /// <summary>
 28        /// Creates a new ingress. Default audio and video options will be used if none is provided.
 29        /// </summary>
 30        /// <param name="request">Input type (RTMP, WHIP or URL), name, the room and participant to publish as, and the 
 31        /// <returns>The created ingress, including the URL and stream key to push media to.</returns>
 32        public async Task<IngressInfo> CreateIngress(CreateIngressRequest request)
 533        {
 534            return await SendAsync(
 535                    Twirp.Routes.Ingress.CreateIngress,
 536                    request,
 537                    IngressInfo.Parser,
 538                    AuthHeader(new VideoGrants { IngressAdmin = true })
 539                )
 540                .ConfigureAwait(false);
 541        }
 42
 43        /// <summary>
 44        /// Updates the existing ingress with the given ingressID. Only inactive ingress can be updated.
 45        /// </summary>
 46        /// <param name="request">Ingress ID and the fields to change.</param>
 47        /// <returns>The updated ingress.</returns>
 48        public async Task<IngressInfo> UpdateIngress(UpdateIngressRequest request)
 149        {
 150            return await SendAsync(
 151                    Twirp.Routes.Ingress.UpdateIngress,
 152                    request,
 153                    IngressInfo.Parser,
 154                    AuthHeader(new VideoGrants { IngressAdmin = true })
 155                )
 156                .ConfigureAwait(false);
 157        }
 58
 59        /// <summary>
 60        /// Lists the ingresses, optionally filtered by room or ingress ID.
 61        /// </summary>
 62        /// <param name="request">Optional filters: room name, ingress ID.</param>
 63        /// <returns>The matching ingresses.</returns>
 64        public async Task<ListIngressResponse> ListIngress(ListIngressRequest request)
 1465        {
 1466            return await SendAsync(
 1467                    Twirp.Routes.Ingress.ListIngress,
 1468                    request,
 1469                    ListIngressResponse.Parser,
 1470                    AuthHeader(new VideoGrants { IngressAdmin = true })
 1471                )
 1472                .ConfigureAwait(false);
 1473        }
 74
 75        /// <summary>
 76        /// Deletes an ingress.
 77        /// </summary>
 78        /// <param name="request">Ingress ID.</param>
 79        /// <returns>The deleted ingress.</returns>
 80        public async Task<IngressInfo> DeleteIngress(DeleteIngressRequest request)
 581        {
 582            return await SendAsync(
 583                    Twirp.Routes.Ingress.DeleteIngress,
 584                    request,
 585                    IngressInfo.Parser,
 586                    AuthHeader(new VideoGrants { IngressAdmin = true })
 587                )
 588                .ConfigureAwait(false);
 589        }
 90    }
 91}