/// <summary> /// Return the current user's default library /// </summary> /// <returns>The user's default library or null if no default library exists</returns> public async Task <SeafLibrary> GetDefaultLibrary() { var request = new GetDefaultLibraryRequest(AuthToken); var result = await _webConnection.SendRequestAsync(ServerUri, request); if (!result.Exists) { return(null); } return(await GetLibraryInfo(result.LibraryId)); }
public void Test_GetDefaultLibrary_Success() { var request = new GetDefaultLibraryRequest(FakeToken); var message = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent( @"{ ""repo_id"": ""691b3e24-d05e-43cd-a9f2-6f32bd6b800e"", ""exists"": true }") }; Assert.IsTrue(request.WasSuccessful(message)); var result = ExecuteSync(() => request.ParseResponseAsync(message)); Assert.IsTrue(result.Exists); Assert.AreEqual("691b3e24-d05e-43cd-a9f2-6f32bd6b800e", result.LibraryId); }