alelogo

package module
v0.0.0-...-30ca52d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2017 License: MIT Imports: 7 Imported by: 1

README

alelo-go Build Status SayThanks.io

An unofficial Alelo API implementation to get Card's balances.

import (
  "log"

  "github.com/caarlos0/alelogo"
)

func main() {
  cpf := "123456789-10"
  pwd := "s3cr3t"
  client, err := alelogo.New(cpf, pwd)
	if err != nil {
		log.Fatalln(err.Error())
	}
	cards, err := client.Cards()
	if err != nil {
		log.Fatalln(err.Error())
	}
	for _, card := range cards {
		result, err := client.Details(card)
		if err != nil {
			log.Fatalln(err.Error())
		}
		log.Println(result)
	}
}

Why?

Because I hate their Android app. So I hacked their website to see how it works, created this lib and then used it to create a Telegram bot, so I can finally uninstall that piece of crappy software.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	BaseURL: "https://www.meualelo.com.br/meualelo.services/rest",
	Timeout: 30,
}

DefaultConfig for the client

View Source
var ErrAuth = errors.New("Authentication failure")

ErrAuth happens on authentication failures

View Source
var ErrDumbass = errors.New("Random shit happened within Alelo API, try again")

ErrDumbass happens when random shit happens

Functions

This section is empty.

Types

type Card

type Card struct {
	ID    string `json:"cardId"`
	Title string `json:"title"`
}

Card type

type CardDetails

type CardDetails struct {
	Balance string `json:"balance"`
	Name    string `json:"productName"`
	Type    string `json:"cardType"`
	Number  string `json:"maskedNumber"`
}

CardDetails type

type Client

type Client struct {
	http.Client
	BaseURL string
}

Client for Alelo API

func New

func New(cpf, pwd string, configs ...Config) (*Client, error)

New client with defaults

func (*Client) Cards

func (client *Client) Cards() (cards []Card, err error)

Cards get the user card's balances

func (*Client) Details

func (client *Client) Details(card Card) (CardDetails, error)

Details of a card, including balance

type Config

type Config struct {
	BaseURL string
	Timeout int
}

Config of the client

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL