chii

package
v0.0.0-...-4efca02 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StatusCode = map[int]string{
	200:   "OK",
	202:   "Accepted",
	304:   "Not Modified",
	30401: "Not Modified: Collection already exists",

	400:   "Bad Request",
	40001: "Error: Nothing found with that ID",

	401:   "Unauthorized",
	40101: "Error: Auth failed over 5 times",
	40102: "Error: Username is not an Email address",

	404: "Not Found",
	405: "Method Not Allowed",
}

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Message string `json:"error"`
	Code    int    `json:"code"`
}

func (APIError) Empty

func (e APIError) Empty() bool

Empty returns true if empty. FIXME:(everpcpc)

func (APIError) Error

func (e APIError) Error() string

type Alias

type Alias struct {
	JP     string `json:"jp,omitempty"`
	Romaji string `json:"romaji,omitempty"`
	ZH     string `json:"zh,omitempty"`
	Kana   string `json:"kana,omitempty"`
}

type Client

type Client struct {
	Subject *SubjectService
	Episode *EpisodeService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client) *Client

func NewClientWithAuth

func NewClientWithAuth(httpClient *http.Client, clientID, token string) *Client

type Collection

type Collection struct {
	Wish    int `json:"wish"`
	Collect int `json:"collect"`
	Doing   int `json:"doing"`
	OnHold  int `json:"on_hold"`
	Dropped int `json:"dropped"`
}

type CollectionType

type CollectionType string
const (
	CollectionTypeWatching    CollectionType = "watching"     // 在看的动画与三次元条目
	CollectionTypeAllWatching CollectionType = "all_watching" // 在看的动画三次元与书籍条目
)

type CollectionsStatus

type CollectionsStatus string
const (
	CollectionsStatusWish    CollectionsStatus = "wish"
	CollectionsStatusCollect CollectionsStatus = "collect"
	CollectionsStatusDo      CollectionsStatus = "do"
	CollectionsStatusOnHold  CollectionsStatus = "on_hold"
	CollectionsStatusDropped CollectionsStatus = "dropped"
)

type EpisodeDetail

type EpisodeDetail struct {
	ID int `json:"id"`

	/// 0 本篇,1 SP,2 OP,3 ED
	Type EpisodeType `json:"type"`

	Name   string `json:"name"`
	NameCN string `json:"name_cn"`

	/// 同类条目的排序和集数
	Sort int `json:"sort"`

	/// 条目内的集数, 从1开始。非本篇剧集的此字段无意义
	Ep int `json:"ep,omitempty"`

	Airdate  string `json:"airdate"`
	Comment  int    `json:"comment"`
	Duration string `json:"duration"`

	/// 简介
	Desc string `json:"desc"`

	/// 音乐曲目的碟片数
	Disc int `json:"disc"`

	SubjectID int `json:"subject_id"`
}

type EpisodeService

type EpisodeService struct {
	// contains filtered or unexported fields
}

func (*EpisodeService) Get

type EpisodeStatus

type EpisodeStatus string
const (
	EpisodeStatusEpWatched EpisodeStatus = "watched"
	EpisodeStatusEpQueue   EpisodeStatus = "queue"
	EpisodeStatusEpDrop    EpisodeStatus = "drop"
	EpisodeStatusEpRemove  EpisodeStatus = "remove"
)

type EpisodeType

type EpisodeType int
const (
	EpisodeTypeBase EpisodeType = iota
	EpisodeTypeSP
	EpisodeTypeOP
	EpisodeTypeED
)

type Images

type Images struct {
	Large  string `json:"large,omitempty"`
	Common string `json:"common,omitempty"`
	Medium string `json:"medium,omitempty"`
	Small  string `json:"small,omitempty"`
	Grid   string `json:"grid,omitempty"`
}

type Info

type Info struct {
	Birth  string `json:"birth,omitempty"`
	Height string `json:"height,omitempty"`
	Gender string `json:"gender,omitempty"`
	Alias  Alias  `json:"alias,omitempty"`

	// FIXME: some times string https://github.com/bangumi/api/issues/16
	Source  []string `json:"source,omitempty"`
	NameCN  string   `json:"name_cn,omitempty"`
	CV      string   `json:"cv,omitempty"`
	Twitter string   `json:"twitter,omitempty"`
}

Info represents a person/character info

type Infobox

type Infobox struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
}

type Rating

type Rating struct {
	Rank  int         `json:"rank"`
	Total int         `json:"total"`
	Count RatingCount `json:"count"`
	Score float64     `json:"score"`
}

type RatingCount

type RatingCount struct {
	One   int `json:"1"`
	Two   int `json:"2"`
	Three int `json:"3"`
	Four  int `json:"4"`
	Five  int `json:"5"`
	Six   int `json:"6"`
	Seven int `json:"7"`
	Eight int `json:"8"`
	Nine  int `json:"9"`
	Ten   int `json:"10"`
}

type ResponseGroup

type ResponseGroup string
const (
	ResponseSmall  ResponseGroup = "small"
	ResponseMediam ResponseGroup = "mediam"
	ResponseLarge  ResponseGroup = "large"
)

type Subject

type Subject struct {
	ID      int         `json:"id"`
	Type    SubjectType `json:"type"`
	Name    string      `json:"name"`
	NameCN  string      `json:"name_cn"`
	Summary string      `json:"summary"`
	NSFW    bool        `json:"nsfw"`
	Locked  bool        `json:"locked"`

	/// air date in YYYY-MM-DD format
	Date string `json:"date,omitempty"`

	/// TV, Web, 欧美剧, PS4...
	Platform string `json:"platform"`

	Images  Images    `json:"images,omitempty"`
	Infobox []Infobox `json:"infobox,omitempty"`

	/// 书籍条目的册数,由旧服务端从wiki中解析
	Volumes int `json:"volumes"`

	/// 由旧服务端从wiki中解析,对于书籍条目为话数
	Eps int `json:"eps"`

	/// 数据库中的章节数量
	TotalEpisodes int `json:"total_episodes"`

	Rating     Rating     `json:"rating"`
	Collection Collection `json:"collection"`
	Tags       []Tag      `json:"tags"`
}

type SubjectService

type SubjectService struct {
	// contains filtered or unexported fields
}

func (*SubjectService) Get

func (s *SubjectService) Get(id int) (Subject, *http.Response, error)

type SubjectType

type SubjectType int
const (
	SubjectTypeNil SubjectType = iota
	SubjectTypeBook
	SubjectTypeAnime
	SubjectTypeMusic
	SubjectTypeGame
	SubjectTypeReserved
	SubjectTypeReal
)

type Tag

type Tag struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

Jump to

Keyboard shortcuts

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