Package com.mongodb.stitch.core.internal
Class CoreStitchAppClient
- java.lang.Object
-
- com.mongodb.stitch.core.internal.CoreStitchAppClient
-
public final class CoreStitchAppClient extends Object
-
-
Constructor Summary
Constructors Constructor Description CoreStitchAppClient(StitchAuthRequestClient authRequestClient, StitchAppRoutes routes, CodecRegistry codecRegistry)
Constructs a new app client.
-
Method Summary
Modifier and Type Method Description void
callFunction(String name, List<?> args, Long requestTimeout)
Calls the specified Stitch function.<T> T
callFunction(String name, List<?> args, Long requestTimeout, Class<T> resultClass)
Calls the specified Stitch function, and decodes the response into an instance of the specified type.<T> T
callFunction(String name, List<?> args, Long requestTimeout, Class<T> resultClass, CodecRegistry codecRegistry)
Calls the specified Stitch function, and decodes the response into an instance of the specified type.<T> T
callFunction(String name, List<?> args, Long requestTimeout, Decoder<T> decoder)
Calls the specified Stitch function, and decodes the response into a value using the providedDecoder
.
-
-
-
Constructor Detail
-
CoreStitchAppClient
public CoreStitchAppClient(StitchAuthRequestClient authRequestClient, StitchAppRoutes routes, CodecRegistry codecRegistry)
Constructs a new app client.- Parameters:
authRequestClient
- the request client to used for authenticated requests.routes
- the app specific routes.codecRegistry
- the codec registry used for de/serialization.
-
-
Method Detail
-
callFunction
public void callFunction(String name, List<?> args, @Nullable Long requestTimeout)
Calls the specified Stitch function.- Parameters:
name
- the name of the Stitch function to call.args
- the arguments to pass to the Stitch function.requestTimeout
- the number of milliseconds the client should wait for a response from the server before failing with an error.
-
callFunction
public <T> T callFunction(String name, List<?> args, @Nullable Long requestTimeout, Decoder<T> decoder)
Calls the specified Stitch function, and decodes the response into a value using the providedDecoder
.- Type Parameters:
T
- the type into which the Stitch response will be decoded.- Parameters:
name
- the name of the Stitch function to call.args
- the arguments to pass to the Stitch function.requestTimeout
- the number of milliseconds the client should wait for a response from the server before failing with an error.decoder
- theDecoder
to use to decode the Stitch response into a value.- Returns:
- the decoded value.
-
callFunction
public <T> T callFunction(String name, List<?> args, @Nullable Long requestTimeout, Class<T> resultClass)
Calls the specified Stitch function, and decodes the response into an instance of the specified type. The response will be decoded using the codec registry specified when the client was configured. If no codec registry was configured, a default codec registry will be used. The default codec registry supports the mappings specified here- Type Parameters:
T
- the type into which the Stitch response will be decoded.- Parameters:
name
- the name of the Stitch function to call.args
- the arguments to pass to the Stitch 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 Stitch response should be decoded as.- Returns:
- the decoded value.
-
callFunction
public <T> T callFunction(String name, List<?> args, @Nullable Long requestTimeout, Class<T> resultClass, CodecRegistry codecRegistry)
Calls the specified Stitch function, and decodes the response into an instance of the specified type. The response will be decoded using the codec registry given.- Type Parameters:
T
- the type into which the Stitch response will be decoded.- Parameters:
name
- the name of the Stitch function to call.args
- the arguments to pass to the Stitch 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 Stitch response should be decoded as.codecRegistry
- the codec registry that will be used to encode/decode the function call.- Returns:
- the decoded value.
-
-