-
Klaus Fischer authoredKlaus Fischer authored
example.md 1.18 KiB
Example
using FitConnect;
using FitConnect.Models;
The easy way to call the FitConnect API
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
Here to call the Sender interface
void DetailSenderCall() {
var sender =
new Sender(
FitConnectEndpoints.Create(FitConnectEndpoints.EndpointType.Development));
sender.CreateSubmissionDto(new Submission());
/*
....
*/
}
Here to call the Subscriber interface
async Task DetailSubscriberCall() {
var subscriber =
new Subscriber(
FitConnectEndpoints.Create(FitConnectEndpoints.EndpointType.Development));
var submissions = await subscriber.GetSubmissionsAsync("destinationId");
/*
....
*/
}