Implement ExtraInt method

Implements `ExtraInt` as per #51
It's tedious to check type and cast, therefore we provided the helper
function for the string values. The package should be as agnostic as
possible about the underlying protocol details, therefore I'd prefer to
provide an ExtraFloat rather than exporting the raw field and document it.

Historically, no one asked more advanced features around the extra fields
such as the support for the complex objects, etc. I don't want to populate
the exported interfaces by exporting the raw field.

Andrew had an alternative suggestion to cast the numeric values back to
strings.

On Wed, Nov 12, 2014 at 11:45 AM, Mal Curtis <notifications@github.com>
wrote:

> In transport.go:
>
> > +
> > +	raw, ok := t.raw.(map[string]interface{})
> > +	if !ok {
> > +		return 0
> > +	}
> > +
> > +	val, ok := raw[key]
> > +	if !ok {
> > +		return 0
> > +	}
> > +
> > +	switch val.(type) {
> > +	case int:
> > +		return val.(int)
> > +	case float64:
> > +		return int(val.(float64))
>
> At what point does it just become easier to export the raw field and just
> let people deal with the data however they want? Excuse the question if
> it's already been answered as I'm sure there's a reason for providing the
> helper methods!!
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/golang/oauth2/pull/52/files#r20193815>.
>



-- 
Burcu Dogan