These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

[EveLib] A .NET library for EveXML, CREST, EveCentral, and more

First post
Author
Dread Griffin
Pator Tech School
Minmatar Republic
#421 - 2016-06-01 18:50:46 UTC  |  Edited by: Dread Griffin
In evelib/EveLib.EveCrest/Models/Resources/Region.cs there doesn't appear to be a datamember for 'marketOrdersAll'. I assume this means I can't use evelib to access bulk market orders yet?

Thanks in advance.

EDIT: I just read the post about the dynamic crest lib on the previous page. Maybe this will work instead. Still need to check it out.
Icahmura Hasaki
Perkone
Caldari State
#422 - 2016-06-02 06:02:39 UTC
Dread Griffin wrote:
In evelib/EveLib.EveCrest/Models/Resources/Region.cs there doesn't appear to be a datamember for 'marketOrdersAll'. I assume this means I can't use evelib to access bulk market orders yet?

Thanks in advance.

EDIT: I just read the post about the dynamic crest lib on the previous page. Maybe this will work instead. Still need to check it out.


Oh, I thought "marketOrders" was the correct endpoint, and I hadn't even noticed "marketOrdersAll". I will try and fix this asap, but i'll probably be a week as I'm busy with exams. Funny how no one else has commented on this.

But yes, this is exactly why I made dynamic crest, because it allows you to query any endpoint and retrieve any resource without the need for updates.

Please let me know if you are having any issues with dynamic crest or need more examples of how to use it. GET requests should be easy to do.

Developer of EveLib and EveAuthUtility

Dread Griffin
Pator Tech School
Minmatar Republic
#423 - 2016-06-02 06:22:42 UTC
Icahmura Hasaki wrote:
Dread Griffin wrote:
In evelib/EveLib.EveCrest/Models/Resources/Region.cs there doesn't appear to be a datamember for 'marketOrdersAll'. I assume this means I can't use evelib to access bulk market orders yet?

Thanks in advance.

EDIT: I just read the post about the dynamic crest lib on the previous page. Maybe this will work instead. Still need to check it out.


Oh, I thought "marketOrders" was the correct endpoint, and I hadn't even noticed "marketOrdersAll". I will try and fix this asap, but i'll probably be a week as I'm busy with exams. Funny how no one else has commented on this.

But yes, this is exactly why I made dynamic crest, because it allows you to query any endpoint and retrieve any resource without the need for updates.

Please let me know if you are having any issues with dynamic crest or need more examples of how to use it. GET requests should be easy to do.


I've managed to get all the market orders in The Forge using this:
var theForgeMarketOrders = await(await(await(await 
                crest.GetAsync(crest.Host))
                .GetAsync(r => r.regions))
                .GetAsync(a => a.First(o => o.id == 10000002)))
                .GetAsync(r => r.marketOrdersAll);

However, I'm fairly new to C# and LINQ and wasn't really sure how to work with the returned object. I think i managed to hammer it into a list of objects i made with this:
foreach (var marketOrder in theForgeMarketOrders)
            {
                MarketOrder temp = new MarketOrder();
                temp.buy = marketOrder.buy;
                temp.issued = marketOrder.issued;
                temp.price = marketOrder.price;
                temp.volume = marketOrder.volume;
                temp.duration = marketOrder.duration;
                temp.id = marketOrder.id;
                temp.minVolume = marketOrder.minVolume;
                temp.volumeEntered = marketOrder.volumeEntered;
                temp.range = marketOrder.range;
                temp.stationID = marketOrder.stationID;
                temp.type = marketOrder.type;
                MarketOrders.Add(temp);
            }


I didn't have much time to work on it today, but I hope to hammer away some more tomorrow.
Dread Griffin
Pator Tech School
Minmatar Republic
#424 - 2016-06-02 19:40:38 UTC
It seems executing a foreach loop on your eZet.EveLib.DynamicCrest.Expando object works fine until the end when I get an exception for the object not containing a definition for 'next'. I've looked up ways to identify if an ExpandoObject contains a given method, but I don't think you can use them to control a foreach call.

I'm currently just catching and suppressing the exception and everything is going fine. I'm not sure if I need to be doing something different or if your object could end a foreach differently.
Icahmura Hasaki
Perkone
Caldari State
#425 - 2016-06-04 14:28:32 UTC
Thanks for the feedback so far, greatly appreciated. How you are creating the list is fine, and intended. I assume you have defined the MarketOrder class, it isnt the EveCrest one?

I'll look into the exception you mentioned, that's not intended.

So far it looks like you've got it working, let me know if you have other issues! :)

Developer of EveLib and EveAuthUtility

Dread Griffin
Pator Tech School
Minmatar Republic
#426 - 2016-06-05 22:08:11 UTC
Icahmura Hasaki wrote:
Thanks for the feedback so far, greatly appreciated. How you are creating the list is fine, and intended. I assume you have defined the MarketOrder class, it isnt the EveCrest one?

I'll look into the exception you mentioned, that's not intended.

So far it looks like you've got it working, let me know if you have other issues! :)


Yes, I created that market order class. Everything seems to be working fine so far.
Tommy Tripod
Ministry of War
Amarr Empire
#427 - 2016-06-11 22:13:59 UTC
Hi, I've been trying to access my fleet through EveCrest, but sofar I have not been able to find it. Am I looking in the wrong place or has that not been added to the library yet?
Icahmura Hasaki
Perkone
Caldari State
#428 - 2016-06-13 07:30:24 UTC
Tommy Tripod wrote:
Hi, I've been trying to access my fleet through EveCrest, but sofar I have not been able to find it. Am I looking in the wrong place or has that not been added to the library yet?


Fleet endpoints are not supported yet, sorry.

Developer of EveLib and EveAuthUtility

Mathliney Kagrel
Caldari Provisions
Caldari State
#429 - 2016-06-14 12:22:26 UTC  |  Edited by: Mathliney Kagrel
Hello,

Since today's changes, API is broken, server status or something like this.

Here is the error :


Test method eZet.EveLib.Test.EveCrest_Public_Tests.GetRoot threw exception:
Newtonsoft.Json.JsonSerializationException: Error converting value "online" to type 'eZet.EveLib.EveCrestModule.Models.Resources.CrestRoot+ServerStatus'. Path 'serviceStatus', line 1, position 1980. --- System.ArgumentException: Could not cast or convert from System.String to eZet.EveLib.EveCrestModule.Models.Resources.CrestRoot+ServerStatus.

    at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
--- End of inner exception stack trace ---
    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at eZet.EveLib.Core.Serializers.JsonSerializer.eZet.EveLib.Core.Serializers.ISerializer.Deserialize[T](String data) in D:\Downloads\evelib-master\EveLib.Core\Serializers\JsonSerializer.cs:line 73
   at eZet.EveLib.EveCrestModule.RequestHandlers.CachedCrestRequestHandler.GetAsyncd__53`1.MoveNext() in D:\Downloads\evelib-master\EveLib.EveCrest\RequestHandlers\CachedCrestRequestHandler.cs:line 260
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at eZet.EveLib.EveCrestModule.EveCrest.getAsyncd__121`1.MoveNext() in D:\Downloads\evelib-master\EveLib.EveCrest\EveCrest.cs:line 1028
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at eZet.EveLib.EveCrestModule.EveCrest.GetRootAsyncd__82.MoveNext() in D:\Downloads\evelib-master\EveLib.EveCrest\EveCrest.cs:line 561
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at eZet.EveLib.Test.EveCrest_Public_Tests.GetRootd__6.MoveNext() in D:\Downloads\evelib-master\EveLib.Tests\EveCrest_Public_Tests.cs:line 43
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()


Icahmura Hasaki
Perkone
Caldari State
#430 - 2016-06-14 16:44:34 UTC
With all the breaking changes to CREST, I will probably not be actively developing or supporting EveCrest anymore, it's simply too time consuming to keep up with all the changes.

I will focus on DynamiCrest, and my first priority is to add support for PUT and DELETE requests. If you are currently using GET and POST requests, I would suggest you replace EveCrest with DynamiCrest. The syntax and feature set is almost identical, and it's a lot more future proof.

As always, if anyone is having issues or need help in general, I'm more than happy to help. I expect to be able to put some work in towards DynamiCrest over the next couple of weeks.

Developer of EveLib and EveAuthUtility

Mathliney Kagrel
Caldari Provisions
Caldari State
#431 - 2016-06-14 17:49:13 UTC
Icahmura Hasaki wrote:
With all the breaking changes to CREST, I will probably not be actively developing or supporting EveCrest anymore, it's simply too time consuming to keep up with all the changes.

I will focus on DynamiCrest, and my first priority is to add support for PUT and DELETE requests. If you are currently using GET and POST requests, I would suggest you replace EveCrest with DynamiCrest. The syntax and feature set is almost identical, and it's a lot more future proof.

As always, if anyone is having issues or need help in general, I'm more than happy to help. I expect to be able to put some work in towards DynamiCrest over the next couple of weeks.



Will give Dynamic version a try then.

Can you explain in a few words what are the main differencies between regular and dynamic version ? I mean why "dynamic" for example ?
Icahmura Hasaki
Perkone
Caldari State
#432 - 2016-06-14 18:11:43 UTC
Mathliney Kagrel
Caldari Provisions
Caldari State
#433 - 2016-06-14 21:47:21 UTC
Dread Griffin wrote:
It seems executing a foreach loop on your eZet.EveLib.DynamicCrest.Expando object works fine until the end when I get an exception for the object not containing a definition for 'next'. I've looked up ways to identify if an ExpandoObject contains a given method, but I don't think you can use them to control a foreach call.

I'm currently just catching and suppressing the exception and everything is going fine. I'm not sure if I need to be doing something different or if your object could end a foreach differently.



Yep, having the same error for every kind of resource, easy to avoid btw.

So far, I really like this dynamic version, easier to use imho.

Nice work.
Mathliney Kagrel
Caldari Provisions
Caldari State
#434 - 2016-06-18 14:04:16 UTC
I have a small problem but kinda blocking : how can we get for example market history for a said item in a said region ?

I mean I can get every orders (thanx to "orderAll") but the same question would apply if I only want to get Jita orders for Tritanium (usual example).

Let's say we have something like this (several steps just to step in with debugger) :

var regionId = 10000002;
var typeId = 34;

var crest = new DynamicCrest();

var root = await crest.GetAsync(crest.Host);
var regions = await root.GetAsync(r => r.regions);
var tmpRegion = await regions.GetAsync(a => a.FirstOrDefault(o => o.id == regionId));

//here it fails since it needs typeId somehow...
var tmpHistory = await tmpRegion.GetAsync(h => h.marketHistory);


Can someone give me an example of the correct syntax to do this ?


Regards
Icahmura Hasaki
Perkone
Caldari State
#435 - 2016-06-18 14:46:54 UTC  |  Edited by: Icahmura Hasaki
See if this works:


var itemUrl = "https://crest-tq.eveonline.com/types/589/";
var tmpHistory = await tmpRegion.GetAsync(h => h.marketHistory, "type", itemUrl);


Obviously you don't want to hardcode the url like that for production code, but rather find the item url through CREST. Let me know if it works, if not I'll try to find the time to fix it. This is how it's done in EveCrest, I can't remember if I implemented it in DynamiCrest.

Developer of EveLib and EveAuthUtility

Mathliney Kagrel
Caldari Provisions
Caldari State
#436 - 2016-06-18 14:49:34 UTC  |  Edited by: Mathliney Kagrel
Icahmura Hasaki wrote:
See if this works:


var itemUrl = "https://crest-tq.eveonline.com/types/589/";
var tmpHistory = await tmpRegion.GetAsync(h => h.marketHistory, "type", itemUrl);


Obviously you don't want to hardcore the url like that for production code, but rather find the item url through CREST. Let me know if it works, if not I'll try to find the time to fix it. This is how it's done in EveCrest, I can't remember if I implemented it in DynamiCrest.



Thank you for reply,

Already tried this way but "GetAsync" only takes 1 argument, not 3, maybe I should use a List for arguments ?

I don't mind using direct URL like this, I can build it with SDE info or grab it from CREST, not a big deal.
Icahmura Hasaki
Perkone
Caldari State
#437 - 2016-06-18 14:53:18 UTC  |  Edited by: Icahmura Hasaki
Mathliney Kagrel wrote:
Icahmura Hasaki wrote:
See if this works:


var itemUrl = "https://crest-tq.eveonline.com/types/589/";
var tmpHistory = await tmpRegion.GetAsync(h => h.marketHistory, "type", itemUrl);


Obviously you don't want to hardcore the url like that for production code, but rather find the item url through CREST. Let me know if it works, if not I'll try to find the time to fix it. This is how it's done in EveCrest, I can't remember if I implemented it in DynamiCrest.



Thank you for reply,

Already tried this way but "GetAsync" only takes 2 arguments, not 3, maybe I should use a List for arguments ?

I don't mind using direct URL like this, I can build it with SDE info or grab it from CREST, not a big deal.


What is the expected type if the second argument? I don't have access to the code here and it's been a while since I worked on it last. In any case, parameters probably aren't supported then. I'll see if I can fix that this week.

edit: Oh, actually, you can append "?type=https://crest-tq.eveonline.com/inventory/types/18/" to tmpRegion.marketHistory.Url or Href or whatever property has the url, and then perform the query, that should work. It's a bit of a hack, but you should be able to get it working, and it shouldnt cause any issues with future releases.

Developer of EveLib and EveAuthUtility

Mathliney Kagrel
Caldari Provisions
Caldari State
#438 - 2016-06-18 15:03:44 UTC
Icahmura Hasaki wrote:
Mathliney Kagrel wrote:
Icahmura Hasaki wrote:
See if this works:


var itemUrl = "https://crest-tq.eveonline.com/types/589/";
var tmpHistory = await tmpRegion.GetAsync(h => h.marketHistory, "type", itemUrl);


Obviously you don't want to hardcore the url like that for production code, but rather find the item url through CREST. Let me know if it works, if not I'll try to find the time to fix it. This is how it's done in EveCrest, I can't remember if I implemented it in DynamiCrest.



Thank you for reply,

Already tried this way but "GetAsync" only takes 2 arguments, not 3, maybe I should use a List for arguments ?

I don't mind using direct URL like this, I can build it with SDE info or grab it from CREST, not a big deal.


What is the expected type if the second argument? I don't have access to the code here and it's been a while since I worked on it last. In any case, parameters probably aren't supported then. I'll see if I can fix that this week.

edit: Oh, actually, you can append "?type=https://crest-tq.eveonline.com/inventory/types/18/" to tmpRegion.marketHistory.Url or Href or whatever property has the url, and then perform the query, that should work. It's a bit of a hack, but you should be able to get it working, and it shouldnt cause any issues with future releases.



Will try to append url completin string.

Candidates are

Task"Expando" GetAsync(Func"dynamic,ExpandoObject")

and

Task"Expando" GetAsync(Func"List"dynamic",ExpandoObject")



Sorry for the "" but forum doesn't accept Greater and Lower than symbols...
Mathliney Kagrel
Caldari Provisions
Caldari State
#439 - 2016-06-18 15:05:02 UTC
Icahmura Hasaki wrote:
Mathliney Kagrel wrote:
Icahmura Hasaki wrote:
See if this works:


var itemUrl = "https://crest-tq.eveonline.com/types/589/";
var tmpHistory = await tmpRegion.GetAsync(h => h.marketHistory, "type", itemUrl);


Obviously you don't want to hardcore the url like that for production code, but rather find the item url through CREST. Let me know if it works, if not I'll try to find the time to fix it. This is how it's done in EveCrest, I can't remember if I implemented it in DynamiCrest.



Thank you for reply,

Already tried this way but "GetAsync" only takes 2 arguments, not 3, maybe I should use a List for arguments ?

I don't mind using direct URL like this, I can build it with SDE info or grab it from CREST, not a big deal.


What is the expected type if the second argument? I don't have access to the code here and it's been a while since I worked on it last. In any case, parameters probably aren't supported then. I'll see if I can fix that this week.

edit: Oh, actually, you can append "?type=https://crest-tq.eveonline.com/inventory/types/18/" to tmpRegion.marketHistory.Url or Href or whatever property has the url, and then perform the query, that should work. It's a bit of a hack, but you should be able to get it working, and it shouldnt cause any issues with future releases.



Btw, what is the simpliest way to request an url directly with this API ?

May be useful sometimes I think...
Icahmura Hasaki
Perkone
Caldari State
#440 - 2016-06-18 15:09:13 UTC
You are already doing that here:

var root = await crest.GetAsync(crest.Host);


You should be able to request any url using that :)

Developer of EveLib and EveAuthUtility