You need to enable JavaScript to run this app.
导航
数据统计
最近更新时间:2024.09.29 17:41:41首次发布时间:2022.05.13 17:10:55

本文为您提供了服务端 Go SDK 的数据统计模块的接口调用示例。

前提条件

调用接口前,请先完成 SDK 的安装初始化

调用示例

查询带宽用量

接口请求参数和返回参数详见 OpenAPI:查询带宽用量

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_DescribeVodDomainBandwidthData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.VodDescribeVodDomainBandwidthDataRequest{
                DomainList:        "your DomainList",
                DomainInSpaceList: "your DomainInSpaceList",
                StartTime:         "your StartTime",
                EndTime:           "your EndTime",
                Aggregation:       0,
                BandwidthType:     "your BandwidthType",
                Area:              "your Area",
                RegionList:        "your RegionList",
        }

        resp, status, err := instance.DescribeVodDomainBandwidthData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

查询流量用量

接口请求参数和返回参数详见 OpenAPI:查询流量用量

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_DescribeVodDomainTrafficData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.VodDescribeVodDomainTrafficDataRequest{
                DomainList:        "your DomainList",
                DomainInSpaceList: "your DomainInSpaceList",
                StartTime:         "your StartTime",
                EndTime:           "your EndTime",
                Aggregation:       0,
                TrafficType:       "your TrafficType",
                Area:              "your Area",
                RegionList:        "your RegionList",
        }

        resp, status, err := instance.DescribeVodDomainTrafficData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

查询存储用量

接口请求参数和返回参数详见 OpenAPI:查询存储用量

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_DescribeVodSpaceStorageData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.VodDescribeVodSpaceStorageDataRequest{
                SpaceList:   "your SpaceList",
                StartTime:   "your StartTime",
                EndTime:     "your EndTime",
                Aggregation: 0,
                Type:        "your Type",
                RegionList:  "your RegionList",
        }

        resp, status, err := instance.DescribeVodSpaceStorageData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

查询转码用量

接口请求参数和返回参数详见 OpenAPI:查询转码用量

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_DescribeVodSpaceTranscodeData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.DescribeVodSpaceTranscodeDataRequest{
                SpaceList:       "your SpaceList",
                StartTime:       "your StartTime",
                EndTime:         "your EndTime",
                TranscodeType:   "your TranscodeType",
                Specification:   "your Specification",
                TaskStageList:   "your TaskStageList",
                Aggregation:     0,
                DetailFieldList: "your DetailFieldList",
                RegionList:      "your RegionList",
        }

        resp, status, err := instance.DescribeVodSpaceTranscodeData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

查询截图用量

接口请求参数和返回参数详见 OpenAPI:查询截图用量

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_DescribeVodSnapshotData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.DescribeVodSnapshotDataRequest{
                SpaceList:       "your SpaceList",
                StartTime:       "your StartTime",
                EndTime:         "your EndTime",
                SnapshotType:    "your SnapshotType",
                TaskStageList:   "your TaskStageList",
                Aggregation:     0,
                DetailFieldList: "your DetailFieldList",
                RegionList:      "your RegionList",
        }

        resp, status, err := instance.DescribeVodSnapshotData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

查询画质增强用量

接口请求参数和返回参数详见 OpenAPI:查询画质增强用量

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_DescribeVodEnhanceImageData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.DescribeVodEnhanceImageDataRequest{
                SpaceList:     "your SpaceList",
                StartTime:     "your StartTime",
                EndTime:       "your EndTime",
                TaskTypeList:  "your TaskTypeList",
                TaskStageList: "your TaskStageList",
                Aggregation:   0,
                RegionList:    "your RegionList",
        }

        resp, status, err := instance.DescribeVodEnhanceImageData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

查询检测修复用量

接口请求参数和返回参数详见 OpenAPI:查询检测修复用量

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_DescribeVodSpaceDetectStatisData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.DescribeVodSpaceDetectStatisDataRequest{
                SpaceList:       "your SpaceList",
                StartTime:       "your StartTime",
                EndTime:         "your EndTime",
                DetectType:      "your DetectType",
                TaskStageList:   "your TaskStageList",
                Aggregation:     0,
                DetailFieldList: "your DetailFieldList",
        }

        resp, status, err := instance.DescribeVodSpaceDetectStatisData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

查询多媒体 AI 用量

接口请求参数和返回参数详见 OpenAPI:查询多媒体 AI 用量

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_DescribeVodSpaceAIStatisData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.DescribeVodSpaceAIStatisDataRequest{
                SpaceList:       "your SpaceList",
                StartTime:       "your StartTime",
                EndTime:         "your EndTime",
                MediaAiType:     "your MediaAiType",
                TaskStageList:   "your TaskStageList",
                Aggregation:     0,
                DetailFieldList: "your DetailFieldList",
        }

        resp, status, err := instance.DescribeVodSpaceAIStatisData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

查询智能字幕用量

接口请求参数和返回参数详见 OpenAPI:查询智能字幕用量

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_DescribeVodSpaceSubtitleStatisData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.DescribeVodSpaceSubtitleStatisDataRequest{
                SpaceList:       "your SpaceList",
                StartTime:       "your StartTime",
                EndTime:         "your EndTime",
                SubtitleType:    "your SubtitleType",
                TaskStageList:   "your TaskStageList",
                Aggregation:     0,
                DetailFieldList: "your DetailFieldList",
        }

        resp, status, err := instance.DescribeVodSpaceSubtitleStatisData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

查询视频剪辑用量

接口请求参数和返回参数详见 OpenAPI:查询视频剪辑用量

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_DescribeVodSpaceEditStatisData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.DescribeVodSpaceEditStatisDataRequest{
                SpaceList:       "your SpaceList",
                StartTime:       "your StartTime",
                EndTime:         "your EndTime",
                Specification:   "your Specification",
                Aggregation:     0,
                DetailFieldList: "your DetailFieldList",
        }

        resp, status, err := instance.DescribeVodSpaceEditStatisData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

查询转码详细数据

接口请求参数和返回参数详见 OpenAPI:查询转码详细数据

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_DescribeVodSpaceWorkflowDetailData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.DescribeVodSpaceWorkflowDetailDataRequest{
                Region:    "your Region",
                Space:     "your Space",
                StartTime: "your StartTime",
                EndTime:   "your EndTime",
                PageSize:  0,
                PageNum:   0,
        }

        resp, status, err := instance.DescribeVodSpaceWorkflowDetailData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

查询视频剪辑详细数据

接口请求参数和返回参数详见 OpenAPI:查询视频剪辑详细数据

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)


func Test_DescribeVodSpaceEditDetailData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.DescribeVodSpaceEditDetailDataRequest{
                Region:    "your Region",
                Space:     "your Space",
                StartTime: "your StartTime",
                EndTime:   "your EndTime",
                PageSize:  0,
                PageNum:   0,
        }

        resp, status, err := instance.DescribeVodSpaceEditDetailData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

获取带宽流量

接口请求参数和返回参数详见 OpenAPI:获取带宽流量

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_ListCdnUsageData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.VodListCdnUsageDataRequest{
                Domains:        "your Domains",
                Interval:       "your Interval",
                StartTimestamp: 0,
                EndTimestamp:   0,
                DataType:       "your DataType",
                Metric:         "your Metric",
                NeedDetail:     false,
                Area:           "your Area",
                Region:         "your Region",
                Isp:            "your Isp",
                Protocol:       "your Protocol",
                IpVersion:      "your IpVersion",
                BillingRegion:  "your BillingRegion",
        }

        resp, status, err := instance.ListCdnUsageData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

获取请求数

接口请求参数和返回参数详见 OpenAPI:获取请求数

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_ListCdnPvData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.VodListCdnPvDataRequest{
                Domains:        "your Domains",
                Interval:       "your Interval",
                StartTimestamp: 0,
                EndTimestamp:   0,
                DataType:       "your DataType",
        }

        resp, status, err := instance.ListCdnPvData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

获取状态码

接口请求参数和返回参数详见 OpenAPI:获取状态码

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_ListCdnStatusData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()
 
        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.VodListCdnStatusDataRequest{
                Domains:        "your Domains",
                Interval:       "your Interval",
                StartTimestamp: 0,
                EndTimestamp:   0,
                DataType:       "your DataType",
                Metric:         "your Metric",
        }

        resp, status, err := instance.ListCdnStatusData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

获取命中率

接口请求参数和返回参数详见 OpenAPI:获取命中率

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_ListCdnHitrateData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()
        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})
         
        query := &request.VodListCdnHitrateDataRequest{
                Domains:        "your Domains",
                Interval:       "your Interval",
                StartTimestamp: 0,
                EndTimestamp:   0,
                Metric:         "your Metric",
                NeedDetail:     false,
        }

        resp, status, err := instance.ListCdnHitrateData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

获取热点 URL 统计

接口请求参数和返回参数详见 OpenAPI:获取热点 URL 统计

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_ListCdnTopAccessUrl(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.VodListCdnTopAccessUrlRequest{
                Domains:        "your Domains",
                StartTimestamp: 0,
                EndTimestamp:   0,
                SortType:       "your SortType",
        }

        resp, status, err := instance.ListCdnTopAccessUrl(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

获取热点统计数据

接口请求参数和返回参数详见 OpenAPI:获取热点统计数据

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_ListCdnTopAccess(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.VodListCdnTopAccessRequest{
                Domains:        "your Domains",
                StartTimestamp: 0,
                EndTimestamp:   0,
                SortType:       "your SortType",
                Item:           "your Item",
        }

        resp, status, err := instance.ListCdnTopAccess(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

查询视频播放信息

接口请求参数和返回参数详见 OpenAPI:查询视频播放信息

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_DescribeVodPlayedStatisData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.DescribeVodPlayedStatisDataRequest{
                Space:     "your Space",
                StartTime: "your StartTime",
                EndTime:   "your EndTime",
                VidList:   "your VidList",
                OrderType: "your OrderType",
        }

        resp, status, err := instance.DescribeVodPlayedStatisData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}

查询播放 TopN 的视频

接口请求参数和返回参数详见 OpenAPI:查询播放 TopN 的视频

package vod

import (
        "fmt"
        "testing"

        "github.com/volcengine/volc-sdk-golang/base"
        "github.com/volcengine/volc-sdk-golang/service/vod"
        "github.com/volcengine/volc-sdk-golang/service/vod/models/request"
)

func Test_DescribeVodMostPlayedStatisData(t *testing.T) {
        // Create a VOD instance in the specified region.
        // instance := vod.NewInstanceWithRegion("cn-north-1")
        instance := vod.NewInstance()

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see  https://www.volcengine.com/docs/4/65655.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // instance.SetCredential(base.Credentials{
        // AccessKeyID:     "your ak",
        // SecretAccessKey: "your sk",
        //})

        query := &request.DescribeVodMostPlayedStatisDataRequest{
                Space:     "your Space",
                StartTime: "your StartTime",
                EndTime:   "your EndTime",
                OrderType: "your OrderType",
                TopN:      0,
        }

        resp, status, err := instance.DescribeVodMostPlayedStatisData(query)
        fmt.Println(status)
        fmt.Println(err)
        fmt.Println(resp.String())
}