public final class StitchAppClientImpl extends Object implements StitchAppClient, AuthMonitor
| Constructor and Description |
|---|
StitchAppClientImpl(String clientAppId,
StitchAppClientConfiguration config)
Constructs an app client with the given configuration.
|
| 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.
|
boolean |
isLoggedIn() |
public StitchAppClientImpl(String clientAppId, StitchAppClientConfiguration config)
clientAppId - the client app id for the app.config - the configuration to use for the app client.public StitchAuth getAuth()
StitchAppClientgetAuth in interface StitchAppClientpublic StitchPush getPush()
StitchAppClientgetPush in interface StitchAppClientpublic <T> T getServiceClient(NamedServiceClientFactory<T> factory, String serviceName)
StitchAppClientgetServiceClient in interface StitchAppClientT - 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.public <T> T getServiceClient(ServiceClientFactory<T> factory)
StitchAppClientgetServiceClient in interface StitchAppClientT - the type of client to be returned by the factory.factory - the factory that will create a client for the service.public StitchServiceClient getServiceClient(String serviceName)
StitchAppClientgetServiceClient in interface StitchAppClientserviceName - the name of the service.public Task<Void> callFunction(String name, List<?> args)
StitchAppClientcallFunction in interface StitchAppClientname - the name of the Stitch function to call.args - the arguments to pass to the function.Task that completes when the function call completes.public Task<Void> callFunction(String name, List<?> args, Long requestTimeout)
StitchAppClientcallFunction in interface StitchAppClientname - 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.public <ResultT> Task<ResultT> callFunction(String name, List<?> args, Class<ResultT> resultClass)
StitchAppClientcallFunction in interface StitchAppClientResultT - 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.public <ResultT> Task<ResultT> callFunction(String name, List<?> args, Long requestTimeout, Class<ResultT> resultClass)
StitchAppClientcallFunction in interface StitchAppClientResultT - 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.public <ResultT> Task<ResultT> callFunction(String name, List<?> args, Class<ResultT> resultClass, CodecRegistry codecRegistry)
StitchAppClientcallFunction in interface StitchAppClientResultT - 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.public <ResultT> Task<ResultT> callFunction(String name, List<?> args, Long requestTimeout, Class<ResultT> resultClass, CodecRegistry codecRegistry)
StitchAppClientcallFunction in interface StitchAppClientResultT - 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.public <ResultT> Task<ResultT> callFunction(String name, List<?> args, Decoder<ResultT> resultDecoder)
StitchAppClientDecoder or Codec.callFunction in interface StitchAppClientResultT - 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.public <ResultT> Task<ResultT> callFunction(String name, List<?> args, Long requestTimeout, Decoder<ResultT> resultDecoder)
StitchAppClientDecoder 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).callFunction in interface StitchAppClientResultT - 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.public boolean isLoggedIn()
isLoggedIn in interface AuthMonitorpublic void close()
throws IOException
close in interface StitchAppClientclose in interface Closeableclose in interface AutoCloseableIOException - if any thread shutdown errors happen.