ddtvgo

package module
v0.0.0-...-b2ede80 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

README

ddtvgo

GitHub license GitHub go.mod Go version GitHub tag (latest SemVer) GoDoc Go Report Card wakatime

ddtvgo - Go API/SDK for DDTV

Feature

  • API调用方式
  • Web接口方式
  • Util函数
  • UI界面(在另一个库)

Usage

1. API调用


appg := &ddtvgo.App{AccessKeyId: AccessKeyId, AccessKeySecret: AccessKeySecret, APISite: APISite}
r, err := appg.RunCmd(ddtvgo.System_Info)
fmt.Println(string(r.([]byte)))
if err != nil {
    fmt.Println(err)
}

//开发中

2. Web接口

//开发中

3. Util函数 懒人专用

//开发中

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RqSystem_Info               = NewRequest("System_Info", Post, JSON)
	RqSystem_Config             = NewRequest("System_Config", Post, JSON)
	RqSystem_Resources          = NewRequest("System_Resources", Post, JSON)
	RqSystem_QueryWebFirstStart = NewRequest("System_QueryWebFirstStart", Post, JSON)
	RqSystem_QueryUserState     = NewRequest("System_QueryUserState", Post, JSON)

	RqConfig_Transcod  = NewRequest("Config_Transcod", Post, JSON)
	RqConfig_FileSplit = NewRequest("Config_FileSplit", Post, JSON)
	RqConfig_DanmuRec  = NewRequest("Config_DanmuRec", Post, JSON)
	RqConfig_GetFollow = NewRequest("Config_GetFollow", Post, JSON)

	RqFile_GetAllFileList  = NewRequest("File_GetAllFileList", Post, JSON)
	RqFile_GetTypeFileList = NewRequest("File_GetTypeFileList", Post, JSON)
	RqFile_GetFilePathList = NewRequest("File_GetFilePathList", Post, JSON)

	RqLogin = NewRequest("Login", Post, JSON)
	//RqLoginqr     = NewRequest("loginqr", Get, PNG)
	RqLogin_Reset = NewRequest("Login_Reset", Post, JSON)
	RqLogin_State = NewRequest("Login_State", Post, JSON)

	RqRec_RecordingInfo            = NewRequest("Rec_RecordingInfo", Post, JSON)
	RqRec_RecordingInfo_Lite       = NewRequest("Rec_RecordingInfo_Lite", Post, JSON)
	RqRec_RecordCompleteInfon      = NewRequest("Rec_RecordCompleteInfon", Post, JSON)
	RqRec_RecordCompleteInfon_Lite = NewRequest("Rec_RecordCompleteInfon_Lite", Post, JSON)
	RqRec_CancelDownload           = NewRequest("Rec_CancelDownload", Post, JSON)

	RqRoom_AllInfo     = NewRequest("Room_AllInfo", Post, JSON)
	RqRoom_SummaryInfo = NewRequest("Room_SummaryInfo", Post, JSON)
	RqRoom_Add         = NewRequest("Room_Add", Post, JSON)
	RqRoom_Del         = NewRequest("Room_Del", Post, JSON)
	RqRoom_AutoRec     = NewRequest("Room_AutoRec", Post, JSON)
	RqRoom_DanmuRec    = NewRequest("Room_DanmuRec", Post, JSON)

	RqUser_Search = NewRequest("User_Search", Post, JSON)
)

Functions

func GetFullURL

func GetFullURL(app App, request Request) string

func JsonIo2Text

func JsonIo2Text(bt io.ReadCloser) ([]byte, error)

func PostC

func PostC(request *Request) (*http.Response, error)

func SHA1

func SHA1(s string) string

SHA1 Get SHA1

Types

type App

type App struct {
	AccessKeyId     string // = "***************************"
	AccessKeySecret string //= "****************************"
	APISite         string //= "http://**************:11419"
}

func (*App) RunCmd

func (a *App) RunCmd(request *Request) (interface{}, error)

type Data

type Data struct {
	DDTVCoreVer  string       `json:"DDTVCore_Ver"`
	RoomQuantity int64        `json:"Room_Quantity"`
	ServerName   string       `json:"ServerName"`
	ServerAID    string       `json:"ServerAID"`
	OSInfo       OSInfo       `json:"os_Info"`
	DownloadInfo DownloadInfo `json:"download_Info"`
}

type DownloadInfo

type DownloadInfo struct {
	Downloading        int64 `json:"Downloading"`
	CompletedDownloads int64 `json:"Completed_Downloads"`
}

type ErrCode

type ErrCode int
const (
	CodeSuccess      ErrCode = 0
	CodeNoUID        ErrCode = -2
	CodeLoginInvalid ErrCode = 6000
	CodeLoginFail    ErrCode = 6001
	CodeSigFail      ErrCode = 6002
	CodeFailure      ErrCode = 700
)

func (ErrCode) ToString

func (e ErrCode) ToString() string
type Header struct {
	Time        int64  `json:"time,omitempty"`
	Cmd         string `json:"cmd,omitempty"`
	Sig         string `json:"sig,omitempty"`
	Accesskeyid string `json:"accesskeyid,omitempty"`
}

func UnmarshalHeader

func UnmarshalHeader(data []byte) (Header, error)

func (*Header) Marshal

func (r *Header) Marshal() ([]byte, error)

type OSInfo

type OSInfo struct {
	OSVer            string `json:"OS_Ver"`
	OSTpye           string `json:"OS_Tpye"`
	MemoryUsage      int64  `json:"Memory_Usage"`
	RuntimeVer       string `json:"Runtime_Ver"`
	UserInteractive  bool   `json:"UserInteractive"`
	AssociatedUsers  string `json:"Associated_Users"`
	CurrentDirectory string `json:"Current_Directory"`
	AppCoreVer       string `json:"AppCore_Ver"`
	WebCoreVer       string `json:"WebCore_Ver"`
}

type Request

type Request struct {
	Name              string
	Header            *Header
	RequestMode       RequestMode
	RequestReturnType RequestReturnType
	Url               string
}

Request 请求结构

func NewRequest

func NewRequest(name string, requestMode RequestMode, returnType RequestReturnType) *Request

type RequestMode

type RequestMode int
const (
	Post RequestMode = 1
	Get  RequestMode = 2
)

func (RequestMode) ToString

func (e RequestMode) ToString() string

type RequestReturnType

type RequestReturnType int
const (
	JSON      RequestReturnType = 1
	PNG       RequestReturnType = 2
	FileStram RequestReturnType = 3
)

func (RequestReturnType) ToString

func (e RequestReturnType) ToString() string

type RpSystemInfo

type RpSystemInfo struct {
	Code    int64  `json:"code"`
	Cmd     string `json:"cmd"`
	Massage string `json:"massage"`
	Data    Data   `json:"data"`
}

func UnmarshalRpSystemInfo

func UnmarshalRpSystemInfo(data []byte) (RpSystemInfo, error)

func (*RpSystemInfo) Marshal

func (r *RpSystemInfo) Marshal() ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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