Package org.filestack
Class Client
java.lang.Object
org.filestack.Client
- All Implemented Interfaces:
Serializable
Uploads new files.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAcquires a reference to aFileLink
based on an unique handle.Gets basic account info for this fsClient's API key.io.reactivex.Single
<AppInfo> Asynchronously get basic account info for this fsClient's API key.getCloudItems
(String providerName, String path) Gets contents of a user's cloud "drive".getCloudItems
(String providerName, String path, String next) Gets contents of a user's cloud "drive".io.reactivex.Single
<CloudResponse> getCloudItemsAsync
(String providerName, String path) Asynchronously gets contents of a user's cloud "drive".io.reactivex.Single
<CloudResponse> getCloudItemsAsync
(String providerName, String path, String next) Asynchronously gets contents of a user's cloud "drive".protected static String
guessContentType
(String path) imageTransform
(String url) Creates anImageTransform
object for this file.void
logoutCloud
(String providerName) Logs out from specified cloud.io.reactivex.Completable
logoutCloudAsync
(String providerName) Asynchronously logs out from specified cloud.void
setSessionToken
(String sessionToken) storeCloudItem
(String providerName, String path) Transfers file from a user's cloud "drive" to Filestack.storeCloudItem
(String providerName, String path, StorageOptions options) Transfers file from a user's cloud "drive" to Filestack.io.reactivex.Single
<FileLink> storeCloudItemAsync
(String providerName, String path) Asynchronously transfers file from a user's cloud "drive" to Filestack.io.reactivex.Single
<FileLink> storeCloudItemAsync
(String providerName, String path, StorageOptions options) Asynchronously transfers file from a user's cloud "drive" to Filestack.upload
(InputStream input, int size, boolean intel) Synchronously uploads anInputStream
using default storage options.upload
(InputStream input, int size, boolean intel, StorageOptions opts) Synchronously uploads anInputStream
.Synchronously uploads a file system path using default storage options.upload
(String path, boolean intel, StorageOptions opts) Synchronously uploads a file system path.uploadAsync
(InputStream input, int size, boolean intel) Asynchronously uploads anInputStream
using default storage options.uploadAsync
(InputStream input, int size, boolean intel, StorageOptions opts) Asynchronously uploads anInputStream
.uploadAsync
(String path, boolean intelligent) Asynchronously uploads a file system path using default storage options.uploadAsync
(String path, boolean intel, StorageOptions opts) Asynchronously uploads a file system path.
-
Field Details
-
config
-
-
Constructor Details
-
Client
Basic constructor for Client class.- Parameters:
config
- - configuration for this Client's instance
-
-
Method Details
-
upload
Synchronously uploads a file system path using default storage options. WrapsuploadAsync(InputStream, int, boolean, StorageOptions)
.- Throws:
IOException
- See Also:
-
upload
public FileLink upload(String path, boolean intel, @Nullable StorageOptions opts) throws IOException Synchronously uploads a file system path. WrapsuploadAsync(InputStream, int, boolean, StorageOptions)
.- Throws:
IOException
- See Also:
-
upload
Synchronously uploads anInputStream
using default storage options. WrapsuploadAsync(InputStream, int, boolean, StorageOptions)
.- Throws:
IOException
- See Also:
-
upload
public FileLink upload(InputStream input, int size, boolean intel, @Nullable StorageOptions opts) throws IOException Synchronously uploads anInputStream
. WrapsuploadAsync(InputStream, int, boolean, StorageOptions)
.- Throws:
IOException
- See Also:
-
fileLink
Acquires a reference to aFileLink
based on an unique handle.- Parameters:
handle
- - a unique reference to a file uploaded through our API
-
getAppInfo
Gets basic account info for this fsClient's API key.- Throws:
HttpException
- on error response from backendIOException
- on network failure
-
getCloudItems
Gets contents of a user's cloud "drive".- Throws:
IOException
- See Also:
-
getCloudItems
public CloudResponse getCloudItems(String providerName, @Nullable String path, @Nullable String next) throws IOException Gets contents of a user's cloud "drive". If the user has not authorized for the provider, the response will contain an OAuth URL that should be opened in a browser.- Parameters:
providerName
- one of the static CLOUD constants in this classnext
- pagination token returned in previous response- Throws:
HttpException
- on error response from backendIOException
- on network failure
-
storeCloudItem
Transfers file from a user's cloud "drive" to Filestack. Uses default storage options.- Throws:
IOException
- See Also:
-
storeCloudItem
public FileLink storeCloudItem(String providerName, String path, @Nullable StorageOptions options) throws IOException Transfers file from a user's cloud "drive" to Filestack.- Parameters:
providerName
- one of the static CLOUD constants in this classoptions
- storage options for how to save the file in Filestack- Returns:
- new filelink
- Throws:
HttpException
- on error response from backendIOException
- on network failure
-
logoutCloud
Logs out from specified cloud.- Parameters:
providerName
- one of the static CLOUD constants in this class- Throws:
HttpException
- on error response from backendIOException
- on network failure
-
uploadAsync
Asynchronously uploads a file system path using default storage options. WrapsuploadAsync(InputStream, int, boolean, StorageOptions)
.- See Also:
-
uploadAsync
public io.reactivex.Flowable<Progress<FileLink>> uploadAsync(String path, boolean intel, @Nullable StorageOptions opts) Asynchronously uploads a file system path. WrapsuploadAsync(InputStream, int, boolean, StorageOptions)
.- See Also:
-
uploadAsync
public io.reactivex.Flowable<Progress<FileLink>> uploadAsync(InputStream input, int size, boolean intel) Asynchronously uploads anInputStream
using default storage options. WrapsuploadAsync(InputStream, int, boolean, StorageOptions)
.- See Also:
-
uploadAsync
public io.reactivex.Flowable<Progress<FileLink>> uploadAsync(InputStream input, int size, boolean intel, @Nullable StorageOptions opts) Asynchronously uploads anInputStream
. The returnedFlowable
emits a stream ofProgress
objects. The finalProgress
object will return a newFileLink
from theProgress.getData()
method. The upload is not done untilProgress.getData()
returns non-null. All exceptions, including issues opening a file, are returned through the observable.An
HttpException
is thrown on error response from backend. AnIOException
is thrown on error reading file or network failure.- Parameters:
intel
- enable intelligent ingestion, setting to true to will decrease failures in very poor network conditions at the expense of upload speedopts
- storage options, https://www.filestack.com/docs/rest-api/store
-
getAppInfoAsync
Asynchronously get basic account info for this fsClient's API key.- See Also:
-
getCloudItemsAsync
Asynchronously gets contents of a user's cloud "drive".- See Also:
-
getCloudItemsAsync
public io.reactivex.Single<CloudResponse> getCloudItemsAsync(String providerName, String path, @Nullable String next) Asynchronously gets contents of a user's cloud "drive".- See Also:
-
storeCloudItemAsync
Asynchronously transfers file from a user's cloud "drive" to Filestack. Uses default storage options.- See Also:
-
storeCloudItemAsync
public io.reactivex.Single<FileLink> storeCloudItemAsync(String providerName, String path, @Nullable StorageOptions options) Asynchronously transfers file from a user's cloud "drive" to Filestack.- See Also:
-
logoutCloudAsync
Asynchronously logs out from specified cloud.- See Also:
-
imageTransform
Creates anImageTransform
object for this file. A transformation call isn't made directly by this method.- Returns:
ImageTransform
instance configured for this file
-
guessContentType
-
getConfig
-
getSessionToken
-
setSessionToken
-