public interface StitchAppClient extends Closeable
Modifier and Type | Method and Description |
---|---|
Task<Void> |
callFunction(String name,
List<?> args)
Calls the specified Stitch function.
|
<ResultT> Task<ResultT> |
callFunction(String name,
List<?> args,
Class<ResultT> resultClass)
Calls the specified Stitch function, and decodes the response into an instance of the specified
type.
|
<ResultT> Task<ResultT> |
callFunction(String name,
List<?> args,
Class<ResultT> resultClass,
CodecRegistry codecRegistry)
Calls the specified Stitch function, and decodes the response into an instance of the specified
type.
|
<ResultT> Task<ResultT> |
callFunction(String name,
List<?> args,
Decoder<ResultT> resultDecoder)
|
Task<Void> |
callFunction(String name,
List<?> args,
Long requestTimeout)
Calls the specified Stitch function.
|
<ResultT> Task<ResultT> |
callFunction(String name,
List<?> args,
Long requestTimeout,
Class<ResultT> resultClass)
Calls the specified Stitch function, and decodes the response into an instance of the specified
type.
|
<ResultT> Task<ResultT> |
callFunction(String name,
List<?> args,
Long requestTimeout,
Class<ResultT> resultClass,
CodecRegistry codecRegistry)
Calls the specified Stitch function, and decodes the response into an instance of the specified
type.
|
<ResultT> Task<ResultT> |
callFunction(String name,
List<?> args,
Long requestTimeout,
Decoder<ResultT> resultDecoder)
|
void |
close()
Closes the client and shuts down all background operations.
|
StitchAuth |
getAuth()
Gets the authentication component of the app.
|
StitchPush |
getPush()
Gets the push notifications component of the app.
|
<T> T |
getServiceClient(NamedServiceClientFactory<T> factory,
String serviceName)
Gets a client for the given named service.
|
<T> T |
getServiceClient(ServiceClientFactory<T> factory)
Gets a client for the given service.
|
StitchServiceClient |
getServiceClient(String serviceName)
Gets a general purpose client for the given named service.
|
StitchAuth getAuth()
StitchPush getPush()
<T> T getServiceClient(NamedServiceClientFactory<T> factory, String serviceName)
T
- the type of client to be returned by the factory.factory
- the factory that will create a client for the service.serviceName
- the name of the service.<T> T getServiceClient(ServiceClientFactory<T> factory)
T
- the type of client to be returned by the factory.factory
- the factory that will create a client for the service.StitchServiceClient getServiceClient(String serviceName)
serviceName
- the name of the service.Task<Void> callFunction(String name, List<?> args)
name
- the name of the Stitch function to call.args
- the arguments to pass to the function.Task
that completes when the function call completes.Task<Void> callFunction(String name, List<?> args, Long requestTimeout)
name
- the name of the Stitch function to call.args
- the arguments to pass to the function.requestTimeout
- the number of milliseconds the client should wait for a response from the
server before failing with an error.Task
containing the decoded value.<ResultT> Task<ResultT> callFunction(String name, List<?> args, Class<ResultT> resultClass)
ResultT
- the type into which the Stitch response will be decoded.name
- the name of the Stitch function to call.args
- he arguments to pass to the function.resultClass
- the class that the response should be decoded as.Task
containing the decoded value.<ResultT> Task<ResultT> callFunction(String name, List<?> args, Long requestTimeout, Class<ResultT> resultClass)
ResultT
- the type into which the Stitch response will be decoded.name
- the name of the Stitch function to call.args
- the arguments to pass to the function.requestTimeout
- the number of milliseconds the client should wait for a response from the
server before failing with an error.resultClass
- the class that the response should be decoded as.Task
containing the decoded value.<ResultT> Task<ResultT> callFunction(String name, List<?> args, Decoder<ResultT> resultDecoder)
Decoder
or Codec
.ResultT
- the type into which the response will be decoded.name
- the name of the Stitch function to call.args
- the arguments to pass to the function.resultDecoder
- the Decoder
or Codec
to use to decode the response into a
value.Task
containing the decoded value.<ResultT> Task<ResultT> callFunction(String name, List<?> args, Long requestTimeout, Decoder<ResultT> resultDecoder)
Decoder
or Codec
. Also accepts a timeout in milliseconds. Use this for
functions that may run longer than the client-wide default timeout (15 seconds by default).ResultT
- the type into which the response will be decoded.name
- the name of the Stitch function to call.args
- the arguments to pass to the function.requestTimeout
- the number of milliseconds the client should wait for a response from the
server before failing with an error.resultDecoder
- the Decoder
or Codec
to use to decode the response into a
value.Task
containing the decoded value.<ResultT> Task<ResultT> callFunction(String name, List<?> args, Class<ResultT> resultClass, CodecRegistry codecRegistry)
ResultT
- the type into which the Stitch response will be decoded.name
- the name of the Stitch function to call.args
- the arguments to pass to the function.resultClass
- the class that the response should be decoded as.codecRegistry
- the codec registry used for de/serialization of the function call.Task
containing the decoded value.<ResultT> Task<ResultT> callFunction(String name, List<?> args, Long requestTimeout, Class<ResultT> resultClass, CodecRegistry codecRegistry)
ResultT
- the type into which the Stitch response will be decoded.name
- the name of the Stitch function to call.args
- the arguments to pass to the function.requestTimeout
- the number of milliseconds the client should wait for a response from the
server before failing with an error.resultClass
- the class that the response should be decoded as.codecRegistry
- the codec registry used for de/serialization of the function call.Task
containing the decoded value.void close() throws IOException
close
in interface AutoCloseable
close
in interface Closeable
IOException
- if any thread shutdown errors happen.