API Documentation
The documentation for the SwiftyRx can be found at https://acme.swiftyrx.dev/api/ui/
Client Installation
The clients are not yet published to Maven. They will be soon.
Example Usage
Authorization
SwiftyOAuthApiWrapper.java
1import com.rxfoundry.clients.swifty_oauth.ApiClient;
2import com.rxfoundry.clients.swifty_oauth.ApiException;
3import com.rxfoundry.clients.swifty_oauth.Configuration;
4import com.rxfoundry.clients.swifty_oauth.api.OAuthApi;
5import com.rxfoundry.clients.swifty_oauth.model.GetTokenRequest;
6import com.rxfoundry.clients.swifty_oauth.model.TokenResponse;
7
8public class SwiftyOAuthApiWrapper {
9 String host;
10 String scheme;
11 String port;
12
13 public SwiftyOAuthApiWrapper(String host, String scheme, String port) {
14 this.host = host;
15 this.scheme = scheme;
16 this.port = port;
17 }
18
19 public TokenResponse getAuthorizationToken(String username, String password){
20 // getting Authorization Token
21 ApiClient defaultClient = Configuration.getDefaultApiClient();
22
23 try {
24 defaultClient.setHost(this.host);
25 defaultClient.setPort(Integer.parseInt(this.port));
26 defaultClient.setScheme(this.scheme);
27
28 OAuthApi apiInstance = new OAuthApi(defaultClient);
29 GetTokenRequest getTokenRequest = new GetTokenRequest().username(username).password(password).grantType("password");
30
31 TokenResponse result = apiInstance.getToken(getTokenRequest);
32 System.out.println(result);
33 return result;
34 } catch (ApiException e) {
35 System.err.println("Exception when calling OAuthApi#getToken");
36 System.err.println("Status code: " + e.getCode());
37 System.err.println("Reason: " + e.getResponseBody());
38 System.err.println("Response headers: " + e.getResponseHeaders());
39 throw new RuntimeException("Failed to authorize to API", e);
40 } catch (NumberFormatException e) {
41 throw new RuntimeException("Port needs to be a valid integer", e);
42 }
43 }
44}
Full Example
A more complete example of using the Java SDK is forthcoming.