chocolateclashgoapi

package module
v0.0.0-...-1a7c262 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: MIT Imports: 9 Imported by: 1

README

Chocolate Clash Go API

Unofficial API of chocolateclash.com for farming clans looking to automate clan moderation and management based on tracked results on the website.

Documentation

Index

Constants

View Source
const (
	FWALeague   = "fwa"
	OtherLeague = "cc"
)

Variables

View Source
var (
	ErrUnknownLeague     = errors.New("unknown league")
	ErrFailedToFixWarPid = errors.New("failed to fix war pid issue")
)

Functions

This section is empty.

Types

type API

type API struct {
	BaseUrl        string
	CollyCollector *colly.Collector
}

func Init

func Init(league string) (*API, error)

Initilize choclateclash api by selecting an appropriate league

func (*API) FixWarPid

func (api *API) FixWarPid(tag string, actions_count int, war_attacks_count int) error

func (*API) GetMember

func (api *API) GetMember(tag string, actions_count int, war_attacks_count int, fix_errors bool) (*Member, error)

Get member details

type Action

type Action struct {
	Timestamp string `json:"timestamp"`
	Action    string `json:"action"`
	Clan      Clan   `json:"clan"`
}

type Attack

type Attack struct {
	Timestamp    string  `json:"timestamp"`
	Information  string  `json:"information"`
	Color        *string `json:"color"`
	MemberOnClan *Clan   `json:"memberOnClan"`
	OpponentClan *Clan   `json:"opponentClan"`
	FixWarPid    bool    `json:"fixWarPid"`
	FixWarPidUrl *string `json:"fixWarPidUrl"`
}

type Clan

type Clan struct {
	Tag    string `json:"tag"`
	Name   string `json:"name"`
	League string `json:"league"`
	Url    string `json:"url"`
}

type Member

type Member struct {
	Tag               string   `json:"tag"`
	Name              string   `json:"name"`
	Synchronized      bool     `json:"synchronized"`
	InGameUrl         string   `json:"inGameUrl"`
	Donations         int      `json:"donations"`
	DonationsReceived int      `json:"donationsReceived"`
	TownHallLevel     int      `json:"townHallLevel"`
	Role              string   `json:"role"`
	Clan              Clan     `json:"clan"`
	Actions           []Action `json:"actions"`
	Attacks           []Attack `json:"attacks"`
	Notes             []Note   `json:"notes"`
}

type Note

type Note struct {
	Timestamp string `json:"timestamp"`
	Note      string `json:"note"`
	Author    string `json:"author"`
}

Jump to

Keyboard shortcuts

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