Bandwidth.Standard/WebRtc/Controllers/APIController.cs
/// <summary>
/// Update a participant's subscriptions
/// This is a full update that will replace the participant's subscriptions. First call `getParticipantSubscriptions` if you need the current subscriptions. Call this function with no `Subscriptions` object to remove all subscriptions
/// </summary>
/// <param name="accountId">Required parameter: Account ID</param>
/// <param name="participantId">Required parameter: Participant ID</param>
/// <param name="sessionId">Required parameter: Session ID</param>
/// <param name="body">Optional parameter: Initial state</param>
/// <return>Returns the void response from the API call</return>
Update a participant's subscriptions
This is a full update that will replace the participant's subscriptions. First call `getParticipantSubscriptions` if you need the current subscriptions. Call this function with no `Subscriptions` object to remove all subscriptions
Update a participant ' s subscriptions This is a full update that will replace the participant ' s subscriptions . First call ` getParticipantSubscriptions ` if you need the current subscriptions . Call this function with no ` Subscriptions ` object to remove all subscriptions
public async Task UpdateParticipantSubscriptionsAsync(
                string accountId,
                string participantId,
                string sessionId,
                Models.Subscriptions body = null, CancellationToken cancellationToken = default)
        {
            string _baseUri = config.GetBaseUri(Server.WebRtcDefault);
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);
            _queryBuilder.Append("/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions");
            ApiHelper.AppendUrlWithTemplateParameters(_queryBuilder, new Dictionary<string, object>()
            {
                { "accountId", accountId },
                { "participantId", participantId },
                { "sessionId", sessionId }
            });
            var _headers = new Dictionary<string, string>()
            {
                { "user-agent", userAgent },
                { "content-type", "application/json; charset=utf-8" }
            };
            var _body = ApiHelper.JsonSerialize(body);
            HttpRequest _request = GetClientInstance().PutBody(_queryBuilder.ToString(), _headers, _body);
            _request = await authManagers["webRtc"].ApplyAsync(_request).ConfigureAwait(false);
            HttpStringResponse _response = await GetClientInstance().ExecuteAsStringAsync(_request, cancellationToken).ConfigureAwait(false);
            HttpContext _context = new HttpContext(_request, _response);
            if (_response.StatusCode == 400)
            {
                throw new ApiException("Bad Request", _context);
            }
            if (_response.StatusCode == 401)
            {
                throw new ApiException("Unauthorized", _context);
            }
            if (_response.StatusCode == 403)
            {
                throw new ApiException("Access Denied", _context);
            }
            if (_response.StatusCode == 404)
            {
                throw new ApiException("Not Found", _context);
            }
            if ((_response.StatusCode < 200) || (_response.StatusCode > 208)) 
            {
                throw new ErrorException("Unexpected Error", _context);
            }
            base.ValidateResponse(_response, _context);
        }
public async Task UpdateParticipantSubscriptionsAsync ( string accountId , string participantId , string sessionId , Models . Subscriptions body = null , CancellationToken cancellationToken = default ) { string _baseUri = config . GetBaseUri ( Server . WebRtcDefault ) ; StringBuilder _queryBuilder = new StringBuilder ( _baseUri ) ; _queryBuilder . Append ( " " ) ; ApiHelper . AppendUrlWithTemplateParameters ( _queryBuilder , new Dictionary < string , object > ( ) { { " " , accountId } , { " " , participantId } , { " " , sessionId } } ) ; var _headers = new Dictionary < string , string > ( ) { { " " , userAgent } , { " " , " " } } ; var _body = ApiHelper . JsonSerialize ( body ) ; HttpRequest _request = GetClientInstance ( ) . PutBody ( _queryBuilder . ToString ( ) , _headers , _body ) ; _request = await authManagers [ " " ] . ApplyAsync ( _request ) . ConfigureAwait ( false ) ; HttpStringResponse _response = await GetClientInstance ( ) . ExecuteAsStringAsync ( _request , cancellationToken ) . ConfigureAwait ( false ) ; HttpContext _context = new HttpContext ( _request , _response ) ; if ( _response . StatusCode == 400 ) { throw new ApiException ( " " , _context ) ; } if ( _response . StatusCode == 401 ) { throw new ApiException ( " " , _context ) ; } if ( _response . StatusCode == 403 ) { throw new ApiException ( " " , _context ) ; } if ( _response . StatusCode == 404 ) { throw new ApiException ( " " , _context ) ; } if ( ( _response . StatusCode < 200 ) || ( _response . StatusCode > 208 ) ) { throw new ErrorException ( " " , _context ) ; } base . ValidateResponse ( _response , _context ) ; }
Update a participant's subscriptions
This is a full update that will replace the participant's subscriptions.
Update a participant ' s subscriptions This is a full update that will replace the participant ' s subscriptions .
//the base uri for api requests //prepare query string for API call //process optional template parameters //append request with appropriate headers and parameters //append body params //prepare the API call request to fetch the response //invoke request and get response //Error handling using HTTP status codes //[200,208] = HTTP OK //handle errors defined at the API level
Returns the void response from the API call
Returns the void response from the API call
accountId
string
Required parameter: Account ID
Required parameter : Account ID
participantId
string
Required parameter: Participant ID
Required parameter : Participant ID
sessionId
string
Required parameter: Session ID
Required parameter : Session ID
body
Models.Subscriptions
Optional parameter: Initial state
Optional parameter : Initial state
cancellationToken
CancellationToken