package octokit

import (
	"github.com/lostisland/go-sawyer"
	"net/url"
)

type M map[string]interface{}

type Hyperlink string

// TODO: find out a way to not wrapping sawyer.Hyperlink like this
func (l *Hyperlink) Expand(m M) (u *url.URL, err error) {
	link := sawyer.Hyperlink(string(*l))
	sawyerM := sawyer.M{}
	for k, v := range m {
		sawyerM[k] = v
	}

	u, err = link.Expand(sawyerM)
	return
}

package octokit

import (
	"github.com/jtacoma/uritemplates"
	"net/url"
)

// TODO: use sawyer.Hyperlink

type M map[string]interface{}

type Hyperlink string

func (l *Hyperlink) Expand(m M) (u *url.URL, err error) {
	template, e := uritemplates.Parse(string(*l))
	if e != nil {
		err = e
		return
	}

	expanded, e := template.Expand(m)
	if e != nil {
		err = e
		return
	}

	u, err = url.Parse(expanded)
	return
}

Revert "Use sawyer.Hyperlink and sawyer.M"
Revert "Use sawyer.Hyperlink and sawyer.M"

This reverts commit 52f030c42273e3a38543e1148d047523bd7fff0a.
