-
Notifications
You must be signed in to change notification settings - Fork 4
Gorse.NET fixes and package updates #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
IbrahimHabibeh
wants to merge
14
commits into
gorse-io:main
Choose a base branch
from
IbrahimHabibeh:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6643bf3
naming and type consistency with RESTful API, differentiated namespac…
IbrahimHabibeh 7689089
pull upstream changes
IbrahimHabibeh bb06a5f
Update type usage
IbrahimHabibeh 4351c16
updated to .NET 10
IbrahimHabibeh c8df207
Package Update - RestSharp
IbrahimHabibeh 621632c
overwrite support for feedbacks
IbrahimHabibeh 46a6592
undo gorse class rename
IbrahimHabibeh d4e1e05
.NET 10 update
IbrahimHabibeh 8e8ee96
remove nullability for parameter n
IbrahimHabibeh 088ccf7
update version to match tested Gorse version
IbrahimHabibeh ae840bf
Update insert methods to use IEnumerable<T> as input
IbrahimHabibeh dfc0407
.NET 10 and package updates for testing
IbrahimHabibeh b27dd8f
Update XML docs for consistency
IbrahimHabibeh 54e9d86
Add item-to-item recommender endpoint
IbrahimHabibeh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,46 @@ | ||
|
|
||
|
|
||
| using Gorse.NET.Models; | ||
| using RestSharp; | ||
|
|
||
| namespace Gorse.NET; | ||
|
|
||
| public partial class Gorse | ||
| { | ||
| public Result InsertFeedback(Feedback[] feedbacks) | ||
| /// <summary> | ||
| /// Insert feedback. Duplicate feedback will have their values summed. | ||
| /// Use <see cref="UpsertFeedback(IEnumerable{Feedback})"/> for overwrite semantics. | ||
| /// </summary> | ||
| public Result InsertFeedback(IEnumerable<Feedback> feedbacks) | ||
| { | ||
| return _client.Request<Result, IEnumerable<Feedback>>(Method.Post, "api/feedback", feedbacks)!; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Insert feedback. Duplicate feedback will have their values summed. | ||
| /// Use <see cref="UpsertFeedbackAsync(IEnumerable{Feedback})"/> for overwrite semantics. | ||
| /// </summary> | ||
| public Task<Result> InsertFeedbackAsync(IEnumerable<Feedback> feedbacks) | ||
| { | ||
| return _client.RequestAsync<Result, IEnumerable<Feedback>>(Method.Post, "api/feedback", feedbacks)!; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Upsert feedback. Duplicate feedback will be overwritten (not summed). | ||
| /// Use <see cref="InsertFeedback(IEnumerable{Feedback})"/> for additive/sum semantics. | ||
| /// </summary> | ||
|
Comment on lines
+28
to
+31
|
||
| public Result UpsertFeedback(IEnumerable<Feedback> feedbacks) | ||
| { | ||
| return _client.Request<Result, Feedback[]>(Method.Post, "api/feedback", feedbacks)!; | ||
| return _client.Request<Result, IEnumerable<Feedback>>(Method.Put, "api/feedback", feedbacks)!; | ||
| } | ||
|
|
||
| public Task<Result> InsertFeedbackAsync(Feedback[] feedbacks) | ||
| /// <summary> | ||
| /// Upsert feedback. Duplicate feedback will be overwritten (not summed). | ||
| /// Use <see cref="InsertFeedbackAsync(IEnumerable{Feedback})"/> for additive/sum semantics. | ||
| /// </summary> | ||
| public Task<Result> UpsertFeedbackAsync(IEnumerable<Feedback> feedbacks) | ||
| { | ||
| return _client.RequestAsync<Result, Feedback[]>(Method.Post, "api/feedback", feedbacks)!; | ||
| return _client.RequestAsync<Result, IEnumerable<Feedback>>(Method.Put, "api/feedback", feedbacks)!; | ||
| } | ||
|
|
||
| public FeedbacksResponse GetFeedbacks(int n = 10, string cursor = "") | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,37 @@ | ||
| using Gorse.NET.Models; | ||
| using RestSharp; | ||
|
|
||
| namespace Gorse.NET; | ||
|
|
||
| public partial class Gorse | ||
| { | ||
| public string[]? GetRecommend(string userId) | ||
| { | ||
| return _client.Request<string[], Object>(Method.Get, "api/recommend/" + userId, null); | ||
| } | ||
|
|
||
| public Task<string[]?> GetRecommendAsync(string userId) | ||
| { | ||
| return _client.RequestAsync<string[], Object>(Method.Get, "api/recommend/" + userId, null); | ||
| } | ||
|
|
||
| public List<UserScore> GetUserNeighbors(string userId, int n = 100, int offset = 0) | ||
| { | ||
| return _client.Request<List<UserScore>, object>(Method.Get, $"api/user/{userId}/neighbors?n={n}&offset={offset}", null)!; | ||
| } | ||
|
|
||
| public Task<List<UserScore>> GetUserNeighborsAsync(string userId, int n = 100, int offset = 0) | ||
| { | ||
| return _client.RequestAsync<List<UserScore>, object>(Method.Get, $"api/user/{userId}/neighbors?n={n}&offset={offset}", null)!; | ||
| } | ||
| using Gorse.NET.Models; | ||
| using RestSharp; | ||
|
|
||
| namespace Gorse.NET; | ||
|
|
||
| public partial class Gorse | ||
| { | ||
| public string[]? GetRecommend(string userId, int n = 10) | ||
| { | ||
| return _client.Request<string[], Object>(Method.Get, $"api/recommend/{userId}?n={n}", null); | ||
| } | ||
|
|
||
| public Task<string[]?> GetRecommendAsync(string userId, int n = 10) | ||
| { | ||
| return _client.RequestAsync<string[], Object>(Method.Get, $"api/recommend/{userId}?n={n}", null); | ||
| } | ||
|
|
||
| public List<UserScore> GetUserNeighbors(string userId, int n = 100, int offset = 0) | ||
| { | ||
| return _client.Request<List<UserScore>, object>(Method.Get, $"api/user/{userId}/neighbors?n={n}&offset={offset}", null)!; | ||
| } | ||
|
|
||
| public Task<List<UserScore>> GetUserNeighborsAsync(string userId, int n = 100, int offset = 0) | ||
| { | ||
| return _client.RequestAsync<List<UserScore>, object>(Method.Get, $"api/user/{userId}/neighbors?n={n}&offset={offset}", null)!; | ||
| } | ||
|
|
||
| public Task<List<UserScore>> GetItemNeighborsAsync(string itemId, int n = 12, int offset = 0, string recommender = "neighbors") | ||
| { | ||
| return _client.RequestAsync<List<UserScore>, object>(Method.Get, $"api/item-to-item/{recommender}/{itemId}?n={n}&offset={offset}", null)!; | ||
| } | ||
|
|
||
| public Task<List<UserScore>> GetRecommendLatestAsync(int n = 10) | ||
| { | ||
| return _client.RequestAsync<List<UserScore>, object>(Method.Get, $"api/latest?n={n}", null)!; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,19 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <TargetFramework>net8.0</TargetFramework> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
| <PackageId>Gorse.NET</PackageId> | ||
| <Version>0.5.0</Version> | ||
| <Authors>zhenghaoz</Authors> | ||
| <Company>gorse.io</Company> | ||
| <PackageReadmeFile>README.md</PackageReadmeFile> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <None Remove="RestSharp" /> | ||
| <None Include="..\README.md" Pack="true" PackagePath="\" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <PackageReference Include="RestSharp" Version="113.0.0" /> | ||
| </ItemGroup> | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
| <PackageId>Gorse.NET</PackageId> | ||
| <Version>0.5.3</Version> | ||
| <Authors>zhenghaoz</Authors> | ||
| <Company>gorse.io</Company> | ||
| <PackageReadmeFile>README.md</PackageReadmeFile> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <None Remove="RestSharp" /> | ||
| <None Include="..\README.md" Pack="true" PackagePath="\" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <PackageReference Include="RestSharp" Version="113.1.0" /> | ||
| </ItemGroup> | ||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These XML docs are on the synchronous
InsertFeedbackmethod but referenceUpsertFeedbackAsync. This is misleading for callers; the docs should reference the synchronous alternative (UpsertFeedback) or mention both sync/async options consistently.