You need to enable JavaScript to run this app.
导航

其他配置

最近更新时间2022.08.03 11:07:54

首次发布时间2022.08.03 11:07:54

本文为您提供了服务端 Go SDK 的其他配置模块相关的 API 调用示例。主要包含:获取回调事件、添加回调订阅地址等。

初始化

使用前请先完成初始化,参考初始化

获取回调事件

接口请求参数和返回参数详见 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_SetCallbackEvent(t *testing.T) {
        instance := vod.NewInstance()
        instance.SetCredential(base.Credentials{
                AccessKeyID:     "your ak",
                SecretAccessKey: "your sk",
        })

        query := &request.VodSetCallbackEventRequest{
                SpaceName:   "your SpaceName",
                Events:      "your Events",
                AuthEnabled: "your AuthEnabled",
                PrivateKey:  "your PrivateKey",
        }

        resp, status, err := instance.SetCallbackEvent(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_AddCallbackSubscription(t *testing.T) {
        instance := vod.NewInstance()
        instance.SetCredential(base.Credentials{
                AccessKeyID:     "your ak",
                SecretAccessKey: "your sk",
        })

        query := &request.VodAddCallbackSubscriptionRequest{
                SpaceName:   "your SpaceName",
                Url:         "your Url",
                ContentType: "your ContentType",
        }

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