public class CreateVenueRequestExecutor extends RequestExecutor<Venue>
VenuesApi
. Use this class if you want to create
venues through fluent API in chained fashion, for example:
IKontaktCloud kontaktCloud = KontaktCloud.newInstance();
Venue venue = new Venue.Builder()
.name("Kontakt.io office")
.description("Beacon valley")
.build();
kontaktCloud.venues().create(venue)
.withImageFile(new File(fileName))
.execute();
Keep in mind that new venue instance that we want to create must have initialized name and
description fields. Otherwise an exception will be thrown.Constructor and Description |
---|
CreateVenueRequestExecutor(VenuesService venuesService,
Venue venue)
Constructs request executor initialized with corresponding service class and venue object.
|
Modifier and Type | Method and Description |
---|---|
Venue |
execute()
Executes created request synchronously.
|
void |
execute(CloudCallback<Venue> callback)
Executes created request asynchronously and invokes callback with the result.
|
protected java.util.Map<java.lang.String,java.lang.String> |
params()
Composes the request's parameters in map.
|
protected retrofit2.Call<Venue> |
prepareCall()
Prepares a request to execute.
|
CreateVenueRequestExecutor |
withImageFile(byte[] bytes)
Specifies an image file of newly created venue.
|
CreateVenueRequestExecutor |
withImageFile(java.io.File file)
Specifies an image file of newly created venue.
|
public CreateVenueRequestExecutor(VenuesService venuesService, Venue venue)
venuesService
- the venues API service.venue
- the venue entity.public CreateVenueRequestExecutor withImageFile(java.io.File file) throws java.io.IOException
file
- the image file.java.io.IOException
- instance of exceptionpublic CreateVenueRequestExecutor withImageFile(byte[] bytes) throws java.io.IOException
bytes
- the image file as a bytes stream.java.io.IOException
- instance of IOExceptionpublic Venue execute() throws java.io.IOException, KontaktCloudException
execute
in class RequestExecutor<Venue>
java.io.IOException
- exceptionKontaktCloudException
- exceptionpublic void execute(CloudCallback<Venue> callback)
execute
in class RequestExecutor<Venue>
callback
- the callback object.protected retrofit2.Call<Venue> prepareCall()
prepareCall
in class RequestExecutor<Venue>
protected java.util.Map<java.lang.String,java.lang.String> params()
params
in class RequestExecutor<Venue>