public final class ModuleUploads
extends java.lang.Object
This module will take care of all `upload.contentful.com` related issues, as in directly uploading a file to Contentful, receiving it's id.
Modifier and Type | Class and Description |
---|---|
class |
ModuleUploads.Async
Async module.
|
Constructor and Description |
---|
ModuleUploads(retrofit2.Retrofit retrofit,
java.util.concurrent.Executor callbackExecutor,
java.lang.String spaceId,
java.lang.String environmentId,
boolean environmentIdConfigured)
Create uploads module.
|
Modifier and Type | Method and Description |
---|---|
ModuleUploads.Async |
async() |
CMAUpload |
create(java.io.InputStream stream)
Create a new upload on the configured space.
|
CMAUpload |
create(java.lang.String spaceId,
java.io.InputStream stream)
Create a new upload.
|
protected com.contentful.java.cma.ServiceUploads |
createService(retrofit2.Retrofit retrofit) |
int |
delete(CMAUpload upload)
Delete a given upload again.
|
CMAUpload |
fetchOne(java.lang.String uploadId)
Get information about a given upload on the configured space.
|
CMAUpload |
fetchOne(java.lang.String spaceId,
java.lang.String uploadId)
Get information about the given upload.
|
public ModuleUploads(retrofit2.Retrofit retrofit, java.util.concurrent.Executor callbackExecutor, java.lang.String spaceId, java.lang.String environmentId, boolean environmentIdConfigured)
retrofit
- the retrofit instance to be used to create the service.callbackExecutor
- to tell on which thread it should run.spaceId
- the space to be used when not given.environmentId
- the environment to be used when not given.environmentIdConfigured
- internal helper to see if environment was set.protected com.contentful.java.cma.ServiceUploads createService(retrofit2.Retrofit retrofit)
public CMAUpload create(java.io.InputStream stream) throws java.io.IOException
Once an upload is created, you can use it in ModuleAssets
through
CMAClient.assets()
for creating an asset based on a local file.
stream
- the actual binary representation of the upload. Cannot be null.java.lang.IllegalArgumentException
- if spaceId is null.java.lang.IllegalArgumentException
- if stream is null.java.io.IOException
- if the stream could not be read.CMANotWithEnvironmentsException
- if environmentId was set using
CMAClient.Builder.setEnvironmentId(String)
.CMAClient.Builder.setSpaceId(String)
public CMAUpload create(java.lang.String spaceId, java.io.InputStream stream) throws java.io.IOException
Once an upload is created, you can use it in ModuleAssets
through
CMAClient.assets()
for creating an asset based on a local file.
This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)
and will ignore
CMAClient.Builder.setEnvironmentId(String)
.
spaceId
- a nonnull id representing the space to add the upload to.stream
- the actual binary representation of the upload. Cannot be null.java.lang.IllegalArgumentException
- if spaceId is null.java.lang.IllegalArgumentException
- if stream is null.java.io.IOException
- if the stream could not be read.public CMAUpload fetchOne(java.lang.String uploadId)
uploadId
- what id does the upload have?java.lang.IllegalArgumentException
- if configured spaceId is null.java.lang.IllegalArgumentException
- if uploadId is null.CMANotWithEnvironmentsException
- if environmentId was set using
CMAClient.Builder.setEnvironmentId(String)
.CMAClient.Builder.setSpaceId(String)
public CMAUpload fetchOne(java.lang.String spaceId, java.lang.String uploadId)
This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)
and will ignore
CMAClient.Builder.setEnvironmentId(String)
.
spaceId
- which space is this upload hosted under?uploadId
- what id does the upload have?java.lang.IllegalArgumentException
- if spaceId is null.java.lang.IllegalArgumentException
- if uploadId is null.public int delete(CMAUpload upload)
upload
- uploadjava.lang.IllegalArgumentException
- if spaceId is null.java.lang.IllegalArgumentException
- if uploadId is null.public ModuleUploads.Async async()
Copyright © 2019 Contentful, GmbH.. All Rights Reserved.