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

Submitting with dummy client

parent 03321f5f
No related branches found
No related tags found
1 merge request!3Feature/440 mvp net sdk part 1
...@@ -17,4 +17,10 @@ ...@@ -17,4 +17,10 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Update="Test.pdf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project> </Project>
...@@ -4,27 +4,34 @@ using FitConnect.Models; ...@@ -4,27 +4,34 @@ using FitConnect.Models;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Abstractions;
var clientId = "";
var clientSecret = "";
PublicKey publicKey;
ILogger _logger; ILogger _logger;
Client client; Client client;
X509Certificate2 certificate; X509Certificate2 certificate;
var destinationId = "aa3704d6-8bd7-4d40-a8af-501851f93934";
var leikaKey = "urn:de:fim:leika:leistung:99400048079000";
var clientSecret = "rdlXms-4ikO47AbTmmCTdzFoE4cTSt13JmSbcY5Dhsw";
var clientId = "73a8ff88-076b-4263-9a80-8ebadac97b0d";
void FluentSenderCall() { void FluentSenderCall() {
client.GetSender()
.WithDestination("destinationId") new Client(
.WithServiceType("", "") FitConnectEndpoints.Create(FitConnectEndpoints.EndpointType.Development),
.WithAttachments(Array.Empty<Attachment>()) clientId, clientSecret,
logger: _logger).GetSender()
.WithDestination(destinationId)
.WithServiceType("ServiceName", leikaKey)
.WithAttachments(new List<Attachment>() {
new Attachment {
Id = Guid.NewGuid().ToString(),
Content = File.ReadAllBytes("Test.pdf"),
MimeType = "application/pdf",
Description = "The description of the attachment",
Purpose = "attachment"
}
})
.WithData("{\"data\":\"value\"}") .WithData("{\"data\":\"value\"}")
.Submit(); .Submit();
client.GetSender()
.WithDestination("destinationId")
.WithServiceType("", "")
.WithAttachments(Array.Empty<Attachment>())
.Submit();
} }
void FluentSubscriberCall() { void FluentSubscriberCall() {
...@@ -38,23 +45,23 @@ void FluentSubscriberCall() { ...@@ -38,23 +45,23 @@ void FluentSubscriberCall() {
}); });
} }
var logger = LoggerFactory.Create( _logger = LoggerFactory.Create(
builder => { builder => {
builder.AddSimpleConsole(); builder.AddSimpleConsole();
builder.SetMinimumLevel(LogLevel.Information); builder.SetMinimumLevel(LogLevel.Information);
}).CreateLogger("FluentSenderTests"); }).CreateLogger("FluentSenderTests");
logger.Log(LogLevel.Information, _logger.Log(LogLevel.Information,
"This is a dummy client to demonstrate the usage of the FIT-Connect SDK for .NET"); "This is a dummy client to demonstrate the usage of the FIT-Connect SDK for .NET");
client = new Client( client = new Client(
FitConnectEndpoints.Create(FitConnectEndpoints.EndpointType.Development), FitConnectEndpoints.Create(FitConnectEndpoints.EndpointType.Development),
"clientId", "clientSecret", clientId, clientSecret,
logger: logger); logger: _logger);
Console.WriteLine( Console.WriteLine(
"This is a dummy client to demonstrate the usage of the FIT-Connect SDK for .NET"); "This is a dummy client to demonstrate the usage of the FIT-Connect SDK for .NET");
FluentSenderCall(); FluentSenderCall();
FluentSubscriberCall(); // FluentSubscriberCall();
File added
...@@ -26,7 +26,8 @@ namespace FitConnect; ...@@ -26,7 +26,8 @@ namespace FitConnect;
/// .Authenticate(clientId!, clientSecret!) /// .Authenticate(clientId!, clientSecret!)
/// .CreateSubmission(new Submission { Attachments = new List() }) /// .CreateSubmission(new Submission { Attachments = new List() })
/// .UploadAttachments() /// .UploadAttachments()
/// .SendSubmission(new Metadata(), new Data()); /// .WithData(data)
/// .Subm@it();
/// </code> /// </code>
/// </example> /// </example>
public class FluentSender : Sender, IFluentSender, IFluentSenderWithDestination, public class FluentSender : Sender, IFluentSender, IFluentSenderWithDestination,
......
...@@ -6,7 +6,7 @@ using FitConnect.Models.Api.Metadata; ...@@ -6,7 +6,7 @@ using FitConnect.Models.Api.Metadata;
namespace FitConnect.Models; namespace FitConnect.Models;
public class Attachment { public class Attachment {
public string? Id { get; init; } public string Id { get; init; }
public byte[]? Content { get; init; } public byte[]? Content { get; init; }
......
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