com.baidubce.services.doc
Class DocClient

java.lang.Object
  extended by com.baidubce.AbstractBceClient
      extended by com.baidubce.services.doc.DocClient

public class DocClient
extends AbstractBceClient

Client for accessing Document Transcoder Services. All service calls made using this client are blocking, and will not return until the service call completes. Created by xuchuan on 2015/4/20.


Field Summary
 
Fields inherited from class com.baidubce.AbstractBceClient
config, DEFAULT_CONTENT_TYPE, DEFAULT_ENCODING, DEFAULT_SERVICE_DOMAIN, URL_PREFIX
 
Constructor Summary
DocClient()
          Constructs a new Document client to invoke service methods on Document Transcoder.
DocClient(BceClientConfiguration clientConfiguration)
          Constructs a new client using the client configuration to access Document Transcoder services.
 
Method Summary
 CreateDocumentResponse createDocument(CreateDocumentRequest request)
          Create a Document.
 CreateDocumentResponse createDocument(File file, String title)
          Create a Document.
 CreateDocumentResponse createDocument(File file, String title, String format)
          Create a Document.
 CreateDocumentResponse createDocument(File file, String title, String format, String notification)
          Create a Document.
 CreateDocumentResponse createDocument(File file, String title, String format, String notification, String access)
          Create a Document.
 CreateDocumentResponse createDocument(File file, String title, String format, String notification, String access, String targetType)
          Create a Document.
 CreateDocumentFromBosResponse createDocumentFromBos(CreateDocumentFromBosRequest request)
          Create a Document.
 CreateDocumentFromBosResponse createDocumentFromBos(String bucket, String object, String title, String format)
          Create a Document.
 CreateDocumentFromBosResponse createDocumentFromBos(String bucket, String object, String title, String format, String notification)
          Create a Document.
 CreateDocumentFromBosResponse createDocumentFromBos(String bucket, String object, String title, String format, String notification, String access)
          Create a Document.
 CreateDocumentFromBosResponse createDocumentFromBos(String bucket, String object, String title, String format, String notification, String access, String targetType)
          Create a Document.
 CreateNotificationResponse createNotification(CreateNotificationRequest request)
          Create a doc notification in the doc stream service.
 CreateNotificationResponse createNotification(String name, String endpoint)
          Create a doc notification in the doc stream service.
 DeleteDocumentResponse deleteDocument(DeleteDocumentRequest request)
          delete a Document.
 DeleteDocumentResponse deleteDocument(String documentId)
          delete a Document.
 DeleteNotificationResponse deleteNotification(DeleteNotificationRequest request)
          Delete your doc notification by doc notification name.
 DeleteNotificationResponse deleteNotification(String name)
          Delete your doc notification by doc notification name.
 DisableReadTokenResponse disableReadToken(DisableReadTokenRequest request)
          Disable read token.
 DisableReadTokenResponse disableReadToken(String documentId, String token)
          Disable read token.
 GetDocumentResponse getDocument(GetDocumentRequest request)
          get a Document.
 GetDocumentResponse getDocument(String documentId)
          get a Document.
 GetDocumentDownloadResponse getDocumentDownload(String documentId)
          get a Document Download link.
 GetDocumentDownloadResponse getDocumentDownload(String documentId, long expireInSeconds)
          get a Document Download link.
 GetDocumentImagesResponse getDocumentImages(String documentId)
          get a Document Image list if Converted to image.
 GetNotificationResponse getNotification(GetNotificationRequest request)
          Get your doc notification by doc notification name.
 GetNotificationResponse getNotification(String name)
          Get your doc notification by doc notification name.
 boolean isRegionSupported()
          Returns true if the target service supports regions.
 ListDocumentsResponse listDocuments()
          list all Document.
 ListDocumentsResponse listDocuments(String status)
          list all Document by status.
 ListDocumentsResponse listDocuments(String status, String marker, int maxSize)
          list all Document by status, marker.
 ListNotificationsResponse listNotifications()
          List all your doc notifications.
 ReadDocumentResponse readDocument(ReadDocumentRequest request)
          read a Document, get document reader infomation.
 ReadDocumentResponse readDocument(String documentId)
          read a Document, get document reader infomation.
 ReadDocumentResponse readDocument(String documentId, long expireInSeconds)
          read a Document, get document reader infomation.
 
Methods inherited from class com.baidubce.AbstractBceClient
getClient, getEndpoint, getServiceId, invokeHttpClient, setClient, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocClient

public DocClient()
Constructs a new Document client to invoke service methods on Document Transcoder.


DocClient

public DocClient(BceClientConfiguration clientConfiguration)
Constructs a new client using the client configuration to access Document Transcoder services.

Parameters:
clientConfiguration - The client configuration options controlling how this client connects to Document services (e.g. proxy settings, retry counts, etc).
Method Detail

isRegionSupported

public boolean isRegionSupported()
Description copied from class: AbstractBceClient
Returns true if the target service supports regions.

The result will impact the construction of default service endpoint.

Overrides:
isRegionSupported in class AbstractBceClient
Returns:
true if the target service supports regions.

createDocument

public CreateDocumentResponse createDocument(File file,
                                             String title,
                                             String format)
Create a Document.

Parameters:
file - The document .
title - The document title.
format - The document format.
Returns:
A CreateDocumentResponse object containing the information returned by Document.

createDocument

public CreateDocumentResponse createDocument(File file,
                                             String title)
Create a Document.

Parameters:
file - The document .
title - The document title.
Returns:
A CreateDocumentResponse object containing the information returned by Document.

createDocument

public CreateDocumentResponse createDocument(File file,
                                             String title,
                                             String format,
                                             String notification)
Create a Document.

Parameters:
file - The document .
title - The document title.
format - The document format.
notification - The document notification name.
Returns:
A CreateDocumentResponse object containing the information returned by Document.

createDocument

public CreateDocumentResponse createDocument(File file,
                                             String title,
                                             String format,
                                             String notification,
                                             String access)
Create a Document.

Parameters:
file - The document .
title - The document title.
format - The document format.
notification - The document notification name.
access - The document access privilege(PUBLIC/PRIVATE).
Returns:
A CreateDocumentResponse object containing the information returned by Document.

createDocument

public CreateDocumentResponse createDocument(File file,
                                             String title,
                                             String format,
                                             String notification,
                                             String access,
                                             String targetType)
Create a Document.

Parameters:
file - The document .
title - The document title.
format - The document format.
notification - The document notification name.
access - The document access privilege(PUBLIC/PRIVATE).
targetType - The document converts type(h5/image).
Returns:
A CreateDocumentResponse object containing the information returned by Document.

createDocument

public CreateDocumentResponse createDocument(CreateDocumentRequest request)
Create a Document.

Parameters:
request - The request object containing all the parameters to upload a new doc.
Returns:
A CreateDocumentResponse object containing the information returned by Document.

createDocumentFromBos

public CreateDocumentFromBosResponse createDocumentFromBos(String bucket,
                                                           String object,
                                                           String title,
                                                           String format,
                                                           String notification)
Create a Document.

Parameters:
bucket - The document bucket.
object - The document object.
title - The document title.
format - The document format.
notification - The document notification name.
Returns:
A CreateDocumentFromBosResponse object containing the information returned by Document.

createDocumentFromBos

public CreateDocumentFromBosResponse createDocumentFromBos(String bucket,
                                                           String object,
                                                           String title,
                                                           String format,
                                                           String notification,
                                                           String access)
Create a Document.

Parameters:
bucket - The document bucket.
object - The document object.
title - The document title.
format - The document format.
notification - The document notification name.
access - The document access privilege(PUBLIC/PRIVATE).
Returns:
A CreateDocumentFromBosResponse object containing the information returned by Document.

createDocumentFromBos

public CreateDocumentFromBosResponse createDocumentFromBos(String bucket,
                                                           String object,
                                                           String title,
                                                           String format,
                                                           String notification,
                                                           String access,
                                                           String targetType)
Create a Document.

Parameters:
bucket - The document bucket.
object - The document object.
title - The document title.
format - The document format.
notification - The document notification name.
access - The document access privilege(PUBLIC/PRIVATE).
targetType - The document converts type(h5/image).
Returns:
A CreateDocumentFromBosResponse object containing the information returned by Document.

createDocumentFromBos

public CreateDocumentFromBosResponse createDocumentFromBos(String bucket,
                                                           String object,
                                                           String title,
                                                           String format)
Create a Document.

Parameters:
bucket - The document bucket.
object - The document object.
title - The document title.
format - The document format.
Returns:
A CreateDocumentFromBosResponse object containing the information returned by Document.

createDocumentFromBos

public CreateDocumentFromBosResponse createDocumentFromBos(CreateDocumentFromBosRequest request)
Create a Document.

Parameters:
request - The request object containing all the parameters to upload a new doc.
Returns:
A CreateDocumentResponse object containing the information returned by Document.

getDocument

public GetDocumentResponse getDocument(String documentId)
get a Document.

Parameters:
documentId - The document id.
Returns:
A GetDocumentResponse object containing the information returned by Document.

getDocument

public GetDocumentResponse getDocument(GetDocumentRequest request)
get a Document.

Parameters:
request - The request object containing a docId.
Returns:
A GetDocumentResponse object containing the information returned by Document.

getDocumentImages

public GetDocumentImagesResponse getDocumentImages(String documentId)
get a Document Image list if Converted to image. Make Sure the Document convert type is image, otherwise will throw BceServiceException

Parameters:
documentId - the documentId need to get.
Returns:
A GetDocumentImageResponse object containing the information returned by Document.

listDocuments

public ListDocumentsResponse listDocuments()
list all Document.

Returns:
A ListDocumentsResponse object containing the information returned by Document.

listDocuments

public ListDocumentsResponse listDocuments(String status)
list all Document by status.

Parameters:
status - the status
Returns:
A ListDocumentsResponse object containing the information returned by Document.

listDocuments

public ListDocumentsResponse listDocuments(String status,
                                           String marker,
                                           int maxSize)
list all Document by status, marker.

Parameters:
status - document status
marker - the marker, can be ""
maxSize - the maxSize, should be (0, 200]
Returns:
A ListDocumentsResponse object containing the information returned by Document.

deleteDocument

public DeleteDocumentResponse deleteDocument(String documentId)
delete a Document.

Parameters:
documentId - The document id.
Returns:
A DeleteDocumentResponse object containing the information returned by Document.

deleteDocument

public DeleteDocumentResponse deleteDocument(DeleteDocumentRequest request)
delete a Document.

Parameters:
request - The request object containing a docId.
Returns:
A DeleteDocumentResponse object containing the information returned by Document.

getDocumentDownload

public GetDocumentDownloadResponse getDocumentDownload(String documentId)
get a Document Download link.

Parameters:
documentId - the documentId need to download.
Returns:
A GetDocumentDownloadResponse object containing the information returned by Document.

getDocumentDownload

public GetDocumentDownloadResponse getDocumentDownload(String documentId,
                                                       long expireInSeconds)
get a Document Download link.

Parameters:
documentId - the documentId need to download.
expireInSeconds - the Download link expire time in second. -1 set never expire.
Returns:
A GetDocumentDownloadResponse object containing the information returned by Document.

readDocument

public ReadDocumentResponse readDocument(String documentId)
read a Document, get document reader infomation.

Parameters:
documentId - The document id.
Returns:
A ReadDocumentResponse object containing the information returned by Document.

readDocument

public ReadDocumentResponse readDocument(String documentId,
                                         long expireInSeconds)
read a Document, get document reader infomation.

Parameters:
documentId - The document id.
expireInSeconds - The expire time
Returns:
A ReadDocumentResponse object containing the information returned by Document.

readDocument

public ReadDocumentResponse readDocument(ReadDocumentRequest request)
read a Document, get document reader infomation.

Parameters:
request - The request object containing a documentId.
Returns:
A ReadDocumentResponse object containing the information returned by Document.

disableReadToken

public DisableReadTokenResponse disableReadToken(String documentId,
                                                 String token)
Disable read token.

Parameters:
documentId - The document id.
token - The token need to disable
Returns:
A DisableReadTokenResponse object.

disableReadToken

public DisableReadTokenResponse disableReadToken(DisableReadTokenRequest request)
Disable read token.

Parameters:
request - The request object containing a documentId.
Returns:
A DisableReadTokenResponse object.

listNotifications

public ListNotificationsResponse listNotifications()
List all your doc notifications.

Returns:
The list of all your doc notifications

deleteNotification

public DeleteNotificationResponse deleteNotification(String name)
Delete your doc notification by doc notification name.

Parameters:
name - doc notification name.
Returns:
the response

deleteNotification

public DeleteNotificationResponse deleteNotification(DeleteNotificationRequest request)
Delete your doc notification by doc notification name.

Parameters:
request - The request object containing all parameters for deleting dco notification.
Returns:
the response

getNotification

public GetNotificationResponse getNotification(String name)
Get your doc notification by doc notification name.

Parameters:
name - doc notification name.
Returns:
Your doc notification.

getNotification

public GetNotificationResponse getNotification(GetNotificationRequest request)
Get your doc notification by doc notification name.

Parameters:
request - The request object containing all parameters for getting doc notification.
Returns:
Your doc notification.

createNotification

public CreateNotificationResponse createNotification(String name,
                                                     String endpoint)
Create a doc notification in the doc stream service.

Parameters:
name - The name of notification.
endpoint - The address to receive notification message.
Returns:
the response

createNotification

public CreateNotificationResponse createNotification(CreateNotificationRequest request)
Create a doc notification in the doc stream service.

Parameters:
request - The request object containing all options for creating doc notification.
Returns:
the response


Copyright © 2018. All rights reserved.