isupipe

package
v0.0.0-...-8f6afdc Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCancelRequest = errors.New("ベンチマーク走行が継続できないエラーが発生しました")

Functions

func ValidateResponse

func ValidateResponse(req *http.Request, response interface{}) error

func ValidateSlice

func ValidateSlice(req *http.Request, slice interface{}) error

Types

type Client

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

Client は、ISUPipeに対するHTTPクライアントです NOTE: スレッドセーフではありません NOTE: ログインは一度しかできません (何回もログインする場合はClientを個別に作り直す必要がある)

func NewClient

func NewClient(contestantLogger *zap.Logger, customOpts ...agent.AgentOption) (*Client, error)

func NewCustomResolverClient

func NewCustomResolverClient(contestantLogger *zap.Logger, dnsResolver *resolver.DNSResolver, customOpts ...agent.AgentOption) (*Client, error)

NewClient は、HTTPクライアント群を初期化します NOTE: キャッシュ無効化オプションなどを指定すると、意図しない挙動をする可能性があります タイムアウトやURLなどの振る舞いでないパラメータを指定するのにcustomOptsを用いてください

func (*Client) EnterLivestream

func (c *Client) EnterLivestream(ctx context.Context, livestreamID int64, streamerName string, opts ...ClientOption) error

func (*Client) ExitLivestream

func (c *Client) ExitLivestream(ctx context.Context, livestreamID int64, streamerName string, opts ...ClientOption) error

func (*Client) GetIcon

func (c *Client) GetIcon(ctx context.Context, username string, opts ...ClientOption) ([]byte, error)

func (*Client) GetLivecommentReports

func (c *Client) GetLivecommentReports(ctx context.Context, livestreamID int64, streamerName string, opts ...ClientOption) ([]LivecommentReport, error)

func (*Client) GetLivecomments

func (c *Client) GetLivecomments(ctx context.Context, livestreamID int64, streamerName string, opts ...ClientOption) ([]*Livecomment, error)

func (*Client) GetLivestream

func (c *Client) GetLivestream(
	ctx context.Context,
	livestreamID int64,
	streamerName string,
	opts ...ClientOption,
) (*Livestream, error)

func (*Client) GetLivestreamStatistics

func (c *Client) GetLivestreamStatistics(ctx context.Context, livestreamID int64, streamerName string, opts ...ClientOption) (*LivestreamStatistics, error)

func (*Client) GetMe

func (c *Client) GetMe(ctx context.Context, opts ...ClientOption) (*User, error)

func (*Client) GetMyIcon

func (c *Client) GetMyIcon(ctx context.Context, opts ...ClientOption) ([]byte, error)

func (*Client) GetMyLivestreams

func (c *Client) GetMyLivestreams(ctx context.Context, opts ...ClientOption) ([]*Livestream, error)

自分のライブ配信一覧取得

func (*Client) GetNgwords

func (c *Client) GetNgwords(ctx context.Context, livestreamID int64, streamerName string, opts ...ClientOption) ([]*NGWord, error)

func (*Client) GetPaymentResult

func (c *Client) GetPaymentResult(ctx context.Context) (*PaymentResult, error)

func (*Client) GetRandomLivestreamTags

func (c *Client) GetRandomLivestreamTags(ctx context.Context, n int) ([]int64, error)

func (*Client) GetRandomSearchTags

func (c *Client) GetRandomSearchTags(ctx context.Context, n int) ([]string, error)

func (*Client) GetReactions

func (c *Client) GetReactions(ctx context.Context, livestreamID int64, streamerName string, opts ...ClientOption) ([]Reaction, error)

func (*Client) GetStreamerTheme

func (c *Client) GetStreamerTheme(ctx context.Context, streamer *User, opts ...ClientOption) (*Theme, error)

func (*Client) GetTags

func (c *Client) GetTags(ctx context.Context, opts ...ClientOption) (*TagsResponse, error)

func (*Client) GetTagsWithUser

func (c *Client) GetTagsWithUser(ctx context.Context, streamerName string, opts ...ClientOption) (*TagsResponse, error)

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, username string, opts ...ClientOption) (*User, error)

func (*Client) GetUserLivestreams

func (c *Client) GetUserLivestreams(ctx context.Context, username string, opts ...ClientOption) ([]*Livestream, error)

特定ユーザのライブ配信取得

func (*Client) GetUserStatistics

func (c *Client) GetUserStatistics(ctx context.Context, username string, opts ...ClientOption) (*UserStatistics, error)

func (*Client) Initialize

func (c *Client) Initialize(ctx context.Context) (*InitializeResponse, error)

func (*Client) Login

func (c *Client) Login(ctx context.Context, r *LoginRequest, opts ...ClientOption) error

ログインを行う. NOTE: ログイン後はログインユーザとして振る舞うので、各種agentやユーザ名、人気ユーザであるかの判定フラグなどの情報もここで確定する

func (*Client) Moderate

func (c *Client) Moderate(ctx context.Context, livestreamID int64, streamerName string, ngWord string, opts ...ClientOption) error

func (*Client) PostIcon

func (c *Client) PostIcon(ctx context.Context, r *PostIconRequest, opts ...ClientOption) (*PostIconResponse, error)

func (*Client) PostLivecomment

func (c *Client) PostLivecomment(ctx context.Context, livestreamID int64, streamerName string, comment string, tip *scheduler.Tip, opts ...ClientOption) (*PostLivecommentResponse, int, error)

func (*Client) PostReaction

func (c *Client) PostReaction(ctx context.Context, livestreamID int64, streamerName string, r *PostReactionRequest, opts ...ClientOption) (*Reaction, error)

func (*Client) Register

func (c *Client) Register(ctx context.Context, r *RegisterRequest, opts ...ClientOption) (*User, error)

func (*Client) ReportLivecomment

func (c *Client) ReportLivecomment(ctx context.Context, livestreamID int64, streamerName string, livecommentID int64, opts ...ClientOption) error

func (*Client) ReserveLivestream

func (c *Client) ReserveLivestream(ctx context.Context, streamerName string, r *ReserveLivestreamRequest, opts ...ClientOption) (*Livestream, error)

func (*Client) SearchLivestreams

func (c *Client) SearchLivestreams(
	ctx context.Context,
	opts ...ClientOption,
) ([]*Livestream, error)

func (*Client) Username

func (c *Client) Username() (string, error)

type ClientOption

type ClientOption func(o *ClientOptions)

func WithETag

func WithETag(eTag string) ClientOption

func WithLimitQueryParam

func WithLimitQueryParam(limit int) ClientOption

func WithSearchTagQueryParam

func WithSearchTagQueryParam(tag string) ClientOption

func WithStatusCode

func WithStatusCode(statusCode int) ClientOption

func WithValidateReportLivecomment

func WithValidateReportLivecomment() ClientOption

type ClientOptions

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

type ClientPool

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

ClientPool は、ログイン後のクライアントプールです

func NewClientPool

func NewClientPool(ctx context.Context) *ClientPool

func (*ClientPool) Get

func (p *ClientPool) Get(ctx context.Context) (*Client, error)

func (*ClientPool) Put

func (p *ClientPool) Put(ctx context.Context, c *Client)

type InitializeResponse

type InitializeResponse struct {
	Language string `json:"language" validate:"required"`
}

type LimitParam

type LimitParam struct {
	Limit int
}

type Livecomment

type Livecomment struct {
	ID         int64      `json:"id" validate:"required"`
	User       User       `json:"user" validate:"required"`
	Livestream Livestream `json:"livestream" validate:"required"`
	Comment    string     `json:"comment" validate:"required"`
	// NOTE: Tipがない場合が許容される(tip=0)
	Tip       int `json:"tip"`
	CreatedAt int `json:"created_at" validate:"required"`
}

type LivecommentPool

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

func NewLivecommentPool

func NewLivecommentPool(ctx context.Context) *LivecommentPool

func (*LivecommentPool) Get

func (*LivecommentPool) Put

func (p *LivecommentPool) Put(ctx context.Context, livecomment *Livecomment)

type LivecommentReport

type LivecommentReport struct {
	ID          int64       `json:"id" validate:"required"`
	Reporter    User        `json:"reporter" validate:"required"`
	Livecomment Livecomment `json:"livecomment" validate:"required"`
	CreatedAt   int64       `json:"created_at" validate:"required"`
}

type Livestream

type Livestream struct {
	ID           int64  `json:"id" validate:"required"`
	Owner        User   `json:"owner" validate:"required"`
	Tags         []Tag  `json:"tags" validate:"required,dive,required"`
	Title        string `json:"title" validate:"required"`
	Description  string `json:"description" validate:"required"`
	PlaylistUrl  string `json:"playlist_url" validate:"required"`
	ThumbnailUrl string `json:"thumbnail_url" validate:"required"`
	StartAt      int64  `json:"start_at" validate:"required"`
	EndAt        int64  `json:"end_at" validate:"required"`
}

func (*Livestream) Hours

func (l *Livestream) Hours() int

type LivestreamPool

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

LivestreamPool は、予約後のライブ配信プールです

func NewLivestreamPool

func NewLivestreamPool(ctx context.Context) *LivestreamPool

func (*LivestreamPool) Get

func (p *LivestreamPool) Get(ctx context.Context) (*Livestream, error)

func (*LivestreamPool) Put

func (p *LivestreamPool) Put(ctx context.Context, livestream *Livestream)

type LivestreamStatistics

type LivestreamStatistics struct {
	Rank           int64 `json:"rank" validate:"required"`
	ViewersCount   int64 `json:"viewers_count"`
	TotalReactions int64 `json:"total_reactions"`
	TotalReports   int64 `json:"total_reports"`
	MaxTip         int64 `json:"max_tip"`
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	// Password is non-hashed password.
	Password string `json:"password"`
}

type ModerateRequest

type ModerateRequest struct {
	NGWord string `json:"ng_word"`
}

type ModerateResponse

type ModerateResponse struct {
	WordID int64 `json:"word_id" validate:"required"`
}

type NGWord

type NGWord struct {
	ID           int64  `json:"id" validate:"required"`
	UserID       int64  `json:"user_id" validate:"required"`
	LivestreamID int64  `json:"livestream_id" validate:"required"`
	Word         string `json:"word" validate:"required"`
	CreatedAt    int64  `json:"created_at" validate:"required"`
}

type PaymentResult

type PaymentResult struct {
	// NOTE: 売上0を許容
	TotalTip int64 `json:"total_tip"`
}

type PostIconRequest

type PostIconRequest struct {
	Image []byte `json:"image"`
}

type PostIconResponse

type PostIconResponse struct {
	ID int64 `json:"id" validate:"required"`
}

type PostLivecommentRequest

type PostLivecommentRequest struct {
	Comment string `json:"comment"`
	Tip     int64  `json:"tip"`
}

type PostLivecommentResponse

type PostLivecommentResponse struct {
	ID         int64      `json:"id" validate:"required"`
	User       User       `json:"user" validate:"required"`
	Livestream Livestream `json:"livestream" validate:"required"`
	Comment    string     `json:"comment" validate:"required"`
	Tip        int64      `json:"tip"`
	CreatedAt  int64      `json:"created_at" validate:"required"`
}

type PostReactionRequest

type PostReactionRequest struct {
	EmojiName string `json:"emoji_name"`
}

type Reaction

type Reaction struct {
	ID         int64      `json:"id" validate:"required"`
	EmojiName  string     `json:"emoji_name" validate:"required"`
	User       User       `json:"user" validate:"required"`
	Livestream Livestream `json:"livestream" validate:"required"`
	CreatedAt  int64      `json:"created_at" validate:"required"`
}

type RegisterRequest

type RegisterRequest struct {
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	Description string `json:"description"`
	// Password is non-hashed password.
	Password string `json:"password"`
	Theme    Theme  `json:"theme"`
}

type ReserveLivestreamRequest

type ReserveLivestreamRequest struct {
	Tags         []int64 `json:"tags"`
	Title        string  `json:"title"`
	Description  string  `json:"description"`
	PlaylistUrl  string  `json:"playlist_url"`
	ThumbnailUrl string  `json:"thumbnail_url"`
	StartAt      int64   `json:"start_at"`
	EndAt        int64   `json:"end_at"`
}

type SearchTagParam

type SearchTagParam struct {
	Tag string
}

type Tag

type Tag struct {
	ID   int64  `json:"id" validate:"required"`
	Name string `json:"name" validate:"required"`
}

type TagsResponse

type TagsResponse struct {
	Tags []*Tag `json:"tags" validate:"required,dive,required"`
}

type Theme

type Theme struct {
	DarkMode bool `json:"dark_mode"`
}

type User

type User struct {
	ID          int64  `json:"id" validate:"required"`
	Name        string `json:"name" validate:"required"`
	DisplayName string `json:"display_name" validate:"required"`
	Description string `json:"description" validate:"required"`
	// NOTE: themeはboolのフィールドにアクセスすることしかないので、validate対象外
	Theme    Theme  `json:"theme"`
	IconHash string `json:"icon_hash" validate:"required"`
}

type UserStatistics

type UserStatistics struct {
	Rank              int64 `json:"rank" validate:"required"`
	ViewersCount      int64 `json:"viewers_count"`
	TotalReactions    int64 `json:"total_reactions"`
	TotalLivecomments int64 `json:"total_livecomments"`
	TotalTip          int64 `json:"total_tip"`
	// NOTE: リアクション投稿がない場合、空文字になるのでvalidate対象外
	FavoriteEmoji string `json:"favorite_emoji"`
}

Jump to

Keyboard shortcuts

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