Skip to content
Snippets Groups Projects
Commit 6a50ac92 authored by Martin Vogel's avatar Martin Vogel
Browse files

refactor(docu): add demo example calls

parent 4b06c662
No related branches found
No related tags found
No related merge requests found
......@@ -68,47 +68,51 @@ _The following steps show how to get the SDK running_
var config = ApplicationConfigLoader.loadConfig("absolute/path/to/config.yml");
var senderClient = ClientFactory.senderClient(config);
````
<p align="right">(<a href="#top">back to top</a>)</p>
### External Configuration
Configuration properties e.g. for REST-API urls and proxy settings can be found in the YAML config ``config.yml`` within the root folder of the project.
In order to run the SDK client a configuration needs to be provided as file in the same path as the jar (e.g. when the commandline client is used) or via reference using the environment variable ``FIT_CONNECT_CONFIG`` (e.g. when the SDK is used programmatically).
<p align="right">(<a href="#top">back to top</a>)</p>
## Usage
#### Sending
### Hand in new submission
```java
ClientFactory.senderClient(config)
.newSubmission()
.withAttachment(Path.of("path/to/attachment.txt").toFile()) // optional
.withJsonData("{ foo: 'bar'}")
.withDestination(UUID.fromString("destinationId"))
.withServiceType("TestService", "Führerscheinbeantragung", "urn:de:fim:leika:leistung:99400048079000")
.submit();
```
List<File> attachments = ... // Load e.g from local file system
ClientFactory.senderClient()
.withDestination(UUID.randomUUID())
.withServiceType("ServiceName", "leika:key:service")
.withAttachments(attachments)
.withJsonData("{ caseSpecific: 'Data' }")
### Hand in already encrypted submission (e.g. from frontend)
```java
ClientFactory.senderClient(config)
.newSubmissionWithEncryptedData("$encrpyt€ed d@t@")
.withEncryptedAttachment(UUID.fromString("attachmentId"), "$encrpyt€ed @tt@chment")
.withEncryptedJsonData("{$encrpyt€ed json}")
.withEncryptedMetadata("$encrpyt€ed metadata")
.withDestination(UUID.fromString("destinationId"))
.withServiceType("TestService", "Führerscheinbeantragung", "urn:de:fim:leika:leistung:99400048079000")
.submit();
```
#### Subscribing
### Retrieve public encryption key
```java
Optional<String> jweKey = ClientFactory.subscriberClient(config).getPublicKey(UUID.fromString("destinationId"));
```
var client = ClientFactory.subscriberClient();
### List all submissions for a destination
var submissions = client.getAvailableSubmissions(destinationId);
var submissionId = ... // filter submission list for requested one ...
var submission = client.requestSubmission(submissionId)
submission.getAttachments();
submission.getMetadata();
submission.getData();
```java
Set<SubmissionForPickup> submissions = ClientFactory.subscriberClient(config).getAvailableSubmissions(UUID.fromString("destinationId"));
```
### Receive single submission
```java
Optional<ReceivedSubmission> submission = ClientFactory.subscriberClient(config).requestSubmission(UUID.fromString("destinationId"));
```
<p align="right">(<a href="#top">back to top</a>)</p>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment