Cardboard-Net / Cardboard.Net

a C# port of cardboard
MIT License
0 stars 3 forks source link

Fix get params #16

Open puppygirlhornypost opened 2 weeks ago

puppygirlhornypost commented 2 weeks ago

Description

I am pretty sure that a majority of the get params are technically correct in the sense that you can pass an integer as an argument for sinceDate and untilDate it is not very useful. After my work with polls, I realized that the api expects unix epoch in milliseconds as a time value. I haven't tested the antenna code yet, but I have a suspicion that

        GetAntennaNotesParams notes = new GetAntennaNotesParams()
        {
            AntennaId = antennaId,
            Limit = limit,
            SinceId = sinceId,
            UntilId = untilId,
            // TODO: Test these, I think that it expects utc unix epoch in milliseconds
            SinceDate = sinceDate.HasValue 
                ? ((DateTimeOffset)sinceDate.Value.ToUniversalTime()).ToUnixTimeMilliseconds() 
                : null,
            UntilDate = untilDate.HasValue 
                ? ((DateTimeOffset)untilDate.Value.ToUniversalTime()).ToUnixTimeMilliseconds() 
                : null,
        };

is a much more useful way to handle the dates. The arguments for the function expect DateTime? values for the specific date, converting it to unix epoch (milliseconds) before serialization. As it currently stands I believe things such as GetGlobalTimelineParams.cs expect a ulong to be given to it. We should be doing the conversion for users, as my aim with this entire library is a compromise between ease of use and allowing for more advanced operations

puppygirlhornypost commented 2 weeks ago

Kio, this is going to be your first assigned issue. For now, only test the ones that are implemented somewhere. It shouldn't be that hard to make a test bot in the sample project to figure out if my theory is correct.