public Task <Either <BaseError, ChannelViewModel> > Handle( CreateChannel request, CancellationToken cancellationToken) => Validate(request) .MapT(PersistChannel) .Bind(v => v.ToEitherAsync());
/// <summary> /// /// </summary> /// <exception cref="ErsatzTV.Api.Sdk.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="createChannel"></param> /// <returns>ChannelViewModel</returns> public ChannelViewModel ApiChannelsPost(CreateChannel createChannel) { ErsatzTV.Api.Sdk.Client.ApiResponse <ChannelViewModel> localVarResponse = ApiChannelsPostWithHttpInfo(createChannel); return(localVarResponse.Data); }
/// <summary> /// /// </summary> /// <exception cref="ErsatzTV.Api.Sdk.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="createChannel"></param> /// <returns>ApiResponse of ChannelViewModel</returns> public ErsatzTV.Api.Sdk.Client.ApiResponse <ChannelViewModel> ApiChannelsPostWithHttpInfo(CreateChannel createChannel) { // verify the required parameter 'createChannel' is set if (createChannel == null) { throw new ErsatzTV.Api.Sdk.Client.ApiException(400, "Missing required parameter 'createChannel' when calling ChannelsApi->ApiChannelsPost"); } 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 = createChannel; // make the HTTP request var localVarResponse = this.Client.Post <ChannelViewModel>("/api/channels", localVarRequestOptions, this.Configuration); if (this.ExceptionFactory != null) { Exception _exception = this.ExceptionFactory("ApiChannelsPost", 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="createChannel"></param> /// <param name="cancellationToken">Cancellation Token to cancel the request.</param> /// <returns>Task of ChannelViewModel</returns> public async System.Threading.Tasks.Task <ChannelViewModel> ApiChannelsPostAsync(CreateChannel createChannel, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { ErsatzTV.Api.Sdk.Client.ApiResponse <ChannelViewModel> localVarResponse = await ApiChannelsPostWithHttpInfoAsync(createChannel, cancellationToken).ConfigureAwait(false); return(localVarResponse.Data); }