コード例 #1
0
        public void Test_GetLibraryInfo_Success()
        {
            var request = new GetLibraryInfoRequest(FakeToken, FakeRepoId);

            var message = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(
                    @"{
                    ""encrypted"": false,
                    ""password_need"": null,
                    ""mtime"": null,
                    ""owner"": ""self"",
                    ""id"": ""632ab8a8-ecf9-4435-93bf-f495d5bfe975"",
                    ""size"": 1356155,
                    ""name"": ""org"",
                    ""root"": ""b5227040de360dd22c5717f9563628fe5510cbce"",
                    ""desc"": ""org file"",
                    ""type"": ""repo""
                }")
            };

            Assert.IsTrue(request.WasSuccessful(message));
            var library = ExecuteSync(() => request.ParseResponseAsync(message));

            Assert.AreEqual("632ab8a8-ecf9-4435-93bf-f495d5bfe975", library.Id);
            Assert.AreEqual(null, library.Timestamp);
        }
コード例 #2
0
        /// <summary>
        ///     Retrieve information for the library with the given id
        /// </summary>
        public async Task <SeafLibrary> GetLibraryInfo(string libraryId)
        {
            var request = new GetLibraryInfoRequest(AuthToken, libraryId);

            return(await _webConnection.SendRequestAsync(ServerUri, request));
        }