openhome

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArchiveStatusAll      = "all"
	ArchiveStatusIsPubing = "is_pubing"
	ArchiveStatusPubed    = "pubed"
	ArchiveStatusNotPubed = "not_pubed"
)
View Source
const (
	UploadUTypeSmallFile = 0
	UploadUTypePart      = 1
)
View Source
const (
	ScopesUserinfo          = "USER_INFO"           // 用户信息能力 可获取用户公开信息, 默认开启
	ScopesUserdata          = "USER_DATA"           // 用户数据权限 可用于查询用户的关注数、粉丝数、投稿数
	ScopesArcBase           = "ARC_BASE"            // 视频稿件基础能力 支持稿件的发布、编辑、查询和删除功能
	ScopesArcData           = "ARC_DATA"            // 视频稿件数据权限 可用于查询视频稿件的播放数、点赞数、评论数、弹幕数等相关数据
	ScopesAtcBase           = "ATC_BASE"            // 专栏稿件管理能力 支持专栏稿件(文章和文集)的发布、编辑、查询和删除功能
	ScopesAtcData           = "ATC_DATA"            // 专栏稿件数据权限 可用于查询专栏稿件的阅读数、点赞数、评论数、收藏数等相关数据
	ScopesUserActivity      = "USER_ACTIVITY"       // 活动数据权限 授权并使用您的活动数据 (包括任务和奖励),用于第三方进行奖励发放
	ScopesShopStoreInfo     = "SHOP_STORE_INFO"     // 服务市场店铺信息 授权第三方获得您的店铺基本信息(店铺名称、店铺头像、shop_id)
	ScopesShopOrderInfo     = "SHOP_ORDER_INFO"     // 服务市场订单信息 授权第三方获得您服务市场店铺的订单数据
	ScopesShopCommodityInfo = "SHOP_COMMODITY_INFO" // 服务市场商品信息 授权第三方获取您服务市场店铺的商品数据
	ScopesLiveRoomData      = "LIVE_ROOM_DATA"      // 直播内容数据权限 用于授权第三方获得直播间基本信息(基本信息、开播状态)、直播间弹幕消息相关数据
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"` // 过期时间
	RefreshToken string `json:"refresh_token"`
}

func (AccessToken) IsExpired

func (at AccessToken) IsExpired() bool

type AccountInfoResp

type AccountInfoResp struct {
	Name   string `json:"name"`
	Face   string `json:"face"`
	Openid string `json:"openid"`
}

type AccountScopesResp

type AccountScopesResp struct {
	Scopes []string `json:"scopes"`
	Openid string   `json:"openid"`
}

type AppClient

type AppClient struct {
	OAuth   *OAuth
	User    *User
	Live    *Live
	Archive *Archive
	// contains filtered or unexported fields
}

func NewAppClient

func NewAppClient(cfg *AppConfig) *AppClient

type AppConfig

type AppConfig struct {
	ClientID     string `json:"client_id"`     // 应用id
	ClientSecret string `json:"client_secret"` // 应用密钥
}

type ArcIncStatsResp

type ArcIncStatsResp struct {
	IncClick int `json:"inc_click"`
	IncDm    int `json:"inc_dm"`
	IcnReply int `json:"icn_reply"`
	IncFav   int `json:"inc_fav"`
	IncCoin  int `json:"inc_coin"`
	IncShare int `json:"inc_share"`
	IncLike  int `json:"inc_like"`
	IncElec  int `json:"inc_elec"`
}

type ArcStatResp

type ArcStatResp struct {
	View     int `json:"view"`
	Danmaku  int `json:"danmaku"`
	Reply    int `json:"reply"`
	Favorite int `json:"favorite"`
	Coin     int `json:"coin"`
	Share    int `json:"share"`
	Like     int `json:"like"`
}

type Archive

type Archive basicService

func (*Archive) Delete

func (a *Archive) Delete(accessToken, resourceID string) error

func (*Archive) Edit

func (a *Archive) Edit(accessToken string, req ArchiveEditReq) (*ArchiveEditResp, error)

func (*Archive) Submit

func (a *Archive) Submit(accessToken, uploadToken string, req ArchiveSubmitReq) (*ArchiveSubmitResp, error)

Submit 提交稿件 调用该接口完成稿件投递 调用此接口前需要保证视频/封面上传完成 稿件提交之后会存在审核过程,期间不对外开放 非正式会员单日最多投递5个稿件,可在主站通过答题转为正式会员解除限制

func (*Archive) TypeList

func (a *Archive) TypeList(accessToken string) (*ArchiveTypeListResp, error)

func (*Archive) UploadComplete

func (a *Archive) UploadComplete(uploadToken string) error

func (*Archive) UploadCover

func (a *Archive) UploadCover(accessToken string, fileReader io.Reader) (*ArchiveUploadCoverResp, error)

func (*Archive) UploadInit

func (a *Archive) UploadInit(accessToken string, req UploadInitReq) (*UploadInitResp, error)

func (*Archive) UploadPart

func (a *Archive) UploadPart(uploadToken string, partNumber int, fileReader io.Reader) error

func (*Archive) View

func (a *Archive) View(accessToken, resourceID string) (*ArchiveViewResp, error)

func (*Archive) ViewList

func (a *Archive) ViewList(accessToken string, req ArchiveViewListReq) (*ArchiveViewListResp, error)

type ArchiveEditReq

type ArchiveEditReq struct {
	ResourceID string `json:"resource_id"`
	Title      string `json:"title"`
	Cover      string `json:"cover"`
	Tid        int    `json:"tid"`
	Desc       string `json:"desc"`
	NoReprint  int    `json:"no_reprint"`
}

type ArchiveEditResp

type ArchiveEditResp struct {
	ResourceID string `json:"resource_id"`
}

type ArchiveSubmitReq

type ArchiveSubmitReq struct {
	//Mid       int    `json:"mid"`
	Title     string `json:"title"`      // 稿件标题,长度小于80,短时间内标题不能相同
	Cover     string `json:"cover"`      // 封面地址,必须由上传封面接口得到
	Tid       int    `json:"tid"`        // 分区id,由获取分区信息接口得到
	Tag       string `json:"tag"`        // 视频标签,多个标签用英文逗号分隔,总长度小于200
	Desc      string `json:"desc"`       // 视频描述,长度小于250
	Copyright int    `json:"copyright"`  // 1-原创,2-转载(转载时source必填)
	Source    string `json:"source"`     // 如果copyright为转载,则此字段表示转载来源
	NoReprint int    `json:"no_reprint"` // 是否允许转载 0-允许,1-不允许。默认0
	TopicID   int    `json:"topic_id"`   // 参加的话题ID,默认情况下不填写,需要填写和运营联系
}

type ArchiveSubmitResp

type ArchiveSubmitResp struct {
	ResourceID string `json:"resource_id"`
}

type ArchiveType

type ArchiveType struct {
	ID          int    `json:"id"`
	Parent      int    `json:"parent"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type ArchiveTypeListResp

type ArchiveTypeListResp struct {
	ArchiveType
	Children []*ArchiveType `json:"children"`
}

type ArchiveUploadCoverResp

type ArchiveUploadCoverResp struct {
	Url string `json:"url"`
}

type ArchiveViewListReq

type ArchiveViewListReq struct {
	PageNumber int    `json:"pn"`
	PageSize   int    `json:"ps"`
	Status     string `json:"status"`
}

type ArchiveViewListResp

type ArchiveViewListResp struct {
	Page PageResp           `json:"page"`
	List []*ArchiveViewResp `json:"list"`
}

func (ArchiveViewListResp) IsEmpty

func (l ArchiveViewListResp) IsEmpty() bool

type ArchiveViewResp

type ArchiveViewResp struct {
	ResourceID string `json:"resource_id"`
	Title      string `json:"title"`
	Cover      string `json:"cover"`
	Tid        int    `json:"tid"`
	NoReprint  int    `json:"no_reprint"`
	Desc       string `json:"desc"`
	Tag        string `json:"tag"`
	Copyright  int    `json:"copyright"`
	Ctime      int    `json:"ctime"`
	Ptime      int    `json:"ptime"`
	VideoInfo  struct {
		Cid       interface{} `json:"cid"`
		Filename  string      `json:"filename"`
		Duration  int         `json:"duration"`
		ShareUrl  string      `json:"share_url"`
		IframeUrl string      `json:"iframe_url"`
	} `json:"video_info"`
	AdditInfo struct {
		State        int    `json:"state"`
		StateDesc    string `json:"state_desc"`
		RejectReason string `json:"reject_reason"`
	} `json:"addit_info"`
}

type ArtIncStatsResp

type ArtIncStatsResp struct {
	IncReply int `json:"inc_reply"`
	IncRead  int `json:"inc_read"`
	IncFav   int `json:"inc_fav"`
	IncLikes int `json:"inc_likes"`
	IncShare int `json:"inc_share"`
	IncCoin  int `json:"inc_coin"`
}

type ArtStartData

type ArtStartData struct {
	ID       int `json:"id"`
	Category struct {
		ID       int    `json:"id"`
		ParentID int    `json:"parent_id"`
		Name     string `json:"name"`
	} `json:"category"`
	Title       string   `json:"title"`
	Summary     string   `json:"summary"`
	BannerUrl   string   `json:"banner_url"`
	TemplateID  int      `json:"template_id"`
	State       int      `json:"state"`
	ImageUrls   []string `json:"image_urls"`
	PublishTime int      `json:"publish_time"`
	Ctime       int      `json:"ctime"`
	Stats       struct {
		View     int `json:"view"`
		Favorite int `json:"favorite"`
		Like     int `json:"like"`
		Dislike  int `json:"dislike"`
		Reply    int `json:"reply"`
		Share    int `json:"share"`
		Coin     int `json:"coin"`
	} `json:"stats"`
	Reason string `json:"reason"`
	Words  int    `json:"words"`
	List   struct {
		ID          int    `json:"id"`
		Name        string `json:"name"`
		ImageUrl    string `json:"image_url"`
		UpdateTime  int    `json:"update_time"`
		Ctime       int    `json:"ctime"`
		PublishTime int    `json:"publish_time"`
		Summary     string `json:"summary"`
		Words       int    `json:"words"`
	} `json:"list"`
	TopVideoBvid string `json:"top_video_bvid"`
}

type ArtStatResp

type ArtStatResp map[string]ArtStartData

type BaseResp

type BaseResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Ttl     int    `json:"ttl"`
	Data    interface{}
}

func NewBaseResp

func NewBaseResp(data interface{}) *BaseResp

func (*BaseResp) IsSuccess

func (b *BaseResp) IsSuccess() bool

type Code2AccessTokenResp

type Code2AccessTokenResp struct {
	AccessToken
	Scopes []string `json:"scopes"`
}

type Data

type Data basicService

func (*Data) ArcIncStats

func (d *Data) ArcIncStats(accessToken string) (*ArcIncStatsResp, error)

func (*Data) ArcStat

func (d *Data) ArcStat(accessToken, resourceID string) (*ArcStatResp, error)

func (*Data) ArtIncStats

func (d *Data) ArtIncStats(accessToken string) (*ArtIncStatsResp, error)

func (*Data) ArtStat

func (d *Data) ArtStat(accessToken string, ids []string) (*ArtStatResp, error)

func (*Data) UserStat

func (d *Data) UserStat(accessToken string) (*UserStatResp, error)

type Live

type Live basicService

func (*Live) GetRoomInfo

func (l *Live) GetRoomInfo(accessToken string) (*RoomInfoResp, error)

func (*Live) WsBatchHeartbeat

func (l *Live) WsBatchHeartbeat(accessToken string, connIDs ...string) (*WsBatchHeartbeatResp, error)

func (*Live) WsHeartbeat

func (l *Live) WsHeartbeat(accessToken, connID string) error

func (*Live) WsStart

func (l *Live) WsStart(accessToken string) (*WsStartResp, error)

type OAuth

type OAuth basicService

func (*OAuth) Code2AccessToken

func (o *OAuth) Code2AccessToken(code string) (*Code2AccessTokenResp, error)

func (*OAuth) GetOAuthGenerator

func (o *OAuth) GetOAuthGenerator() *OAuthGenerator

func (*OAuth) RefreshToken

func (o *OAuth) RefreshToken(refreshToken string) (*RefreshTokenResp, error)

type OAuthGenerator

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

func (*OAuthGenerator) GenerateAuthorizationURL

func (og *OAuthGenerator) GenerateAuthorizationURL() string

func (*OAuthGenerator) GetState

func (og *OAuthGenerator) GetState() string

func (*OAuthGenerator) WithCallbackURL

func (og *OAuthGenerator) WithCallbackURL(callbackURL string) *OAuthGenerator

func (*OAuthGenerator) WithEnableMobileUI

func (og *OAuthGenerator) WithEnableMobileUI() *OAuthGenerator

func (*OAuthGenerator) WithState

func (og *OAuthGenerator) WithState(state string) *OAuthGenerator

type PageResp

type PageResp struct {
	PageNumber int `json:"pn"`
	PageSize   int `json:"ps"`
	Total      int `json:"total"`
}

type RefreshTokenResp

type RefreshTokenResp struct {
	AccessToken
}

type RoomInfoResp

type RoomInfoResp struct {
	Openid      string `json:"open_id"`
	RoomID      int    `json:"room_id"`
	Title       string `json:"title"`        // 直播标题
	IsStreaming bool   `json:"is_streaming"` // 当前是否开播
	IsBanned    bool   `json:"is_banned"`    // 房间是否被封禁
}

func (RoomInfoResp) IsNotEnable

func (ri RoomInfoResp) IsNotEnable() bool

type UploadInitReq

type UploadInitReq struct {
	Name  string `json:"name"`
	UType int    `json:"utype"`
}

func NewUploadInitReq

func NewUploadInitReq(name string) UploadInitReq

func (UploadInitReq) WithUType

func (ui UploadInitReq) WithUType(uType int) UploadInitReq

type UploadInitResp

type UploadInitResp struct {
	UploadToken string `json:"upload_token"`
}

type User

type User basicService

func (*User) GetAccountInfo

func (u *User) GetAccountInfo(accessToken string) (*AccountInfoResp, error)

func (*User) GetAccountScopes

func (u *User) GetAccountScopes(accessToken string) (*AccountScopesResp, error)

type UserStatResp

type UserStatResp struct {
	Following      int `json:"following"`
	Follower       int `json:"follower"`
	ArcPassedTotal int `json:"arc_passed_total"`
}

type WsBatchHeartbeatResp

type WsBatchHeartbeatResp struct {
	FailedConnIds []string `json:"failed_conn_ids"`
}

type WsStartResp

type WsStartResp struct {
	ConnID        string `json:"conn_id"`
	WebsocketInfo struct {
		AuthBody string   `json:"auth_body"`
		WssLink  []string `json:"wss_link"`
	} `json:"websocket_info"`
}

func (*WsStartResp) GetAuthBody

func (wr *WsStartResp) GetAuthBody() []byte
func (wr *WsStartResp) GetLinks() []string

Jump to

Keyboard shortcuts

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