Skip to content
Snippets Groups Projects
Commit 2806ca38 authored by Klaus Fischer's avatar Klaus Fischer
Browse files

Updated docu

parents 7cf1d6c7 cd932cc6
No related branches found
No related tags found
1 merge request!3Feature/440 mvp net sdk part 1
# Example
```csharp
async Task AbstractCall() {
var client = new Client(
FitConnectEndpoints.Create(FitConnectEndpoints.EndpointType.Development),
"clientId", "clientSecret");
var success = await client.SendSubmissionAsync(new Submission());
var submissions = await client.GetSubmissionsAsync("destinationId");
foreach (var submission in submissions) Console.WriteLine(submission.Id);
}
```
# Example # Example
```csharp ## Sender
using FitConnect;
using FitConnect.Models;
```
## The easy way to call the FitConnect API
```csharp
async Task AbstractCall() {
var client = new Client(
FitConnectEndpoints.Create(FitConnectEndpoints.EndpointType.Development),
"clientId", "clientSecret");
var success = await client.SendSubmissionAsync(new Submission());
var submissions = await client.GetSubmissionsAsync("destinationId");
foreach (var submission in submissions) Console.WriteLine(submission.Id);
}
```
## The more verbose way to call the FitConnect API
### The Fluent Sender Api call
```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());
}
```
### Here to call the **Sender** interface
```csharp ```csharp
void DetailSenderCall() { void DetailSenderCall() {
...@@ -53,11 +15,9 @@ void DetailSenderCall() { ...@@ -53,11 +15,9 @@ void DetailSenderCall() {
``` ```
### Here to call the **Subscriber** interface ## Subscriber
```csharp ```csharp
async Task DetailSubscriberCall() { async Task DetailSubscriberCall() {
var subscriber = var subscriber =
new Subscriber( new Subscriber(
...@@ -67,5 +27,4 @@ async Task DetailSubscriberCall() { ...@@ -67,5 +27,4 @@ async Task DetailSubscriberCall() {
.... ....
*/ */
} }
``` ```
\ No newline at end of file
...@@ -2,6 +2,84 @@ ...@@ -2,6 +2,84 @@
## Introduction ## Introduction
## Examples The SDK supports a high-level support as well as a low-level support for the
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.
### 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
### 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](./example.md)
# 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
client.Subscriber
.Authenticate(clientId!, clientSecret!)
.GetSubmission("destinationId", "submissionId", out var _)
.GetAttachments(out var _)
.DecryptAttachments(out var _)
.DecryptData(out var _)
.DecryptMetadata(out var _)
.ConfirmSubmission();
```
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