public async Task Execute_DeleteChannelExecutableSuccessful_SendsCommandAndReturnsDeletedChannelId() { // arrange var server = SetupServer(out var executor, out var session); var exec = new DeleteChannel { ChannelName = "Test Channel 123" }; server.Response = "" + "TS3\r\n" + "Welcome to the TeamSpeak 3 ServerQuery interface.\r\n" + "cid=34\r\n" + "error id=0 msg=ok\r\n" + "error id=0 msg=ok\r\n"; // act var channelId = await executor.Schedule(exec); executor.Stop(); await session; // assert Assert.Equal("34", channelId); Assert.Equal("" + "channelfind pattern=Test\\sChannel\\s123\n" + "channeldelete cid=34 force=1\n" + "", server.Receive); }
public async void OnGameDestroyed(IGameDestroyedEvent evt) { var code = evt.Game.Code; logger.LogInformation($"[{code}] Game destroyed, deleting voice channel."); var delete = new DeleteChannel { ChannelName = $"Impostor {code}" }; var id = await executor.Schedule(delete); logger.LogInformation($"[{code}] Voice channel deleted: id={id}"); }
/// <summary> /// /// </summary> /// <exception cref="ErsatzTV.Api.Sdk.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="deleteChannel"></param> /// <param name="cancellationToken">Cancellation Token to cancel the request.</param> /// <returns>Task of ApiResponse</returns> public async System.Threading.Tasks.Task <ErsatzTV.Api.Sdk.Client.ApiResponse <Object> > ApiChannelsDeleteWithHttpInfoAsync(DeleteChannel deleteChannel, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // verify the required parameter 'deleteChannel' is set if (deleteChannel == null) { throw new ErsatzTV.Api.Sdk.Client.ApiException(400, "Missing required parameter 'deleteChannel' when calling ChannelsApi->ApiChannelsDelete"); } ErsatzTV.Api.Sdk.Client.RequestOptions localVarRequestOptions = new ErsatzTV.Api.Sdk.Client.RequestOptions(); String[] _contentTypes = new String[] { "application/json-patch+json", "application/json", "text/json", "application/_*+json" }; // to determine the Accept header String[] _accepts = new String[] { "application/json" }; var localVarContentType = ErsatzTV.Api.Sdk.Client.ClientUtils.SelectHeaderContentType(_contentTypes); if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); } var localVarAccept = ErsatzTV.Api.Sdk.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) { localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); } localVarRequestOptions.Data = deleteChannel; // make the HTTP request var localVarResponse = await this.AsynchronousClient.DeleteAsync <Object>("/api/channels", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("ApiChannelsDelete", localVarResponse); if (_exception != null) { throw _exception; } } return(localVarResponse); }
/// <summary> /// /// </summary> /// <exception cref="ErsatzTV.Api.Sdk.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="deleteChannel"></param> /// <param name="cancellationToken">Cancellation Token to cancel the request.</param> /// <returns>Task of void</returns> public async System.Threading.Tasks.Task ApiChannelsDeleteAsync(DeleteChannel deleteChannel, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { await ApiChannelsDeleteWithHttpInfoAsync(deleteChannel, cancellationToken).ConfigureAwait(false); }
/// <summary> /// /// </summary> /// <exception cref="ErsatzTV.Api.Sdk.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="deleteChannel"></param> /// <returns></returns> public void ApiChannelsDelete(DeleteChannel deleteChannel) { ApiChannelsDeleteWithHttpInfo(deleteChannel); }