diff --git a/DummyClient/Program.cs b/DummyClient/Program.cs index 59c40192457f14056e5f1cebe3f6aed60f553207..631e14d13e36daf830236bf87cb9f4d79ed43099 100644 --- a/DummyClient/Program.cs +++ b/DummyClient/Program.cs @@ -11,21 +11,6 @@ ILogger _logger; Client client; X509Certificate2 certificate; -/* - * The easy way to call the FitConnect API - */ -async Task AbstractCall() { - 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); -} - void FluentSenderCall() { client.Sender @@ -46,39 +31,10 @@ void FluentSubscriberCall() { .GetAvailableSubmissions(); client.Subscriber.RequestSubmission("submissionId") - .GetAttachments(); -} - -/* - * The more verbose way to call the FitConnect API - * Here to call the **Sender** interface - */ -async Task DetailSenderCall() { - var sender = - Sender.Create( - FitConnectEndpoints.Create(FitConnectEndpoints.EndpointType.Development), certificate); - - var submissionDto = sender.AddSubmission(new Submission()); - var encryptedAttachments = sender.Encrypt(publicKey, new List<Attachment>()); - var success = await sender.UploadAttachmentsAsync(encryptedAttachments); - var encryptedMetadata = sender.Encrypt(publicKey, new Metadata()); - var encryptedData = sender.Encrypt(publicKey, new Data()); - success = await sender.SubmitAsync(encryptedData, encryptedMetadata); -} - -/* - * The more verbose way to call the FitConnect API - * Here to call the **Subscriber** interface - */ - -async Task DetailSubscriberCall() { - var subscriber = - Subscriber.Create( - FitConnectEndpoints.Create(FitConnectEndpoints.EndpointType.Development), certificate); - var submissions = await subscriber.GetSubmissionsAsync("destinationId"); - /* - .... - */ + .GetAttachments((attachments => { + // Check if the attachments are valid + return true; + })); } diff --git a/FitConnect/Interfaces/IFluentApi.cs b/FitConnect/Interfaces/IFluentApi.cs index 8dc63796b1f8e6aadb08675f1c2edbdb35aa266d..7c20219963aae373bb9d2f4f863a4d1c0a933e5d 100644 --- a/FitConnect/Interfaces/IFluentApi.cs +++ b/FitConnect/Interfaces/IFluentApi.cs @@ -36,7 +36,8 @@ public interface IFluentSubscriber { public interface IFluentSubscriberWithSubmission { public Submission Submission { get; } - public IEnumerable<Attachment> GetAttachments(); + public IFluentSenderWithAttachments GetAttachments( + Func<IEnumerable<Attachment>, bool> canSubmitSubmission); public void ConfirmSubmission(string submissionId); }