|
|
@@ -245,90 +245,6 @@ public class OssConsoleClient {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Deprecated
|
|
|
- public void setVideoScope(String videoFileId, int scope) throws Exception {
|
|
|
- MultiPartBodyPublisher publisher = new MultiPartBodyPublisher();
|
|
|
- publisher.addPart("videoId", videoFileId);
|
|
|
- publisher.addPart("scope", scope+"");
|
|
|
-
|
|
|
- String api = String.format("%s/api/oss/media/scope/video", endpoint);
|
|
|
- HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|
|
|
- .header("authorization", "Bearer " + token)
|
|
|
- .version(HttpClient.Version.HTTP_1_1)
|
|
|
- .POST(publisher.build())
|
|
|
- .build();
|
|
|
- HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
|
|
- int statusCode = httpResponse.statusCode();
|
|
|
- String body = httpResponse.body();
|
|
|
- if (statusCode != 200) {
|
|
|
- String errMsg = String.format("%s -> %s", statusCode, body);
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
-
|
|
|
- Type type = new TypeToken<WebResult<String>>(){}.getType();
|
|
|
- WebResult<String> webResult = JsonConverter.jsonToObject(body, type);
|
|
|
- if (webResult.getCode() != 0) {
|
|
|
- String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Deprecated
|
|
|
- public void setAudioScope(String audioFileId, int scope) throws Exception {
|
|
|
- MultiPartBodyPublisher publisher = new MultiPartBodyPublisher();
|
|
|
- publisher.addPart("audioFileId", audioFileId);
|
|
|
- publisher.addPart("scope", scope+"");
|
|
|
-
|
|
|
- String api = String.format("%s/api/oss/media/scope/audio", endpoint);
|
|
|
- HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|
|
|
- .header("authorization", "Bearer " + token)
|
|
|
- .version(HttpClient.Version.HTTP_1_1)
|
|
|
- .POST(publisher.build())
|
|
|
- .build();
|
|
|
- HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
|
|
- int statusCode = httpResponse.statusCode();
|
|
|
- String body = httpResponse.body();
|
|
|
- if (statusCode != 200) {
|
|
|
- String errMsg = String.format("%s -> %s", statusCode, body);
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
-
|
|
|
- Type type = new TypeToken<WebResult<String>>(){}.getType();
|
|
|
- WebResult<String> webResult = JsonConverter.jsonToObject(body, type);
|
|
|
- if (webResult.getCode() != 0) {
|
|
|
- String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Deprecated
|
|
|
- public void setImagesScope(Set<String> imageFileIds, int scope) throws Exception {
|
|
|
- String api = String.format("%s/api/oss/media/scope/image", endpoint);
|
|
|
- MultiPartBodyPublisher publisher = new MultiPartBodyPublisher();
|
|
|
- publisher.addPart("imageFileIds", imageFileIds.toString());
|
|
|
- publisher.addPart("scope", scope+"");
|
|
|
-
|
|
|
- HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|
|
|
- .header("authorization", "Bearer " + token)
|
|
|
- .version(HttpClient.Version.HTTP_1_1)
|
|
|
- .POST(publisher.build())
|
|
|
- .build();
|
|
|
- HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
|
|
- int statusCode = httpResponse.statusCode();
|
|
|
- String body = httpResponse.body();
|
|
|
- if (statusCode != 200) {
|
|
|
- String errMsg = String.format("%s -> %s", statusCode, body);
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
-
|
|
|
- Type type = new TypeToken<WebResult<String>>(){}.getType();
|
|
|
- WebResult<String> webResult = JsonConverter.jsonToObject(body, type);
|
|
|
- if (webResult.getCode() != 0) {
|
|
|
- String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public void setObjectScope(int scope, String objectId, int contentType) throws Exception {
|
|
|
String api = String.format("%s/api/oss/media/scope/object", endpoint);
|
|
|
MultiPartBodyPublisher publisher = new MultiPartBodyPublisher();
|
|
|
@@ -483,57 +399,6 @@ public class OssConsoleClient {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public ImageUrlDto getImageUrl(int channelId, String imageFileId) throws Exception {
|
|
|
- String api = String.format("%s/api/oss/media/image/url?channelId=%s&imageFileId=%s", endpoint, channelId, imageFileId);
|
|
|
- //String api = String.format("%s/api/oss/media/image/url?channelId=%s&imageFileId=%s&loginUser=%s", endpoint, channelId, imageFileId);
|
|
|
- HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|
|
|
- .header("authorization", "Bearer " + token)
|
|
|
- .version(HttpClient.Version.HTTP_1_1)
|
|
|
- .GET()
|
|
|
- .build();
|
|
|
- HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
|
|
- int statusCode = httpResponse.statusCode();
|
|
|
- String body = httpResponse.body();
|
|
|
- if (statusCode != 200) {
|
|
|
- String errMsg = String.format("%s -> %s", statusCode, body);
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
-
|
|
|
- Type type = new TypeToken<WebResult<ImageUrlDto>>(){}.getType();
|
|
|
- WebResult<ImageUrlDto> webResult = JsonConverter.jsonToObject(body, type);
|
|
|
- if (webResult.getCode() != 0) {
|
|
|
- String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
-
|
|
|
- return webResult.getData();
|
|
|
- }
|
|
|
-
|
|
|
- public ImageUrlDto getImageUrl(String imageFileId, int loginUser, int channelId) throws Exception {
|
|
|
- String api = String.format("%s/api/oss/media/image/url?channelId=%s&imageFileId=%s&loginUser=%s", endpoint, channelId, imageFileId, loginUser);
|
|
|
- HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|
|
|
- .header("authorization", "Bearer " + token)
|
|
|
- .version(HttpClient.Version.HTTP_1_1)
|
|
|
- .GET()
|
|
|
- .build();
|
|
|
- HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
|
|
- int statusCode = httpResponse.statusCode();
|
|
|
- String body = httpResponse.body();
|
|
|
- if (statusCode != 200) {
|
|
|
- String errMsg = String.format("%s -> %s", statusCode, body);
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
-
|
|
|
- Type type = new TypeToken<WebResult<ImageUrlDto>>(){}.getType();
|
|
|
- WebResult<ImageUrlDto> webResult = JsonConverter.jsonToObject(body, type);
|
|
|
- if (webResult.getCode() != 0) {
|
|
|
- String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
-
|
|
|
- return webResult.getData();
|
|
|
- }
|
|
|
-
|
|
|
public List<ImageUrlDto> getImageUrls(Set<String> imageFileIds) throws Exception {
|
|
|
String api = String.format("%s/api/oss/media/image/urls?imageFileIds=%s", endpoint, imageFileIds.toString());
|
|
|
HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|
|
|
@@ -559,31 +424,6 @@ public class OssConsoleClient {
|
|
|
return webResult.getData();
|
|
|
}
|
|
|
|
|
|
- public String getSignedUrl(String url, int loginUser, int channelId) throws Exception {
|
|
|
- String api = String.format("%s/api/oss/media/image/signedurl?channelId=%s&url=%s&loginUser=%s", endpoint, channelId, url, loginUser);
|
|
|
- HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|
|
|
- .header("authorization", "Bearer " + token)
|
|
|
- .version(HttpClient.Version.HTTP_1_1)
|
|
|
- .GET()
|
|
|
- .build();
|
|
|
- HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
|
|
- int statusCode = httpResponse.statusCode();
|
|
|
- String body = httpResponse.body();
|
|
|
- if (statusCode != 200) {
|
|
|
- String errMsg = String.format("%s -> %s", statusCode, body);
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
-
|
|
|
- Type type = new TypeToken<WebResult<String>>(){}.getType();
|
|
|
- WebResult<String> webResult = JsonConverter.jsonToObject(body, type);
|
|
|
- if (webResult.getCode() != 0) {
|
|
|
- String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
-
|
|
|
- return webResult.getData();
|
|
|
- }
|
|
|
-
|
|
|
public void deleteVideoFile(String videoFileId) throws Exception {
|
|
|
String api = String.format("%s/api/oss/media/video/delete/%s", endpoint, videoFileId);
|
|
|
HttpRequest.Builder builder = HttpRequest.newBuilder(new URI(api)).version(HttpClient.Version.HTTP_1_1);
|
|
|
@@ -629,8 +469,8 @@ public class OssConsoleClient {
|
|
|
return webResult.getData();
|
|
|
}
|
|
|
|
|
|
- public List<VideoUrlDto> getVideoUrls(String videoFileId, int loginUser) throws Exception {
|
|
|
- String api = String.format("%s/api/oss/media/video/url?videoFileId=%s&userId=%s", endpoint, videoFileId, loginUser);
|
|
|
+ public List<VideoUrlDto> getVideoUrls(String videoFileId) throws Exception {
|
|
|
+ String api = String.format("%s/api/oss/media/video/url?videoFileId=%s", endpoint, videoFileId);
|
|
|
HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|
|
|
.header("authorization", "Bearer " + token)
|
|
|
.version(HttpClient.Version.HTTP_1_1)
|