GW2.NET a .NET wrapper around the GW2 API

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

This is the official topic on GW2.NET. Here you will find firsthand information about the library, ways to obtain it for use and information about development

What is GW2.NET?
At first GW2.NET was a simple wrapper around the public GW2 API that helped the user with transforming the response into well written C# and .NET code. Since then it has eveloved in many ways. Now it is the most complete wrapper built on the .NET Framework featuring a consitent and easy to use method to fetch data from the API itseld.

Features

  • Unified query syntax for each API endpoint
  • Every v1/ endpoint is available
  • Every unauthorized v2/ endpoint.
  • Tile & Render Services support
  • Mumble Support
  • Full async support!

Obtaining GW2.NET
The easiest way of obtaining a working copy of the code is via NuGet. Open the Package Manger Console and type:


Install-Package GW2.NET

Other ways to obtain the code can be found on the documentation page

I’m clueless and don’t know how to start aká Quickstart
Using the library is really simple. At first you have to reference the following GW2.NET libraries:

  • GW2NET.dll
  • GW2NET.Core.dll

If you are using NuGet those references are automatically added for you, no additional work needed.

After that you have to import the namespace


    using GW2NET;

At last you can use the facade class which manages the most common features for you. Below is an example how to get some Quaggans IDs.


    var service = GW2.V2;
    ICollection<string> keys = service.Discover();
    Task<Collection<string>> keysAsync = service.DiscoverAsync(); // Do everything asynchronously.

If you still have questions you can always look at the Documentation. If you still don’t know what you have to do, you can also ask a question in this thread or (better) in the Discussions

I don’t like the way you have done x/y. You suck and I’m sure I can do it better!
Laugh If you think so go ahead, nobody is stopping you! After all the libary is completely open source. Check out our License and code away. If you think you’ve developed a great feature that should be added to the main library simply supply a patch at the Source Code Tab. We will definetly look into it!

Where to go from here?
Recently ArenaNet has opened up some more API endpoints in the v2/ namespace and those need to be included. The next big milestone however is the authorized API that is currently been worked on. We are as eager as you are to the idea to query a characters bank or his skills from outside the game.

How can I contact you?
The simplest way to contact us is right here in the forum. If you want to get sure your question, request or criticism is not lost between other posts, the best option is the Discussions section on Codeplex. You can also contact me via Codeplex directly I also have a Stackoverflow Account. Of course I am not the only one working on the project. There is a whole team behind me who have all done an excellent job of improving every aspect of the code. Onne big Thanks! goes directly to Steven Liekens who made the currently layout possible. Thanks Steven!

Administrator of GW2.NET: GitHub , Forum , NuGet

(edited by Ruhrpottpatriot.7293)

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Varonth.5830

Varonth.5830

.NET 4.5 can handle JSON: http://msdn.microsoft.com/en-us/library/bb410770.aspx

SSL connections are available for basically any language you want:
http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1

So I don’t know what exactly you need.

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

No my aims was not to provide a json serializer (I’d rather not use 4.5 because 4.5 does not support XP anymore and most users are still using XP and the whole data contract thing is more than just basic) or SSL connections, but a class library which provides developers who write .Net Applications with classes and methods to develop their program more easily.
Think of it as a wrapper around the GW2 API for .NET

Administrator of GW2.NET: GitHub , Forum , NuGet

(edited by Ruhrpottpatriot.7293)

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: kousei.5914

kousei.5914

I’ve started one for my own purposes but I don’t have a problem splitting off the API Wrapper pieces and dropping them on CodePlex if I can get some help maintaining it.

Leader of Marked Souls [MkS]
Jade Quarry

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Sounds great. I’ll do some things on the codeplex site today and tomorrow and publish the thing as soon as possible.

Ok, I’m done with the codeplex page (can be found here: https://gw2dotnet.codeplex.com/). The code is pretty basic and rudimentary as I didn’t have much time and I’m fairly new to the whole WebRequest thing. I’m willing to learn though and I hope to do so by providing to this project.

Administrator of GW2.NET: GitHub , Forum , NuGet

(edited by Ruhrpottpatriot.7293)

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Remfin.4892

Remfin.4892

I’d be happy to give you what I have so far, although it’s not much more but a little more structure and models around the API.

If I could make a suggestion…use HttpClient instead of WebRequests, it’s supposedly much better (it’s also much easier to use).

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Yeah I hope to clean up the code a little bit and write some more basic wrapper methods which just return the JSON Data as .NET objects. Will see if I Get to that later.

Also, if you have a codeplex account (or Microsoft account) pm it to me so I can add you to the team.

Administrator of GW2.NET: GitHub , Forum , NuGet

(edited by Ruhrpottpatriot.7293)

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Rohan.1403

Rohan.1403

I have been working on my own implementation here. Just learned that RestSharp exists so I will see about switching to that tomorrow.

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

I’ll look into RestSharp myself and if it offers the functionality wee need I’ll include it in the project.

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: poke.3712

poke.3712

I’ve created an example using RestSharp, if anyone is interested: https://gist.github.com/poke/5627036

@poke // GW2W //

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

I’ve created an example using RestSharp, if anyone is interested: https://gist.github.com/poke/5627036

Thanks for sharing, poke! Awesome work.

Creator of GW2Kit

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Yeah, thanks for the example I’m currently including it in the codeplex project.

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Gilosean.3805

Gilosean.3805

Awesome! The API is really exciting news, and I’m so happy to see that people are already doing stuff in C# with it. Anyone thinking about using Mono/Xamarin to get an Android app out of this?

Some people are setting up a GW2 Trello board and chat room to help coordinate development. The thread is here if you’re interested: https://forum-en.gw2archive.eu/forum/community/api/Want-to-collaborate-on-GW2-apps-Start-here/first

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Ok, I included a call with Rest# to the project (much faster thanks for the tip) and added equality comparison and hash code to the event, world and map models.

Still need help with caching though.

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Awesome! The API is really exciting news, and I’m so happy to see that people are already doing stuff in C# with it. Anyone thinking about using Mono/Xamarin to get an Android app out of this?

As this is library is coded purely in .NET and will not include any UI stuff it should be pretty safe to use this with mono (I don’t have any experience with mono however). Still looking for more developers though. Everyone who wants to contribute can PM me here with their Codeplex/MS username and I’ll add him to the developer list.

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Ok, quick heads up.
Implementation runs fine. We are debating some internal issue (for those who want to help and participate: https://gw2dotnet.codeplex.com/discussions/444658) but apart from that we are doing good.

I welcome any input here, but I request that “bigger” topics be discussed on the codeplex site where we have a dedicated discussion section for that.

See you

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Thurfir.6381

Thurfir.6381

Hi everyone, mostly out of curiosity, why do you require a plugin to perform the task? I understand that the 4.5 framework isn’t suitable for everyone, but to my experience the DataContractJsonSerializer is available in .NET 3.5 too, I used it to seralize in some of my projects ;-).

http://msdn.microsoft.com/en-us/library/bb412179%28v=vs.90%29.aspx
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer.readobject%28v=vs.90%29.aspx

Have fun!

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Rawrfaec.6412

Rawrfaec.6412

I don’t know the reason in this case but .NET SDK JSON serializers are relatively slow compared to third party alternatives.

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: poke.3712

poke.3712

Hi everyone, mostly out of curiosity, why do you require a plugin to perform the task?

I assume you mean RestSharp? The reason is simply to not re-invent the wheel. The RestSharp library (not a plugin) makes using REST resources very simple and consistent. And especially later when the API is expanded and adds some authentication mechanism, you can just configure RestSharp once to use it and you’re done.

Of course you can write it all in standard .NET framework code—RestSharp is written like that too after all—but you can save quite a bit of work by reusing working and tested libraries.

@poke // GW2W //

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Thurfir.6381

Thurfir.6381

Thanx ;-) . I had some bad experiences with some plugins which became more of an hindrance than an actual help, is why I tend to either use the built-in functionnalities, or well-tried plugins only.

About the .NET serializer, If I remember correctly that one is the one used by the WCF Web services, so I genuinely hope the performance difference isn’t that bad xD .

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Wcf web service (afaik) builds heavily on xml that’s also the reason why there’s a great support for that (LinqtoXml, etc.)

As the api uses json not xmlwe have to use a different method to de-serialize the json contetn into .Net objects we can use. The .Net framework gives us a tool for that, the DataContractSerializer. However DCS is slow, not as slow as the other alternative – JavaScript Serializer – but still slower than the Json.Net library we were using. (see here: for features of Json.Net and performance: https://json.codeplex.com/).

The reason why we are suing third party de-serializes is as poke said: “not to reinvent the weel”. Why write custom code, which we have to maintain if a better solution is out there.
It’s the same as if you would buy a car, without wheels because you make them in your own garage instead of buying goodyear stuff

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: steckums.9108

steckums.9108

Sounds great. I’ll do some things on the codeplex site today and tomorrow and publish the thing as soon as possible.

Ok, I’m done with the codeplex page (can be found here: https://gw2dotnet.codeplex.com/). The code is pretty basic and rudimentary as I didn’t have much time and I’m fairly new to the whole WebRequest thing. I’m willing to learn though and I hope to do so by providing to this project.

Just wanted to let you know, I’m using your API. I’ve found at least one error so far:

WVW→Models→Match is a struct, which is great and usable.
WvW→Models→MatchDetails is NOT a struct (it’s a class). Changing it to a struct, and re-adding the .dll to my project solved the problem of being able to access that datatype.

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Yeah little bug there. Fixed it and it should be in the repository now.

On another note: We completely rewrote the events engine (or at least are 90% done with the rewriting) which we will implement to the other areas asap. The user now has a manager class which will manage the cache and everything else. This removed thee need for singletons. As the end-user now cannot directly create instances of the calling functions, but only the manger itself.
This ensures that the cached data is used, presumed that the user only creates one manager class!

Some examples should be up in the next few days.

Administrator of GW2.NET: GitHub , Forum , NuGet

(edited by Ruhrpottpatriot.7293)

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: steckums.9108

steckums.9108

Yeah little bug there. Fixed it and it should be in the repository now.

On another note: We completely rewrote the events engine (or at least are 90% done with the rewriting) which we will implement to the other areas asap. The user now has a manager class which will manage the cache and everything else. This removed thee need for singletons. As the end-user now cannot directly create instances of the calling functions, but only the manger itself.
This ensures that the cached data is used, presumed that the user only creates one manager class!

Some examples should be up in the next few days.

Since you’re using RestSharp for this, how would I use this for a Windows 8 application? The target versions of .NET aren’t compatible between the two.

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

it should be. WE are targeting .Net 4.0 and Win 8 should have 4.5. Compatibility is therefore given.

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Some examples are up. Currently they are pretty bare-bones, but they’ll grow with time:
https://gw2dotnet.codeplex.com/documentation

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: steckums.9108

steckums.9108

It looks like in the latest version, GW2.NET/V1/WvW was not included in the source code, but if you open the project, it’s looking for a reference for WvWManager.cs (And, of course, the model and DataProvider folders are empty).

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Yeah my bad. I worked in University on the WvW, then shelved the changes to continue work later at home, but forgot to submit the changes into the repository.

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: steckums.9108

steckums.9108

Next question: If I were to want to query the API on a specific event to see if the status has changed, how would I do that with your wrapper?

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Updated documentation to have examples on how to retrieve events.

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Rohan.1403

Rohan.1403

Next question: If I were to want to query the API on a specific event to see if the status has changed, how would I do that with your wrapper?

If you’re going to be checking for changes consider using Gw#. It provides events for exactly what you need.

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Currently our Wrapper does not support a event status change, this is the next big thing we want to implement.

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: DarkSpirit.7046

DarkSpirit.7046

Are you guys using RestSharp? I am not familiar with it but how well does it support deserializing the flags array from the item details into a bit flags enum?

Sorry for jumping the gun because you have not worked on that yet.

(edited by DarkSpirit.7046)

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Yes we are using RestSharp to get the Json from the ANet server. However we are using Json.Net to deserialize the string as Json.Net is the fastest Json deserializer out there and we can use every bit off speed.

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: DarkSpirit.7046

DarkSpirit.7046

Yes we are using RestSharp to get the Json from the ANet server. However we are using Json.Net to deserialize the string as Json.Net is the fastest Json deserializer out there and we can use every bit off speed.

Cool, so am I. I had to implement my own JSONConverter to deserialize the flags JSON array to a flags enum. It works but I am not too happy with the way I did it so I am looking for a more elegant solution.

I’ll wait for you guys to get to the items API then.

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

OK I fixed a bug whereas the wrapper did not parse the wvw objects properly. THis is now fixed.

The documentation also has recieved a new topic on how to retrieve the wvw matches.

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Healix.5819

Healix.5819

Cool, so am I. I had to implement my own JSONConverter to deserialize the flags JSON array to a flags enum. It works but I am not too happy with the way I did it so I am looking for a more elegant solution.

I’m assuming something like?

[Flags]
enum ItemFlags 
{ 
    None = 0, 
    AccountBound = 1 << 0, 
    HideSuffix = 1 << 1, 
    NoMysticForge = 1 << 2, 
    NoSalvage = 1 << 3, 
    NoSell = 1 << 4, 
    NotUpgradeable = 1 << 5, 
    NoUnderwater = 1 << 6, 
    SoulBindOnAcquire = 1 << 7, 
    SoulBindOnUse = 1 << 8,
    Unique = 1 << 9
};

And then however you read the original flags,

ItemFlags flags = ItemFlags.None;
foreach (string flag in item.flags)
    flags |= (ItemFlags)Enum.Parse(typeof(ItemFlags), flag, true); //try/catch this for unknown types

It’s a pretty simple way to get an enum representation of their string array.

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: DarkSpirit.7046

DarkSpirit.7046

Cool, so am I. I had to implement my own JSONConverter to deserialize the flags JSON array to a flags enum. It works but I am not too happy with the way I did it so I am looking for a more elegant solution.

I’m assuming something like?

[Flags]
enum ItemFlags 
{ 
    None = 0, 
    AccountBound = 1 &lt;&lt; 0, 
    HideSuffix = 1 &lt;&lt; 1, 
    NoMysticForge = 1 &lt;&lt; 2, 
    NoSalvage = 1 &lt;&lt; 3, 
    NoSell = 1 &lt;&lt; 4, 
    NotUpgradeable = 1 &lt;&lt; 5, 
    NoUnderwater = 1 &lt;&lt; 6, 
    SoulBindOnAcquire = 1 &lt;&lt; 7, 
    SoulBindOnUse = 1 &lt;&lt; 8,
    Unique = 1 &lt;&lt; 9
};

And then however you read the original flags,

ItemFlags flags = ItemFlags.None;
foreach (string flag in item.flags)
    flags |= (ItemFlags)Enum.Parse(typeof(ItemFlags), flag, true); //try/catch this for unknown types

It’s a pretty simple way to get an enum representation of their string array.

Something like that except that I have to make the ItemFlags type more generic since I would want to use the same JSONConverter for the other flag-like enums.

I also use the EnumMember attribute to map certain JSON strings to enum flags since I am picky with the way my flags are spelled, but that is just extra code to handle it.

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Json.Net can directly deserialze to enums.

haven an enum like this:

/// <summary>
/// Enumerates all possible states an event can be.
/// </summary>
public enum GwEventState
{
/// <summary>
/// The event is running now.
/// </summary>
Active,

/// <summary>
/// The event has succeeded.
/// </summary>
Success,

/// <summary>
/// The event has failed.
/// </summary>
Fail,

/// <summary>
/// The event is inactive,
/// and will only become active once certain criteria are met.
/// </summary>
Warmup,

/// <summary>
/// The criteria for the event to start have been met,
/// but certain activities (such as an NPC dialogue) have not completed yet.
/// After the activities have been completed, the event will become Active.
/// </summary>
Preparation,

/// <summary>
/// The event is invalid.
/// For now no further information were released by Arena Net
/// </summary>
Invalid
}

and then have a property on the model like this:

/// <summary>
/// Gets the state.
/// </summary>
[JsonProperty(“state”)]
public GwEventState State
{
get { return this.state; }
}

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: DarkSpirit.7046

DarkSpirit.7046

Json.Net can directly deserialze to enums.
snip

I meant deserializing enum Flags from JSON array, look at Healix’s example. For straight deserializing into enum, you can just use the built-in StringEnumConverter.

In order to make ItemFlags a generic type and also use the bitwise OR operator on it, I had to use the dynamic type. That works but I am not happy with resorting to that and I wonder if there is a better way.

(edited by DarkSpirit.7046)

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Yes that’s what my example also does. You create an object and annotate it with the [JsonProperty] attribute if the naming differs from the naming in the json string. Json.Net will then automatically try and find the enum and deserialize into.

You could also not define a type and let Json.Net deserialize for itself. But then you’dprobably get an object back.

Look how we did it in Gw2.Net (V1.World namespace and there look at the models).

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: DarkSpirit.7046

DarkSpirit.7046

Yes that’s what my example also does. You create an object and annotate it with the [JsonProperty] attribute if the naming differs from the naming in the json string. Json.Net will then automatically try and find the enum and deserialize into.

You could also not define a type and let Json.Net deserialize for itself. But then you’dprobably get an object back.

Look how we did it in Gw2.Net (V1.World namespace and there look at the models).

I know all that but what we wanted is to deserialize JSON like this:

“flags”:[“AccountBound”,“SoulBindOnUse”]

into:
[Flags]
public enum GW2APIFlagsEnum
{
None = 0,
AccountBound = 0×01,
SoulBindOnUse = 0×02,
HideSuffix = 0×04,
NoMysticForge = 0×08,
NoSell = 0×010,

}
So the property looks like:

public GW2APIFlagsEnum Flags;

So Flags can take on the state of BOTH AccountBound and SoulBindOnUse at the same time, according to the JSON array, since they are bit-flags. You can use them like this by checking if individual bits are set:

if ((item.Flags & GW2APIFlagsEnum.NoSell) != 0) ….

if ((item.Flags & GW2APIFlagsEnum.SoulBindOnUse) != 0) ….

(edited by DarkSpirit.7046)

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Is an IEnumerable<GW2APIFlagsEnum> a solution?

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: DarkSpirit.7046

DarkSpirit.7046

Is an IEnumerable<GW2APIFlagsEnum> a solution?

I already have a solution but I am just looking for a better one, if it exists. I had to implement my own JSONConverter to deserialize the JSON array values into bits and bitwise-OR them (see Healix’s post above). But I had to use the dynamic type to make my JSONConverter generic enough for all the Flags enum, which I am not happy about.

(edited by DarkSpirit.7046)

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

I already have a solution but I am just looking for a better one, if it exists. I had to implement my own JSONConverter to deserialize the JSON array values into bits and bitwise-OR them (see Healix’s post above).

Well on that topic I’m not that great. I recommend you ask your question over at Stackoverflow I’m sure they can help you with it.

On a more topic related note:
The basic implementation of the items & recipe API part is now in the depot/repository (don’t be confuse if I say depot in one sentence and repository in another I work with SVN and P4 on other projects and they use different terms but they mean the same).

You now can query the server for all the available recipes (WARNING!!!:: This will take a very, very long time) or for one recipe at a time.

I’m still looking for willing people to help me and the others code, especially on the subject of async requests.

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: DarkSpirit.7046

DarkSpirit.7046

You now can query the server for all the available recipes (WARNING!!!:: This will take a very, very long time) or for one recipe at a time.

I’m still looking for willing people to help me and the others code, especially on the subject of async requests.

Thanks.

I would advise people to use the data dump for items and recipes because these are not suppose to change often except maybe after a game patch. You can read the data into a dictionary when your app starts up, which doesn’t take too long, then do a dictionary lookup after that. This saves bandwidth and improves the performance of your app significantly at the same time.

Granted that the api is still beta and there is an existing bug where some items are missing. Cliff is looking into that. But after release, I expect the data to be more stable.

It is so fast, that I use this data to build item tooltips on my app on the fly. I cached the images of course. It would not have been possible if I have to go fetch data from the web each time I want to build up a tooltip as the mouse pointer moves across the items.

You can use the item and recipe data dump here:

https://www.dropbox.com/sh/zucn218fhneva3c/-MjOkUsTtI

Discussion:

https://forum-en.gw2archive.eu/forum/community/api/Data-dump-All-recipes-and-created-items/first#post2129446

(edited by DarkSpirit.7046)

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Yeah I’ll probably do that. Still, I want to build querying functionality first (that should be ready by tomorrow or the day after), then build async support plus data refreshing around it and then think about a more efficient way of caching the data.

This project mainly aims to be a helper library (aka, you request an event and get the map and world details with it so you don’t have to query the api three times, the library will do that) not a fully fledged program, So I’m inclined to let caching of data more permanently than a session fall into the end-users hand (Still I might offer some “adapters” to ease the use of caching for the end user).

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Hey fellas,
our implementation now includes the colour api. This has thrown the items implementation a bit back but I hope I can deliver it to you in the next days.

Administrator of GW2.NET: GitHub , Forum , NuGet

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

I’m somewhat proud to present you the first implementation of the items api in GW2.Net

I believe this is on of the most complete implementation (if not the most complete) of the items api in any wrapper currently out there.

The code is already in the depot, as it builds, but it hasn’t been tested yet so there are definetly some bugs in there. But the unt tests are running and I’m fixing those asap.

You can get all items or just a single item by it’s id. The other new thing is the caching. If you request one item by it’s id the wrapper will check if the items cache is already populated, if it is it will pull the item out of the cache. If the cache is not populated it will make a connection to the api and pull the single item from the server without touching the overall cache.

If you find any bugs please report them at the Issue Tracker

Administrator of GW2.NET: GitHub , Forum , NuGet

(edited by Ruhrpottpatriot.7293)

GW2.NET a .NET wrapper around the GW2 API

in API Development

Posted by: DarkSpirit.7046

DarkSpirit.7046

Hey Ruhrpottpatriot, I noticed that you deserialized item flags into a List. Although that is easier to deserialize, it is going to be harder for your client to use.

For example, if I am to look for items that are AccountBound, then I would have to search through the Flags List for AccountBound for each item. This is why I deserialize it to bit flags so I can just do this:

if ((pair.Value.Flags & GW2APIFlagsEnum.AccountBound) != 0) {…}

If you agree, let me know if you want to see my item flags JSONConverter or any part of my code if you want.

(edited by DarkSpirit.7046)