## Client Module

### API Flow

The SdkClientFactory provides fluent API client both for **Sender** and **Subscriber**.

As the flow chart below shows, the fluent client guides through all essentials calls in order to hand in a correct **
Submission**.

#### Api client flow for sending a submission

For the actual sender client those calls look like this:


<table>
<tr>
<th>Workflow</th>
<th>Java sample calls</th>
</tr>
<tr>
<td>

```mermaid
flowchart TD

A[Create Client] --> B(Provide DestinationID)
B -->|get encryption key| C[Add Attachments]
C -->|send| D[SubmissionForPickup]
C -->|next| E[Add Data]
E -->|send| D[SubmissionForPickup]
```

</td>
<td>

```java

List<File> attachments...

// Send without data
        ClientFactory.senderClient()
        .withDestination(UUID.randomUUID())
        .withAttachments(attachments)
        .submit();

// Send with data
        ClientFactory.senderClient()
        .withDestination(UUID.randomUUID())
        .withAttachments(attachments)
        .withData("some json or xml content")
        .submit();
```

</td>
</tr>
</table>

#### Api client flow for subscribing to a submission

```mermaid
flowchart TD

A[retrieveOAuthToken] --> B(Upload)
B -->|uploadAttachment| C[Result 1]
B -->|uploadData| D[Result 2]
```