Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 24 18:06
    StevenLiekens commented #59
  • Mar 24 18:05
    StevenLiekens closed #59
  • Mar 24 18:05
    StevenLiekens commented #59
  • Mar 24 17:47
    StevenLiekens closed #58
  • Mar 24 17:47
    StevenLiekens commented #58
  • Mar 19 13:02
    Friesinator edited #59
  • Mar 19 13:01
    Friesinator opened #59
  • Mar 18 12:38
    StevenLiekens commented #58
  • Mar 15 15:19
    GHOSCHT commented #58
  • Mar 14 22:01
    Seeker1437 commented #58
  • Mar 14 20:08
    GHOSCHT commented #58
  • Mar 12 15:40
    StevenLiekens commented #58
  • Mar 10 15:46
    GHOSCHT opened #58
  • Apr 15 2018 16:43

    Ruhrpottpatriot on ServiceClient

    Remove superfluous compression … Add simple caching to Core proj… Move files into different folde… and 8 more (compare)

  • Apr 10 2018 21:09

    Ruhrpottpatriot on ServiceClient

    Add fluent api to create HttpRe… Fix Stylecop errors Remove dead code and 3 more (compare)

  • Mar 29 2018 13:11

    Ruhrpottpatriot on NetCore2.0

    Remove disabled and superseded … Delete unused leftover code fro… Move V1.Guild test to appropria… and 8 more (compare)

  • Mar 29 2018 12:17

    Ruhrpottpatriot on NetCore2.0

    Update .gitignore to exclude St… Add Api builder class (compare)

  • Feb 01 2018 09:33

    Ruhrpottpatriot on master

    Refactorize ServiceClient.GetHt… Merge pull request #57 from Kor… (compare)

  • Feb 01 2018 09:33
    Ruhrpottpatriot closed #57
  • Dec 27 2017 17:37
    Korjam opened #57
Steven Liekens
@StevenLiekens
ok
Darnell Williams
@Seeker1437

My next question I guess it regarding the converters

for example

with a simple object like this

this would instead be the MoneyDTO

the money class with then have the real documentation in it

I would not need to convert anything with this

However I am in charge of how ToString returns the value based of the currency

using Newtonsoft.Json;

namespace SquareConnect.V1.Types
{
    /// <summary>
    /// Represents an amount of money.
    /// </summary>
    public class Money
    {
        public Money(int amount, string currencyCode = "USD")
        {
            Amount = amount;
            CurrencyCode = currencyCode;
        }

        /// <summary>
        /// The amount of money, in the smallest unit of the applicable currency. For US dollars, this value is in cents. This value is always an integer.
        /// </summary>
        [JsonProperty("amount")]
        public int Amount { get; set; }

        /// <summary>
        /// The type of currency involved in the current payment. The currency code for US dollars is USD.
        /// </summary>
        [JsonProperty("currency_code")]
        public string CurrencyCode { get; set; }
    }
}
Steven Liekens
@StevenLiekens
was that the question? :)
Darnell Williams
@Seeker1437
in the case where a user could do new Money() the converters also handle converting from Money to MoneyDTO when being sent or would it be handled differently
sorry this is the question x3
Steven Liekens
@StevenLiekens
I'd handle it the same way
Darnell Williams
@Seeker1437

when I was playing with the v2/account endpoint I wrote a micro library to just pull minute details from it

using Newtonsoft.Json;


namespace DangerBot.GW2.V2.Account.Objects
{
    /// <summary>This class describes a player account.</summary>
    public class Account
    {
        /// <summary>Gets or sets the accounts id.</summary>
        [JsonProperty("id")]
        public string Id { get; set; }

        /// <summary>Gets or sets the guild ids the character is in.</summary>
        [JsonProperty("guilds")]
        public string[] Guilds { get; set; }
    }
}

when I wanted to pull information about it I did

using DangerBot.GW2.V2.Account.Rest;
using System.Threading.Tasks;

namespace DangerBot.GW2.V2.Account.Client
{
    public partial class GW2ClientReduced
    {
        public async Task<Objects.Account> GetAccountAsync()
        {
            RestRequest restRequest = _client.Create("v2/account");

            RestResponse<Objects.Account> restResponse = await restRequest.ExecuteGet<Objects.Account>().ConfigureAwait(false);

            Objects.Account account = await restResponse.GetDataObject().ConfigureAwait(false);

            return account;
        }
    }
}

in practice:

var service = GW2.V1.Guilds;
 var guild = service.FindByName("The Zone of Danger");

// Too lazy to convert v2 responce to GUID...
var guildId = guild.GuildId.ToString().ToUpper();

var gw2CustomClient = new GW2ClientReduced(e.GetArg("api-key"));

var account = await gw2CustomClient.GetAccountAsync();

if (account.Guilds.Contains(guildId))
{
    // blah
}
Steven Liekens
@StevenLiekens
oh jeez please don't use restsharp :D
it's actually really bad
Darnell Williams
@Seeker1437
it's actually my own torn down version x3
Steven Liekens
@StevenLiekens
you forked restsharp?
Darnell Williams
@Seeker1437
not exactly, I got the flow of it and just wrote a reduced but functional version
it's just 3 classes and an enum now
normally images show :O
Darnell Williams
@Seeker1437
I noticed in one of the issues you expressed that you guys use WebRequest/Response I was curious of the use of that over an Http (Request/Response) Message
Steven Liekens
@StevenLiekens
same difference?
I don't understand the question :)
Darnell Williams
@Seeker1437
It's basically the upgraded version of HttpWebRequest
Steven Liekens
@StevenLiekens
what is
Darnell Williams
@Seeker1437
HttpRequestMessage
Steven Liekens
@StevenLiekens
that's part of the HttpClient API
Darnell Williams
@Seeker1437
Hmm I think it's very weird :(
Steven Liekens
@StevenLiekens
what is?
Darnell Williams
@Seeker1437

System.Web.Http

System.Net.Http

the idea of there being basically similar things in different namespaces

Steven Liekens
@StevenLiekens
that's because one is for ASP.NET and the other is for all purposes
avoid System.Web if you're not creating a web application
by web app I mean website
Darnell Williams
@Seeker1437
Right, like ASP.NET style stuff
Steven Liekens
@StevenLiekens
yea
Darnell Williams
@Seeker1437
gottcha sorry for the offtopicness
shurne
@SamHurne
Oh man that moment when you look at your old code and ask yourself "wtf was I thinking, this is so bad..."
Steven Liekens
@StevenLiekens
It's a really cool app though
And I've seen much worse
Written much worse, too 😂
Darnell Williams
@Seeker1437
hehe XD
Robert Logiewa
@Ruhrpottpatriot
@/all Sorry, for not writing anything in the last month or so. Preparation for exams, which come up the next three weeks have been particular stressfull this semester. But I looked at the current HttpClient branch and saw that it's nearly finished. There are some bugs to iron out, but nothing major. So if anyone is interested, he can take over.
Some things to note: Converter structure has been left almost entirely intact, so nothing to do here and I don't want to touch it until we got the underlying system robust enough. I have some ideas how we can throw most of the code out of the window. Most of it deals with JSON.Net (there's really no reason anymore, to not use it as default) and it's internal parser (it uses Attributes, which @StevenLiekens doesn't like, but if it makes better code, I'm willing to use it).
The new repository structure is entirely the same for "standard" api endpoint layout, so a user only has to implement two interfaces and he's done. For anything else there needs to be a custom interface describing the layout. That should be put into core obviously.
That's it basically. I'll try to read more often here, so if there are questions just ask.
Steven Liekens
@StevenLiekens
I'm in the middle of getting a new job
I don't have the motivation to work on it right now
Maybe things get better in my new job
Robert Logiewa
@Ruhrpottpatriot
It's ok, but when playing with the new .NET Standard, I saw that it doesn't support embedded ressources, so we have to think of a new way to support events.
Darnell Williams
@Seeker1437
Oooh...
Why .netstandard?
Robert Logiewa
@Ruhrpottpatriot
Currently we are using PCL to make GW2.NET available to as many users as possible, but .netstandard, or the thing replacing .netstandard, whose name I forgot, is replacing PCL, therefore we are migrating to it
after we implemented HTTP client ofc
Darnell Williams
@Seeker1437
oh .net core?
Robert Logiewa
@Ruhrpottpatriot
yeah, that