Skip to content

Commit

Permalink
update bvw
Browse files Browse the repository at this point in the history
  • Loading branch information
friendshipbridge committed Aug 24, 2020
1 parent f3f996d commit f7883d9
Show file tree
Hide file tree
Showing 7 changed files with 600 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Release Notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
【版本:vx.xx.xx】
涉及产品:SHC,新增广播接口,现有product接口增加asrKafka参数。

【版本:v0.10.124】
涉及产品:BVW(VideoWorks),支持上传素材和查询素材。

【版本:v0.10.123】
涉及产品:CNAP,支持获取工作空间名称。

【版本:v0.10.122】
涉及产品:DCC,创建DCC自实例新增hostname参数。

Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
</properties>

<dependencies>
<dependency>
<groupId>com.baidu.bce</groupId>
<artifactId>gateway-manager-cloud-sdk</artifactId>
<version>1.27.18.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down
31 changes: 31 additions & 0 deletions src/main/java/com/baidubce/services/bvw/BvwClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
import com.baidubce.internal.RestartableInputStream;
import com.baidubce.model.AbstractBceRequest;
import com.baidubce.services.bvw.model.common.ListByPageResponse;
import com.baidubce.services.bvw.model.matlib.MaterialGetRequest;
import com.baidubce.services.bvw.model.matlib.MaterialGetResponse;
import com.baidubce.services.bvw.model.matlib.MatlibUploadRequest;
import com.baidubce.services.bvw.model.matlib.MatlibUploadResponse;
import com.baidubce.services.bvw.model.media.MediaBaseRequest;
import com.baidubce.services.bvw.model.media.MediaBaseResponse;
import com.baidubce.services.bvw.model.media.MediaBatchDeleteRequest;
Expand Down Expand Up @@ -78,6 +82,8 @@ public class BvwClient extends AbstractBceClient {
private static final String INSTANCE = "instance";
private static final String TASK = "task";
private static final String NOTIFICATION = "notification";
private static final String MATLIB = "matlib";
private static final String MATERIAL_LIBRARY = "materialLibrary";

/**
* The request queries.
Expand Down Expand Up @@ -105,6 +111,7 @@ public class BvwClient extends AbstractBceClient {
private static final String NOTIFICATION_LIST_STATUS = "status";
private static final String NOTIFICATION_ENABLE = "enable";
private static final String NOTIFICATION_DISABLE = "disable";
private static final String MATLIB_UPLOAD = "upload";

/**
* Responsible for handling httpResponses from all Bos service calls.
Expand Down Expand Up @@ -793,4 +800,28 @@ public NotificationBaseResponse deleteNotification(String name) {
return deleteNotification(deleteRequest);
}

/**
* Upload media to material library.
*
* @param matlibUploadRequest The uploading request
* @return A uploading response
*/
public MatlibUploadResponse upload2Material(MatlibUploadRequest matlibUploadRequest) {
InternalRequest request = this.createRequest(matlibUploadRequest, HttpMethodName.POST, MATLIB);
request.addParameter(MATLIB_UPLOAD, null);
return this.invokeHttpClient(request, MatlibUploadResponse.class);
}

/**
* Get material from material library.
* @param materialId The material id
* @return A getting material response
*/
public MaterialGetResponse getMaterial(String materialId) {
MaterialGetRequest materialGetRequest = new MaterialGetRequest(materialId);
InternalRequest request = this.createRequest(materialGetRequest, HttpMethodName.GET, MATERIAL_LIBRARY,
materialId);
return invokeHttpClient(request, MaterialGetResponse.class);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright 2019-2020 Baidu, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.baidubce.services.bvw.model.matlib;

import com.baidubce.auth.BceCredentials;
import com.baidubce.model.AbstractBceRequest;

/**
* The request of getting material from material library.
*/
public class MaterialGetRequest extends AbstractBceRequest {

/**
* The material id in material library.
*/
private String materialId;

public MaterialGetRequest() {
}

public MaterialGetRequest(String materialId) {
this.materialId = materialId;
}

public String getMaterialId() {
return materialId;
}

public void setMaterialId(String materialId) {
this.materialId = materialId;
}

@Override
public String toString() {
return "MaterialGetRequest{" +
"materialId='" + materialId + '\'' +
'}';
}

@Override
public AbstractBceRequest withRequestCredentials(BceCredentials credentials) {
this.setRequestCredentials(credentials);
return this;
}

}
Loading

0 comments on commit f7883d9

Please sign in to comment.