Skip to content

Birjemin/douyuapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

斗鱼-api

Build Status Go Report Card codecov

开发者中心

引入方式

go get github.com/birjemin/douyuapi

接口列表

使用方式

  • 示例
httpClient := &utils.HTTPClient{
    Client: &http.Client{
        Timeout: 5 * time.Second,
    },
}

token := &Token{
    BaseClient: BaseClient{
        Client: httpClient,
        Secret: "test-secret",
        AID:    "test-aid",
    },
}

timestamp := cast.ToString(utils.GetCurrTime())
if ret, err := token.Handle(timestamp); err != nil {
    // handle err
} else {
    if ret.Code != 0 {
        // handle err
    }
    // get ret.Data.Token
}

live := &Live{
    BaseClient: BaseClient{
        Client: httpClient,
        Secret: "test-secret",
        AID:    "test-aid",
    },
    Token: "test-token",
}

msg := `{"cid_type":1,"cid":1,"limit":10,"offset":0}`

if ret, err := live.Handle(msg, cast.ToString(timestamp)); err != nil {
    // handle err
} else {
    if ret.Code != 0 {
        // handle err
    }
    // handle
}

备注

后续会补足新接口