From 3a35451644450991f37edf14ca9e473bdbefe996 Mon Sep 17 00:00:00 2001 From: Matthew Jorgensen Date: Fri, 4 Oct 2024 11:43:52 -0500 Subject: [PATCH 1/5] Consolidate projects into LinkAce.NET --- LinkAce.sln | 9 +-------- .../ApiResponses}/SearchLinkResponse.cs | 4 ++-- src/{LinkAce => LinkAce.NET}/Entites/Link.cs | 2 +- .../LinkAce.NET.csproj} | 8 ++------ .../LinkAceClient.cs | 6 +++--- src/{LinkAce.Api => LinkAce.NET}/Meta.cs | 2 +- src/LinkAce/LinkAce.csproj | 19 ------------------- src/TestApp/Program.cs | 2 +- src/TestApp/TestApp.csproj | 2 +- 9 files changed, 12 insertions(+), 42 deletions(-) rename src/{LinkAce.Api/Responses => LinkAce.NET/ApiResponses}/SearchLinkResponse.cs (89%) rename src/{LinkAce => LinkAce.NET}/Entites/Link.cs (94%) rename src/{LinkAce.Api/LinkAce.Api.csproj => LinkAce.NET/LinkAce.NET.csproj} (80%) rename src/{LinkAce.Api => LinkAce.NET}/LinkAceClient.cs (95%) rename src/{LinkAce.Api => LinkAce.NET}/Meta.cs (93%) delete mode 100644 src/LinkAce/LinkAce.csproj diff --git a/LinkAce.sln b/LinkAce.sln index a1c88fe..8c2681b 100644 --- a/LinkAce.sln +++ b/LinkAce.sln @@ -1,7 +1,5 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinkAce", "src\LinkAce\LinkAce.csproj", "{AC6F279B-A91D-49FB-BB47-79A3B4E289E4}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{22C844A6-ACCE-4473-9C7B-D53D613DA802}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{66EB4E20-E8C9-43B5-9B51-B3BB962AEEF2}" @@ -17,7 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CI Workflows", "CI Workflow .github\workflows\dotnet.yml = .github\workflows\dotnet.yml EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinkAce.Api", "src\LinkAce.Api\LinkAce.Api.csproj", "{6C83B6FB-E141-46BA-A446-8346BB11A7E3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinkAce.NET", "src\LinkAce.NET\LinkAce.NET.csproj", "{6C83B6FB-E141-46BA-A446-8346BB11A7E3}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "src\TestApp\TestApp.csproj", "{97052387-BAA1-40E8-A861-C412B373FBDC}" EndProject @@ -27,10 +25,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {AC6F279B-A91D-49FB-BB47-79A3B4E289E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AC6F279B-A91D-49FB-BB47-79A3B4E289E4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AC6F279B-A91D-49FB-BB47-79A3B4E289E4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AC6F279B-A91D-49FB-BB47-79A3B4E289E4}.Release|Any CPU.Build.0 = Release|Any CPU {6C83B6FB-E141-46BA-A446-8346BB11A7E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6C83B6FB-E141-46BA-A446-8346BB11A7E3}.Debug|Any CPU.Build.0 = Debug|Any CPU {6C83B6FB-E141-46BA-A446-8346BB11A7E3}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -42,7 +36,6 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {7E05B1B4-5625-4A84-A2B2-4D66C8059904} = {E1115509-DC42-44D8-A031-A207EF90073F} - {AC6F279B-A91D-49FB-BB47-79A3B4E289E4} = {22C844A6-ACCE-4473-9C7B-D53D613DA802} {6C83B6FB-E141-46BA-A446-8346BB11A7E3} = {22C844A6-ACCE-4473-9C7B-D53D613DA802} {97052387-BAA1-40E8-A861-C412B373FBDC} = {22C844A6-ACCE-4473-9C7B-D53D613DA802} EndGlobalSection diff --git a/src/LinkAce.Api/Responses/SearchLinkResponse.cs b/src/LinkAce.NET/ApiResponses/SearchLinkResponse.cs similarity index 89% rename from src/LinkAce.Api/Responses/SearchLinkResponse.cs rename to src/LinkAce.NET/ApiResponses/SearchLinkResponse.cs index b12c2d1..83d1d4a 100644 --- a/src/LinkAce.Api/Responses/SearchLinkResponse.cs +++ b/src/LinkAce.NET/ApiResponses/SearchLinkResponse.cs @@ -1,6 +1,6 @@ -using LinkAce.Entites; +using LinkAce.NET.Entites; -namespace LinkAce.Api.Responses; +namespace LinkAce.NET.ApiResponses; public class SearchLinkResponse { diff --git a/src/LinkAce/Entites/Link.cs b/src/LinkAce.NET/Entites/Link.cs similarity index 94% rename from src/LinkAce/Entites/Link.cs rename to src/LinkAce.NET/Entites/Link.cs index c188049..64430f8 100644 --- a/src/LinkAce/Entites/Link.cs +++ b/src/LinkAce.NET/Entites/Link.cs @@ -1,4 +1,4 @@ -namespace LinkAce.Entites; +namespace LinkAce.NET.Entites; public class Link { diff --git a/src/LinkAce.Api/LinkAce.Api.csproj b/src/LinkAce.NET/LinkAce.NET.csproj similarity index 80% rename from src/LinkAce.Api/LinkAce.Api.csproj rename to src/LinkAce.NET/LinkAce.NET.csproj index a561714..bca02c3 100644 --- a/src/LinkAce.Api/LinkAce.Api.csproj +++ b/src/LinkAce.NET/LinkAce.NET.csproj @@ -1,11 +1,11 @@ - net7.0 + net7.0;net8.0 enable enable 0.0.3 - LinkAce.Api + LinkAce.NET prplecake https://github.com/prplecake/LinkAce.NET https://github.com/prplecake/LinkAce.NET/blob/master/LICENSE @@ -16,10 +16,6 @@ none - - - - diff --git a/src/LinkAce.Api/LinkAceClient.cs b/src/LinkAce.NET/LinkAceClient.cs similarity index 95% rename from src/LinkAce.Api/LinkAceClient.cs rename to src/LinkAce.NET/LinkAceClient.cs index f560c18..20055ce 100644 --- a/src/LinkAce.Api/LinkAceClient.cs +++ b/src/LinkAce.NET/LinkAceClient.cs @@ -2,11 +2,11 @@ using System.Net.Mime; using System.Text; using System.Web; -using LinkAce.Api.Responses; -using LinkAce.Entites; +using LinkAce.NET.ApiResponses; +using LinkAce.NET.Entites; using Newtonsoft.Json; -namespace LinkAce.Api; +namespace LinkAce.NET; public class LinkAceClient { diff --git a/src/LinkAce.Api/Meta.cs b/src/LinkAce.NET/Meta.cs similarity index 93% rename from src/LinkAce.Api/Meta.cs rename to src/LinkAce.NET/Meta.cs index 2b49e40..df8c9ca 100644 --- a/src/LinkAce.Api/Meta.cs +++ b/src/LinkAce.NET/Meta.cs @@ -1,7 +1,7 @@ using System.Net.Http.Headers; using System.Reflection; -namespace LinkAce.Api; +namespace LinkAce.NET; public class Meta { diff --git a/src/LinkAce/LinkAce.csproj b/src/LinkAce/LinkAce.csproj deleted file mode 100644 index 074c6aa..0000000 --- a/src/LinkAce/LinkAce.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - net7.0 - enable - enable - 0.0.4 - LinkAce - https://github.com/prplecake/LinkAce.NET - https://github.com/prplecake/LinkAce.NET/blob/master/LICENSE - https://github.com/prplecake/LinkAce.NET - git - - - - none - - - diff --git a/src/TestApp/Program.cs b/src/TestApp/Program.cs index 6a5fecf..bd9ef1a 100644 --- a/src/TestApp/Program.cs +++ b/src/TestApp/Program.cs @@ -1,4 +1,4 @@ -using LinkAce.Api; +using LinkAce.NET; using Microsoft.Extensions.Configuration; Console.WriteLine("Hello, World!"); diff --git a/src/TestApp/TestApp.csproj b/src/TestApp/TestApp.csproj index 15888db..fbf65d6 100644 --- a/src/TestApp/TestApp.csproj +++ b/src/TestApp/TestApp.csproj @@ -20,7 +20,7 @@ - + From 0e2a48787e295739fe825e09859cc5472f58345f Mon Sep 17 00:00:00 2001 From: Matthew Jorgensen Date: Fri, 4 Oct 2024 11:46:49 -0500 Subject: [PATCH 2/5] Update package metadata --- src/LinkAce.NET/LinkAce.NET.csproj | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/LinkAce.NET/LinkAce.NET.csproj b/src/LinkAce.NET/LinkAce.NET.csproj index bca02c3..6e54ae8 100644 --- a/src/LinkAce.NET/LinkAce.NET.csproj +++ b/src/LinkAce.NET/LinkAce.NET.csproj @@ -8,16 +8,24 @@ LinkAce.NET prplecake https://github.com/prplecake/LinkAce.NET - https://github.com/prplecake/LinkAce.NET/blob/master/LICENSE https://github.com/prplecake/LinkAce.NET + A C# library for interacting with the LinkAce API. + LICENSE + README.md + api, LinkAce, LinkAceAPI, C#, bookmarks, bookmarking - none + embedded + + + + + From 34b12f56fa33b0af76ff15f199e268ad86811d4c Mon Sep 17 00:00:00 2001 From: Matthew Jorgensen Date: Fri, 4 Oct 2024 11:48:03 -0500 Subject: [PATCH 3/5] Generate documentation --- src/LinkAce.NET/LinkAce.NET.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/LinkAce.NET/LinkAce.NET.csproj b/src/LinkAce.NET/LinkAce.NET.csproj index 6e54ae8..8535f51 100644 --- a/src/LinkAce.NET/LinkAce.NET.csproj +++ b/src/LinkAce.NET/LinkAce.NET.csproj @@ -13,6 +13,7 @@ LICENSE README.md api, LinkAce, LinkAceAPI, C#, bookmarks, bookmarking + true From dad819f4edfc71cf5751054b2a481b16b6a42306 Mon Sep 17 00:00:00 2001 From: Matthew Jorgensen Date: Fri, 4 Oct 2024 11:54:02 -0500 Subject: [PATCH 4/5] Add documentation --- .../ApiResponses/SearchLinkResponse.cs | 41 ++++++++++++++++ src/LinkAce.NET/Entites/Link.cs | 47 ++++++++++++++++++- src/LinkAce.NET/LinkAce.NET.csproj | 1 + src/LinkAce.NET/LinkAceClient.cs | 31 ++++++++++++ src/LinkAce.NET/Meta.cs | 13 +++-- 5 files changed, 128 insertions(+), 5 deletions(-) diff --git a/src/LinkAce.NET/ApiResponses/SearchLinkResponse.cs b/src/LinkAce.NET/ApiResponses/SearchLinkResponse.cs index 83d1d4a..db5b108 100644 --- a/src/LinkAce.NET/ApiResponses/SearchLinkResponse.cs +++ b/src/LinkAce.NET/ApiResponses/SearchLinkResponse.cs @@ -1,19 +1,60 @@ +using JetBrains.Annotations; using LinkAce.NET.Entites; namespace LinkAce.NET.ApiResponses; +/// +/// Represents the response from a search query for links. +/// +[PublicAPI] public class SearchLinkResponse { + /// + /// Gets or sets the current page number. + /// public int CurrentPage { get; set; } + /// + /// Gets or sets the list of links returned by the search. + /// public List? Data { get; set; } + /// + /// Gets or sets the URL of the first page. + /// public string? FirstPageUrl { get; set; } + /// + /// Gets or sets the starting record number on the current page. + /// public int? From { get; set; } + /// + /// Gets or sets the last page number. + /// public int LastPage { get; set; } + /// + /// Gets or sets the URL of the last page. + /// public string? LastPageUrl { get; set; } + /// + /// Gets or sets the URL of the next page. + /// public string? NextPageUrl { get; set; } + /// + /// Gets or sets the path of the search query. + /// public string Path { get; set; } + /// + /// Gets or sets the number of records per page. + /// public string PerPage { get; set; } + /// + /// Gets or sets the URL of the previous page. + /// public string? PreviousPageUrl { get; set; } + /// + /// Gets or sets the ending record number on the current page. + /// public int? To { get; set; } + /// + /// Gets or sets the total number of records found. + /// public int Total { get; set; } } diff --git a/src/LinkAce.NET/Entites/Link.cs b/src/LinkAce.NET/Entites/Link.cs index 64430f8..25c7aaf 100644 --- a/src/LinkAce.NET/Entites/Link.cs +++ b/src/LinkAce.NET/Entites/Link.cs @@ -1,18 +1,63 @@ +using JetBrains.Annotations; + namespace LinkAce.NET.Entites; +/// +/// Represents a link entity with various properties such as URL, title, description, and status. +/// +[PublicAPI] public class Link { + /// + /// Gets or sets a value indicating whether the link check is disabled. + /// public bool CheckDisabled { get; set; } + /// + /// Gets or sets the date and time when the link was created. + /// public DateTime CreatedAt { get; set; } + /// + /// Gets or sets the date and time when the link was deleted, if applicable. + /// public DateTime? DeletedAt { get; set; } + /// + /// Gets or sets the description of the link. + /// public string? Description { get; set; } + /// + /// Gets or sets the icon associated with the link. + /// public string? Icon { get; set; } + /// + /// Gets or sets the unique identifier for the link. + /// public int Id { get; set; } + /// + /// Gets or sets a value indicating whether the link is private. + /// public bool IsPrivate { get; set; } + /// + /// Gets or sets the status of the link. + /// public int Status { get; set; } + /// + /// Gets or sets the tags associated with the link. + /// + public string[]? Tags { get; set; } + /// + /// Gets or sets the title of the link. + /// public string? Title { get; set; } + /// + /// Gets or sets the date and time when the link was last updated. + /// public DateTime UpdatedAt { get; set; } + /// + /// Gets or sets the URL of the link. + /// public string Url { get; set; } + /// + /// Gets or sets the user identifier associated with the link. + /// public int UserId { get; set; } - public string[]? Tags { get; set; } } diff --git a/src/LinkAce.NET/LinkAce.NET.csproj b/src/LinkAce.NET/LinkAce.NET.csproj index 8535f51..04425cc 100644 --- a/src/LinkAce.NET/LinkAce.NET.csproj +++ b/src/LinkAce.NET/LinkAce.NET.csproj @@ -21,6 +21,7 @@ + diff --git a/src/LinkAce.NET/LinkAceClient.cs b/src/LinkAce.NET/LinkAceClient.cs index 20055ce..cbf222d 100644 --- a/src/LinkAce.NET/LinkAceClient.cs +++ b/src/LinkAce.NET/LinkAceClient.cs @@ -2,21 +2,36 @@ using System.Net.Mime; using System.Text; using System.Web; +using JetBrains.Annotations; using LinkAce.NET.ApiResponses; using LinkAce.NET.Entites; using Newtonsoft.Json; namespace LinkAce.NET; +/// +/// Client for interacting with the LinkAce.NET API. +/// +[PublicAPI] public class LinkAceClient { private static string? _apiUrl; private static HttpClient _client = new(); + /// + /// Initializes a new instance of the class with the specified URL and HTTP client. + /// + /// The base URL of the LinkAce.NET instance. + /// The HTTP client to use for requests. public LinkAceClient(string linkAceUrl, HttpClient httpClient) { _apiUrl = $"{linkAceUrl}/api/v1"; _client = httpClient; } + /// + /// Initializes a new instance of the class with the specified URL and API token. + /// + /// The base URL of the LinkAce.NET instance. + /// The API token for authentication. public LinkAceClient(string linkAceUrl, string apiToken) { _apiUrl = $"{linkAceUrl}/api/v1"; @@ -25,6 +40,11 @@ public LinkAceClient(string linkAceUrl, string apiToken) _client.DefaultRequestHeaders.UserAgent.Add(Meta.UserAgent); _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiToken); } + /// + /// Creates a new link. + /// + /// The link to create. + /// The HTTP response message. public async Task CreateLink(Link link) { var response = await _client.PostAsync($"{_apiUrl}/links", @@ -32,6 +52,11 @@ public LinkAceClient(string linkAceUrl, string apiToken) MediaTypeNames.Application.Json)); return response; } + /// + /// Searches for links by URL. + /// + /// The URL to search for. + /// The search response containing the links. public async Task SearchLinksByUrl(string url) { var uriBuilder = new UriBuilder($"{_apiUrl}/search/links"); @@ -43,6 +68,12 @@ public LinkAceClient(string linkAceUrl, string apiToken) await response.Content.ReadAsStringAsync()); return obj; } + /// + /// Updates a link by its ID. + /// + /// The ID of the link to update. + /// The updated link data. + /// The HTTP response message. public async Task UpdateLinkById(int id, Link link) { var response = await _client.PatchAsync($"{_apiUrl}/links/{id}", diff --git a/src/LinkAce.NET/Meta.cs b/src/LinkAce.NET/Meta.cs index df8c9ca..b3cab01 100644 --- a/src/LinkAce.NET/Meta.cs +++ b/src/LinkAce.NET/Meta.cs @@ -3,10 +3,15 @@ namespace LinkAce.NET; -public class Meta +/// +/// Provides metadata information about the LinkAce.NET package. +/// +public static class Meta { - private const string - Name = "LinkAce.NET"; - public static readonly string AssemblyVersion = Assembly.GetEntryAssembly()!.GetName().Version!.ToString(); + private const string Name = "LinkAce.NET"; + private static readonly string AssemblyVersion = Assembly.GetEntryAssembly()!.GetName().Version!.ToString(); + /// + /// The user agent information for HTTP requests. + /// public static readonly ProductInfoHeaderValue UserAgent = new(Name, AssemblyVersion); } From 24f479ce8dedde2513e8d478dfd7174815cde57c Mon Sep 17 00:00:00 2001 From: Matthew Jorgensen Date: Fri, 4 Oct 2024 11:57:19 -0500 Subject: [PATCH 5/5] Add DotNet.ReproducibleBuilds package --- src/LinkAce.NET/LinkAce.NET.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/LinkAce.NET/LinkAce.NET.csproj b/src/LinkAce.NET/LinkAce.NET.csproj index 04425cc..684cde6 100644 --- a/src/LinkAce.NET/LinkAce.NET.csproj +++ b/src/LinkAce.NET/LinkAce.NET.csproj @@ -21,6 +21,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive +