From cd932cc649fbb1a07e709cc6f6e2f95ece0f4a20 Mon Sep 17 00:00:00 2001
From: Klaus Fischer <klaus.fischer@eloware.com>
Date: Mon, 13 Jun 2022 17:09:57 +0200
Subject: [PATCH] Updated documentation

---
 Documentation/documentation.md | 74 +++++++++++++++++++++++++++++++---
 Documentation/fluent_api.md    | 48 +++++++++++++++++-----
 2 files changed, 106 insertions(+), 16 deletions(-)

diff --git a/Documentation/documentation.md b/Documentation/documentation.md
index c154e19c..14b6b79b 100644
--- a/Documentation/documentation.md
+++ b/Documentation/documentation.md
@@ -7,17 +7,79 @@ FitConnect API and a fluent API.
 
 ## All in one
 
-For not having to deal with the low-level API, the SDK provides a high-level support. This is
-done by the [All in one](./all_in_one.md) class.
+For not having to deal with the low-level API, the SDK provides a high-level support.
+
+### Sender
+
+```mermaid
+flowchart TD
+    client([Create a new FitConnect client])
+    send.submission[Create new Submission]
+    send.send[Send the submission]
+    send.return[\Return the result/]
+    
+    client-->send.submission-->send.send-->send.return
+    
+    
+    subscribe.request[Request submissions]
+    
+    client-->subscribe.request-->ToBeDefined
+```
+
+Simplified call:
+
+```csharp
+bool SendSubmission(Submission submission){
+    var client = new Client(...);
+    return client.SendSubmissionAsync(submission);
+}
+```
+
+### Subscriber
+
+### Example
+
+Visit [All in one](./all_in_one.md) to see the code.
 
 ## Fluent Api
 
-[Fluent Api](./fluent_api.md)
+### Sender
+
+```mermaid
+flowchart TD
+    client([Create a new FitConnect client])
+    Sender[Call the Sender interface]
+    Authenticate
+    CreateSubmission
+    UploadAttachments
+    SendSubmission
+
+    client-->Sender-->Authenticate-->CreateSubmission-->UploadAttachments-->SendSubmission
+```
+
+### Subscriber
+
+```mermaid
+flowchart TD
+    client([Create a new FitConnect client])
+    subscriber[Call the Subscriber interface]
+    get.submission["GetSubmissions(submissionId)"]
+    confirm[\Confirm the submission/]
+    
+    client-->subscriber-->authenticate-->PollSubmissions
+    authenticate-->GetSubmissions
+    authenticate-->get.submission-->GetAttachments-->DecryptAttachments-->DecryptData-->DecryptMetadata-->confirm
+```
+
+#### Polling available submissions
+
+#### Receiving list of submissions
+
+#### Receiving specific submission
+
+[Fluent Api Example](./fluent_api.md)
 
 ## Detailed calls
 
 [Detailed calls](./detailed_calls.md)
 
-## Examples
-
-[Examples](./example.md)
diff --git a/Documentation/fluent_api.md b/Documentation/fluent_api.md
index 9b88724a..2f5e4e95 100644
--- a/Documentation/fluent_api.md
+++ b/Documentation/fluent_api.md
@@ -1,14 +1,42 @@
 # Example
 
+## Sender
+
+```csharp
+client.Sender
+    .Authenticate(clientId!, clientSecret!)
+    .CreateSubmission(new Submission { Attachments = new List<Attachment>() })
+    .UploadAttachments()
+    .SendSubmission(new Metadata(), new Data());
+```
+
+## Subscriber
+
+### Polling available submissions
+
+```csharp
+client.Subscriber
+    .Authenticate(clientId!, clientSecret!)
+    .PollSubmissions("destinationId", out var _)
+```
+
+### Getting list of submissions
+
+```csharp
+client.Subscriber
+    .Authenticate(clientId!, clientSecret!)
+    .GetSubmissions("destinationId", out var _)
+```
+
+### Reading specific submission
+
 ```csharp
-void FluentSenderCall() {
-    var client =
-        new Client(FitConnectEndpoints.Create(FitConnectEndpoints.EndpointType.Development),
-            logger: _logger);
-    client.Sender
-        .Authenticate(clientId, clientSecret)
-        .CreateSubmission(new Submission())
-        .UploadAttachments(new List<Attachment>())
-        .SendSubmission(new Metadata(), new Data());
-}
+client.Subscriber
+    .Authenticate(clientId!, clientSecret!)
+    .GetSubmission("destinationId", "submissionId", out var _)
+    .GetAttachments(out var _)
+    .DecryptAttachments(out var _)
+    .DecryptData(out var _)
+    .DecryptMetadata(out var _)
+    .ConfirmSubmission();
 ```
-- 
GitLab