Skip to content
Snippets Groups Projects
Program.cs 1.15 KiB
Newer Older
using System;
using FitConnect;
using FitConnect.Models;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;

Client client;


void FluentSenderCall() {
    client.Sender
        .WithDestination("destinationId")
        .WithAttachments(Array.Empty<Attachment>())
        .WithData(@"{""data"":""content""}")
        .Submit();

    client.Sender
        .WithDestination("destinationId")
        .WithAttachments(Array.Empty<Attachment>())
        .Submit();
}

void FluentSubscriberCall() {
    var submissions = client.Subscriber
Klaus Fischer's avatar
Klaus Fischer committed
        .GetAvailableSubmissions("destinationId");

    client.Subscriber.RequestSubmission("submissionId")
        .GetAttachments((attachments => {
            // Check if the attachments are valid
            return true;
        }));
}


ILogger logger = new Logger<AppDomain>(new NullLoggerFactory());
client = new Client(
    FitConnectEnvironments.Create(FitConnectEnvironments.EndpointType.Development),
    "clientId", "clientSecret",
    logger);

Console.WriteLine(
    "This is a dummy client to demonstrate the usage of the FitConnect SDK for .NET");

FluentSenderCall();
FluentSubscriberCall();