diff --git a/README.md b/README.md index 49c7f48e364557e511b86129da43bdbb33a9fadc..decd06eb97cd3a01b125d1845507a37f72cc1c1b 100644 --- a/README.md +++ b/README.md @@ -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>