Closed micah686 closed 6 years ago
The Update/2017-08-14 branch should add all 3 new features... Well 2 new features, since the current branch technically already supports everything except for the uid on the models, while the vn filter (Which could be implemented by the user via implementing the IFilter
interface, or extending the Abstractfilter
class) but has been added to the core library anyways.
Lemme know if it works so i can merge it into master.
So, using this code:
using (Vndb client= new Vndb(Username, Password))
{
var data = await client.GetVoteListAsync(VndbFilters.UserId.Equals(_userId) | VndbFilters.VisualNovelId.Equals(4));
if (data == null)
{
HandleError.HandleErrors(client.GetLastError());
}
}
I keep getting:
Get Response | error {"field":"vid","value":4,"msg":"Unknown field 'vid'","op":"=","id":"filter"}
{"field":"vid","value":4,"msg":"Unknown field 'vid'","op":"=","id":"filter"}
A InvalidFilter Error occured, the filter combination of "vid", "=", "4" is not a valid combination.
Message: Unknown field 'vid'
You want to use &
(and), not |
(or). You can also alternatively use the IFilter And(IFilter, IFilter)
extension method.
You shouldn't be disposing the Vndb
instance until you no longer need it at all.
And i'm not entirely sure whats wrong there, the recent changes to the documentation have been fairly inconsistent, the filter name listed under 5.7 is vid
while it's listed as vn
under the change log... :s
Even when using the right filters:
var data = await client.GetVoteListAsync( VndbFilters.UserId.Equals(_userId)& VndbFilters.VisualNovelId.Equals(4));
I still get
Get Response | error {"field":"vid","op":"=","msg":"Unknown field 'vid'","value":4,"id":"filter"}
{"field":"vid","op":"=","msg":"Unknown field 'vid'","value":4,"id":"filter"}
Same error, it's not any different for some reason it doesn't understand the vid filter. I'll fiddle with it when i'm no longer busy unless you want to do it.
It seems like due to a "possible(?)" mistake in the API, the 'vid' filter is really 'vn'.
Try it replacing protected override String FilterName { get; } = "vid";
with protected override String FilterName { get; } = "vn";
.
I asked this question on the forums, so it would probably be best not to make changes regarding this behavior until we get a proper response.
Fixed with #40. This also fixes the last issue I had with the Update/2017-08-14 branch, so go ahead and merge it into master once you accept the pull request.
Yorhel added some new features to the API: 2017-08-14