Skip to content

Java v1 reference

Last updated: Sep 06, 2024 at 16:28

This is the Java v1 reference guide. If you want more information about how to get started with SDKs, click here.

Warning

This project is under active development!

Found a problem? Report it here.

Contents

  • public class Client


    Browse the constructor and methods for this class. This class has 12 methods.

    See Reference

  • public class JellyFaasException extends Exception


    Browse the constructor and methods for this class. This class has 1 methods.

    See Reference

  • public class JellyFaasFormatException extends Exception


    Browse the constructor and methods for this class. This class has 1 methods.

    See Reference

  • public class JellyFaasHttpException extends Exception


    Browse the constructor and methods for this class. This class has 1 methods.

    See Reference

  • public class JellyFormData


    Browse the constructor and methods for this class. This class has 6 methods.

    See Reference

  • public class Config


    Browse the constructor and methods for this class. This class has 6 methods.

    See Reference

  • public abstract class JellyFaasOutputBuilder


    Browse the constructor and methods for this class. This class has 2 methods.

    See Reference


JellyFaaS Java SDK

The JellyFaaS Java SDK. Here's a quick guide on how to get started with the SDK.

Setting the config object

This object handles any keys and tokens that are required throughout the life cycle of the client. The config will generate any jwt tokens and authorisation required at run time.

Config config = new Config();
config.setApiKey("API-KEY");
...

Creating a client

Start by creating a Client, this takes a config object (created above).

Client client = new Client(config);

Function Lookup

Each function has its own unique shortname - these are used to look up functions. This is done by calling .lookUp("shortname").

client.lookUp("shortname");

Setting the request parameters

This is the most error-prone function as this validates an input body against the functions schema ,which is fetched when .lookUp("shortname") is called. To set the request, you must call .setRequest(Map<String, String>, Object)on the client object.

Query Parameters

These are set using a Map<String, String> for the key value pairs for the query params the function takes. These are validated before the call is made to the function.

Request Body

Each request and response class is unique to each function. A populated request object must be parsed into this function.

Setting the Response Body

This is done with .setResponse(Class<?>) A response object must be provided, which lets the response be accessible via a Java object. The Class< ? > of the output class must be parsed which is provided on the functions' webpage. The invoke() function will return an instance of that class.

Invoking

This is the last method to make a request out to the function provided the previous methods have been called. The invoke() function will return a new instance of the Class< ? > provided in .setResponse();. If an instance is provided, the data will be marshalled into this instance provided the schema is correct.

Example

Example with parsing the OutputClass class.

// creating a config object
Config config = new Config();
config.setApiKey("API-KEY");

// setting the client
Client client = new Client(config);

// creating an input object
InputClass input = new InputClass();
inputClass.setSomeAttribute("foobar");

// invoking the function with the OutputClass.class as the response object
OutputClass output = (OutputClass) client.lookUp("shortname").setRequest(params, input).setResponse(OutputClass.class).invoke();