<|start_filename|>like.go<|end_filename|>
package tindergo

import (
	"encoding/json"
	"errors"
	"fmt"
)

type LikeResponse struct {
	Match          bool `json:"match,omitempty"`
	LikesRemaining int  `json:"likes_remaining,omitempty"`
	Status         int  `json:"status,omitempty"`
}

func (t *TinderGo) Decide(user RecsCoreUser, action string) (LikeResponse, error) {
	like := LikeResponse{}
	url := "https://api.gotinder.com/%s/%s?content_hash=%s&s_number=%s"
	url = fmt.Sprintf(url, action, user.ID, user.ContentHash, user.SNumber)
	b, errs := t.requester.Get(url)
	if errs != nil {
		return like, errs[0]
	}

	err := json.Unmarshal([]byte(b), &like)
	if err != nil {
		return like, err
	}

	if like.Status != 200 && like.Status != 0 {
		return like, errors.New("Error saving like.")
	}

	return like, nil
}

func (t *TinderGo) Like(user RecsCoreUser) (LikeResponse, error) {
	return t.Decide(user, "like")
}

func (t *TinderGo) Pass(user RecsCoreUser) (LikeResponse, error) {
	return t.Decide(user, "pass")
}


<|start_filename|>tindergo.go<|end_filename|>
package tindergo

type TinderGo struct {
	auth      TAuthResponseData
	requester *TRequest
}

func New() *TinderGo {
	return &TinderGo{}
}

func (t *TinderGo) Authenticate(token string) error {
	a := NewTAuth(token)
	auth, err := a.Send()
	if err != nil {
		return err
	}
	t.auth = auth

	r := NewTRequest(t.auth.APIToken)
	t.requester = r

	return nil
}


<|start_filename|>example/test.go<|end_filename|>
package main

import (
	"fmt"
	"os"

	"github.com/disiqueira/tindergo"
)

func main() {

	t := tindergo.New()

	err := t.Authenticate(token)
	if err != nil {
		panic(err)
	}

	recs, err := t.RecsCore()
	if err != nil {
		panic(err)
	}

	for _, r := range recs {
		u, _ := t.User(r.ID)
		fmt.Println(u.Name)
		fmt.Println(u.Bio)
		os.Exit(2)
	}
}
