These are chat archives for Ruhrpottpatriot/GW2.NET

7th
Oct 2015
Steven Liekens
@StevenLiekens
Oct 07 2015 08:16
there's a fix scheduled for nuget 3.3.0 that fixes our crashing nuget pack script
NuGet/Home#1514
which is nice
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 11:42
good
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:19
@StevenLiekens You got any idea, how I could implement parameters in the HttpRequestMessage properly?
Steven Liekens
@StevenLiekens
Oct 07 2015 14:28
yeah
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:31
Btw:
is there a reason for explicit interface implementations in the repositories?
MS discourages it
Steven Liekens
@StevenLiekens
Oct 07 2015 14:31
not really
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:32
ok
Steven Liekens
@StevenLiekens
Oct 07 2015 14:32
yea
make them implicit
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:32
I'm currently at the ColorsRepository
I'll make them implicit and remove the synchronous methods
Steven Liekens
@StevenLiekens
Oct 07 2015 14:32
sounds good
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:33
uhhh the routedata interface is cool
Steven Liekens
@StevenLiekens
Oct 07 2015 14:34
we can use that extension method, right?
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:34
lemme check
Steven Liekens
@StevenLiekens
Oct 07 2015 14:35
it looks like a System.Web thing
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:36
it's in the System.Web.Http namespace
seems it's not there
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:41
seems it's only available in the webApi package
Steven Liekens
@StevenLiekens
Oct 07 2015 14:50
I'm not sure then
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:50
I'll write and extension method then
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:50
Or doe somethiong different
since as of now I'm not using the request classes, and would lkike to keep it that way
Steven Liekens
@StevenLiekens
Oct 07 2015 14:51
seems odd that they want you to build your own query strings
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:52
yeah
that seems off to me, too
Steven Liekens
@StevenLiekens
Oct 07 2015 14:52
remember there's a UrlEncodedForm class that does that
in the core lib
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:52
i thought of that too
huh, there is a Properties property on the HttpRequestMessage
but the doc only says
Gets a set of properties for the HTTP request.
Steven Liekens
@StevenLiekens
Oct 07 2015 14:55
lol xD
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:55
yeah
Steven Liekens
@StevenLiekens
Oct 07 2015 14:55
better than Gets or sets {insert text here}
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:55
seems we have to build the request Uri for ourselves
Steven Liekens
@StevenLiekens
Oct 07 2015 14:56
maybe they improved the docs in corefx
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 14:56
i don't think so :P
yeah no
not useful at all
I can't even find where it's used in the code
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 15:01
yeah
you know
2290038.jpg
Steven Liekens
@StevenLiekens
Oct 07 2015 15:03
I'm cloning corefx
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 15:04
and improve documentation?
:smile:
Steven Liekens
@StevenLiekens
Oct 07 2015 15:04
maybe
no I just want to find references to HttpRequestMessage.Properties
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 15:04
yeah
can you check if HttpRequestMessageExtensions.SetRouteData Method exists and if that code would work for us?
Steven Liekens
@StevenLiekens
Oct 07 2015 15:14
I think the way it's used is that you use Properties as a bag of named values that you can process in a custom handler
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 15:14
ah
Steven Liekens
@StevenLiekens
Oct 07 2015 15:14
because Properties is not used in the framework itself
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 15:14
ok
If I understood you correctly, I just have to create an UrlEncodedForm and call GetQueryString to get the parameter string?
Steven Liekens
@StevenLiekens
Oct 07 2015 15:18
yep
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 15:57
oh god, this is sooo horrible
public async Task<ICollectionPage<ColorPalette>> FindPageAsync(int pageIndex, CancellationToken cancellationToken)
        {
            UrlEncodedForm formData = new UrlEncodedForm
            {
                { "lang", this.Culture.TwoLetterISOLanguageName },
                { "page", pageIndex.ToString() }
            };

            var request = new HttpRequestMessage(HttpMethod.Get, new Uri("v2/colors" + formData, UriKind.Relative));
            var response = await this.httpClient.SendAsync(request, cancellationToken).ConfigureAwait(false);
            return await this.pageResponseConverter.ConvertAsync(response, cancellationToken);
        }
well I'll think of something better later on
Steven Liekens
@StevenLiekens
Oct 07 2015 18:32
I don't think it's horrible
Robert Logiewa
@Ruhrpottpatriot
Oct 07 2015 18:32
yes, because I ahve it in every method and use magic string
I'll try to get something more compile safe