These are chat archives for Ruhrpottpatriot/GW2.NET

5th
Jun 2016
Darnell Williams
@Seeker1437
Jun 05 2016 04:23
Hey guys I just joined this chat after discovering the GW2NET library
I have been spending the last 6 months wrapping APIs in .NET and im like loving the structure and cleaness of this library :O
@Ruhrpottpatriot you rock. I wanted to see if there was any way I could help with this project.
XD
Steven Liekens
@StevenLiekens
Jun 05 2016 10:07
yes you can
there are a bunch of unsolved issues
and there is a LOT that still needs to be implemented
and somehow make sure that the stuff we implement stays up to date
because the API is constantly changing
Darnell Williams
@Seeker1437
Jun 05 2016 11:31
Oh I can definately look at those
Hey I was curious
Why not keep all the DataTypes together?
Steven Liekens
@StevenLiekens
Jun 05 2016 12:37
they are
and they have to be
because different APIs can link to each other
for example, recipes are linked to items (ingredients, output items) and recipe sheet consumable items are linked to recipes
if you don't put them together then you end up with circular references
Steven Liekens
@StevenLiekens
Jun 05 2016 12:43
if you're wondering about the data contract classes: those classes are only used for converting between JSON and classes in the Core library
data contract objects have a very short lifespan
Darnell Williams
@Seeker1437
Jun 05 2016 13:20
AH okay for me I normally just use JsonProperty and computed properties for conversions from string to Enums/DateTime and back
because if I have a class
public class Pie
{
    [JsonProperty("id)]
    public string Id {get; set;}

    [JsonProperty("info")]
    public PieInfo Info {get; set; }
}

public class PieInfo
{
    [JsonProperty("created_at")]
     private string _createdAt;

     public DateTime CreatedAt
     {
            get { return DateTimeHelper.FromIsoString(_createdAt);
            set { _createdAt = DateTimeHelper.ToIsoString(value);
     }
}
Steven Liekens
@StevenLiekens
Jun 05 2016 15:00
then you're combining multiple concerns into a single class
A Pie should know how to be a pie but not how it is converted to a string representation (json)
the reason why we split them is because there might be a /v1/pie.json and a /v2/pie API that have different json schemas
Darnell Williams
@Seeker1437
Jun 05 2016 15:06

Makes sense, yeah and because of that I have

*.V1.Types.Pie and *.V2.Types.Pie

I can see where that is not really desirable

Steven Liekens
@StevenLiekens
Jun 05 2016 15:08
yeah so you'd have three classes
one Core.Pie that is the single point of truth, V1.PieDTO for V1 pies and V2.PieDTO for V2 pies
Darnell Williams
@Seeker1437
Jun 05 2016 15:10
My main reason for doing it that way is because a lot of APIs require calling between version of the same end point where I cannot simply prefer one over the other implicitly.
My thing is if V1.PiePTO and V2.PTO are very different, wouldn't it serve rbetter to have the two classes then?
let me just pull a better example
Steven Liekens
@StevenLiekens
Jun 05 2016 15:14
at that point I would simply drop support for v1 :)
Darnell Williams
@Seeker1437
Jun 05 2016 15:16
Haha the example is too big
anyways, but unfortunately v1 has things v2 doesn't, and v2 has things the v1 doesn't, but the user might need full coverage
Steven Liekens
@StevenLiekens
Jun 05 2016 15:17
maybe you could treat them as different endpoints with a similar name
instead of 2 versions of the same endpoint
so basically what you said
Darnell Williams
@Seeker1437
Jun 05 2016 15:21
Hmm
I do like how you guys did it though, basically I get what I do now from someone else who wrote their wrappers themselves, I want to learn the best way honestly and continue to contribute at the same time
I was just concerned see that there were contracts, I thought it might be a little excessive? but as I look over more of the implementation I think I understand a bit better
Steven Liekens
@StevenLiekens
Jun 05 2016 15:30
it's not generated code
well most of it isn't
Darnell Williams
@Seeker1437
Jun 05 2016 15:31
generated? or did you mean generalized?
Steven Liekens
@StevenLiekens
Jun 05 2016 15:31
generated
Darnell Williams
@Seeker1437
Jun 05 2016 15:31
Oh right yeah, I see what you mean, I think that was a poor choice of words on my part.
Darnell Williams
@Seeker1437
Jun 05 2016 16:14
I'm a fan, I'll take my time learning so i can position myself to be helpful.