ikaring

package module
v0.0.0-...-001bae5 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2018 License: MIT Imports: 16 Imported by: 0

README

ikaring

this is a cli client for SplatNet with golang

the official service "SplatNet" was closed and this application no longer available.

Usage

getting stage schedules

$ ikaring stage

ScreenShot

getting ranking

$ ikaring rank

Install

go get github.com/cad-san/ikaring/cmd/ikaring

License

MIT

Documentation

Overview

Package ikaring provides http client Api for SplatNet; web service for Splatoon by Nintendo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Festival

type Festival struct {
	TimeSpan
	TeamA  string  `json:"team_alpha_name"` // Name of Team A
	TeamB  string  `json:"team_bravo_name"` // Name of Team B
	Stages []Stage `json:"stages"`          // Stage Set
}

Festival is a rule set in Festival

func (Festival) String

func (s Festival) String() string

type FestivalScore

type FestivalScore struct {
	PlayerScore
	Top100 bool
}

FestivalScore has player info for festival ranking

type Friend

type Friend struct {
	Player
	Online    bool
	Mode      PlayMode
	Intention Intention
}

Friend has infomation in FriendList

type IkaClient

type IkaClient struct {
	BaseURL *url.URL    // Splatnet Domain URL
	AuthURL *url.URL    // Nintendo Network OAUTH URL
	Logger  *log.Logger // Logger
	// contains filtered or unexported fields
}

IkaClient is a http client for SplatNet. it includes http.Client.

func CreateClient

func CreateClient() (*IkaClient, error)

CreateClient generates ikaClient, http client object for Splatnet. It provides a http client with empty cookiejar.

func (*IkaClient) Authorized

func (c *IkaClient) Authorized() bool

Authorized judges wheather the client authorized It checks cookies for session that used for authorization

func (*IkaClient) GetFriendList

func (c *IkaClient) GetFriendList(ctx context.Context) ([]Friend, error)

GetFriendList get Friend List form SplatNet. this API send GET request and parse friend online status from JSON

func (*IkaClient) GetRanking

func (c *IkaClient) GetRanking(ctx context.Context) (*RankingInfo, error)

GetRanking get Ranking of Friends from SplatNet. this API send GET request and parse ranking from JSON.

func (*IkaClient) GetStageInfo

func (c *IkaClient) GetStageInfo(ctx context.Context) (*StageInfo, error)

GetStageInfo get Stage Info from SplatNet. this API send GET request and parse stage schedules from JSON.

func (*IkaClient) GetWeaponMap

func (c *IkaClient) GetWeaponMap(ctx context.Context) (map[string]string, error)

GetWeaponMap get Weapon Set from SplatNet. this API send GET request and parse weapon map by scraping HTML

func (*IkaClient) Login

func (c *IkaClient) Login(ctx context.Context, name string, password string) (string, error)

Login sends http request to authorize Nintendo Network. it require NNID and password and return session cookie.

func (*IkaClient) SetSession

func (c *IkaClient) SetSession(session string)

SetSession sets session cookie to receiver IkaClient.

type Intention

type Intention struct {
	ID       *string
	ImageURL *string `json:"image"`
}

Intention is stasus of friend's recruitment for playing

type PlayMode

type PlayMode string

PlayMode indicates mode that friend plays with splatoon.

func (PlayMode) String

func (m PlayMode) String() string

type Player

type Player struct {
	ID     string `json:"hashed_id"`
	Name   string `json:"mii_name"`
	MiiURL string `json:"mii_url"`
	Weapon string
}

Player has player info.

type PlayerScore

type PlayerScore struct {
	Player
	Rank  int
	Score int
}

PlayerScore has player info for ranking

func (*PlayerScore) UnmarshalJSON

func (p *PlayerScore) UnmarshalJSON(b []byte) error

UnmarshalJSON parse JSON for PlayerScore for SplatNet Ranking.

type RankingInfo

type RankingInfo struct {
	Regular  []PlayerScore
	Gachi    []PlayerScore
	Festival []FestivalScore
}

RankingInfo has ranking for Regular Match and Gachi Match

type Regulation

type Regulation struct {
	Regular []Stage // stage set for Regular Match
	Gachi   []Stage // stage set for Gatch Match
}

Regulation is buttle regulation for Regular Match & Gachi Match. It includes stage set.

type Schedule

type Schedule struct {
	TimeSpan
	Stages    Regulation `json:"stages"`     // Stage Set
	GachiRule string     `json:"gachi_rule"` // rule for Gatch Match
}

Schedule is a rule set for normal day. It has time span, stage set, and gachi rule.

func (Schedule) String

func (s Schedule) String() string

type Stage

type Stage struct {
	Name  string `json:"name"`       // stage name
	Image string `json:"asset_path"` // url for stage image
}

Stage has stage infomation.

type StageInfo

type StageInfo struct {
	Festival     bool        // during the festival
	Schedules    *[]Schedule // Schedule info for normal day(nil in festival)
	FesSchedules *[]Festival // Schedule info for festival(nil in normal day)
}

StageInfo is all set of Stage Schedules.

type TimeSpan

type TimeSpan struct {
	TimeBegin time.Time `json:"datetime_begin"` // Start Time
	TimeEnd   time.Time `json:"datetime_end"`   // End Time
}

TimeSpan is a period for Buttle regulation

func (TimeSpan) String

func (t TimeSpan) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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