/// <summary> /// Send test notification. /// </summary> /// <param name="request">Request to send.</param> /// <returns>A <see cref="Task"/>.</returns> public async Task PostAsync(TestNotification request) { var options = GetOptions(request.UserId !); var parameters = new Dictionary <string, string> { { "type", "note" }, { "title", "Test Notification" }, { "body", "This is a test notification from Jellyfin" } }; var requestOptions = new HttpRequestOptions { Url = PluginConfiguration.Url, RequestContent = _jsonSerializer.SerializeToString(parameters), RequestContentType = "application/json", LogErrorResponseBody = true, RequestHeaders = { ["Access-Token"] = options.Token } }; await _httpClient.Post(requestOptions).ConfigureAwait(false); }
/// <summary> /// Send test notification. /// </summary> /// <param name="request">Request to send.</param> public void Post(TestNotification request) { PostAsync(request) .GetAwaiter() .GetResult(); }
public void Post(TestNotification request) { var task = PostAsync(request); Task.WaitAll(task); }