阅读本文,您可以获取 Go SDK 离线画质评估的接口调用示例,实现快速开发。
调用接口前,请先完成 Go SDK 的安装及初始化操作。
本节为您介绍离线画质评估相关接口的功能和调用示例。
您可以调用 CreateImageAnalyzeTask 接口在指定服务下创建一条离线评估任务。详细的参数说明可参见 CreateImageAnalyzeTask 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_CreateImageAnalyzeTask(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.CreateImageAnalyzeTaskBody{} resp, err := instance.CreateImageAnalyzeTask(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }
您可以调用 UpdateImageAnalyzeTask 接口更新指定离线评估任务的配置。详细的参数说明可参见 UpdateImageAnalyzeTask 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_UpdateImageAnalyzeTask(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.UpdateImageAnalyzeTaskBody{} resp, err := instance.UpdateImageAnalyzeTask(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }
您可以调用 DeleteImageAnalyzeTask 接口删除一个指定的评估任务。详细的参数说明可参见 DeleteImageAnalyzeTask 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_DeleteImageAnalyzeTask(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.DeleteImageAnalyzeTaskBody{} resp, err := instance.DeleteImageAnalyzeTask(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }
您可以调用 GetImageAnalyzeTasks 接口分页查询账号下已创建的所有离线评估任务列表。详细的参数说明可参见 GetImageAnalyzeTasks 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_GetImageAnalyzeTasks(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.GetImageAnalyzeTasksQuery{} resp, err := instance.GetImageAnalyzeTasks(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }
您可以调用 DeleteImageAnalyzeTaskRun 接口删除指定离线评估任务的某条执行记录。详细的参数说明可参见 DeleteImageAnalyzeTaskRun 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_DeleteImageAnalyzeTaskRun(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.DeleteImageAnalyzeTaskRunBody{} resp, err := instance.DeleteImageAnalyzeTaskRun(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }
您可以调用 GetImageAnalyzeResult 接口获取指定离线评估任务结果。详细的参数说明可参见 GetImageAnalyzeResult 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_GetImageAnalyzeResult(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.GetImageAnalyzeResultQuery{} resp, err := instance.GetImageAnalyzeResult(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }
您可以调用 UpdateImageAnalyzeTaskStatus 接口更新指定的离线画质任务状态。详细的参数说明可参见 UpdateImageAnalyzeTaskStatus 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_UpdateImageAnalyzeTaskStatus(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.UpdateImageAnalyzeTaskStatusBody{} resp, err := instance.UpdateImageAnalyzeTaskStatus(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }