1234567891011121314151617181920212223242526272829303132333435363738 |
- package isapi
- import (
- "encoding/xml"
- "github.com/sirupsen/logrus"
- )
- type ChannelEventCapList struct {
- ChannelEventCap []ChannelEventCap `xml:"ChannelEventCap" json:"channelEventCap"`
- }
- type ChannelEventCap struct {
- EventType struct {
- Opt string `xml:"opt,attr" json:"opt"`
- } `xml:"eventType" json:"eventType"`
- ChannelID string `xml:"channelID" json:"channelID"`
- ID string `xml:"id" json:"ID"`
- }
- func (c *Client) GetAllChanEventCap() (resp ChannelEventCapList, err error) {
- bytes, err := c.CommonGet("/ISAPI/Event/channels/capabilities")
- if err != nil {
- logrus.Error("请求出错", err)
- return
- }
- err = xml.Unmarshal(bytes, &resp)
- return
- }
- func (c *Client) GetOneChanEventCap() (resp ChannelEventCap, err error) {
- bytes, err := c.CommonGet("/ISAPI/Event/channels/1/capabilities")
- if err != nil {
- logrus.Error("请求出错", err)
- return
- }
- err = xml.Unmarshal(bytes, &resp)
- return
- }
|