Skip to content

Commit

Permalink
EveLib class.
Browse files Browse the repository at this point in the history
  • Loading branch information
ezet committed Jun 26, 2014
1 parent b870258 commit 8fc7159
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions EveLib.Core/EveLib.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System;
using System.Threading.Tasks;
using eZet.EveLib.Core.RequestHandlers;
using eZet.EveLib.Core.Serializers;
using eZet.EveLib.Core.Util;

namespace eZet.EveLib.Core {
/// <summary>
/// This is a class for general EveLib utilities and methods
/// </summary>
public class EveLib : EveLibApiBase {
private readonly JsonSerializer _jsonSerializer = new JsonSerializer();

private readonly XmlSerializer _xmlSerializer = new XmlSerializer();

/// <summary>
/// Default constructor
/// </summary>
public EveLib() {
RequestHandler = new RequestHandler(_jsonSerializer);
}

/// <summary>
/// Requests and deserializes JSON content to a dynamic object
/// </summary>
/// <param name="uri">URI to request</param>
/// <returns></returns>
public Task<dynamic> RequestJsonAsync(string uri) {
RequestHandler.Serializer = _jsonSerializer;
return requestAsync<dynamic>(uri);
}

/// <summary>
/// Requests and deserializes JSON content to a dynamic object
/// </summary>
/// <param name="uri">URI to request</param>
/// <returns></returns>
public dynamic RequestJson(string uri) {
return RequestJsonAsync(uri).Result;
}

/// <summary>
/// Requests and deserializes XML content to a dynamic object. Not implemented yet.
/// </summary>
/// <param name="uri">URI to request</param>
/// <returns></returns>
public Task<dynamic> RequestXmlAsync(string uri) {
throw new NotImplementedException();
RequestHandler.Serializer = _xmlSerializer;
return requestAsync<dynamic>(uri);
}

/// <summary>
/// Requests and deserializes XML content to a dynamic object. Not implemented yet.
/// </summary>
/// <param name="uri">URI to request</param>
/// <returns></returns>
public dynamic RequestXml(string uri) {
throw new NotImplementedException();
return RequestXmlAsync(uri).Result;
}
}
}

0 comments on commit 8fc7159

Please sign in to comment.