/// <summary>
 /// Sends a single document to a citizen/company.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='subscriptionId'>
 /// Id of LoGIC subscription
 /// </param>
 /// <param name='request'>
 /// Request body
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <SendMessageResponse> SendSingleDocumentAsync(this IDigitalPostClient operations, System.Guid subscriptionId, SendDocumentRequest request = default(SendDocumentRequest), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.SendSingleDocumentWithHttpMessagesAsync(subscriptionId, request, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
예제 #2
0
        public async Task NotifyCitizen(string cpr, string message)
        {
            IronPdf.HtmlToPdf renderer = new IronPdf.HtmlToPdf();
            using (var stream = renderer.RenderHtmlAsPdf($"<h1>Hello {cpr}<h1>").Stream)
            {
                var attachment = await _digitalPostClient.UploadAttachmentWithHttpMessagesAsync(_subscriptionId, stream);

                await _digitalPostClient.SendSingleDocumentWithHttpMessagesAsync(
                    _subscriptionId,
                    new SendDocumentRequest
                {
                    Identifier         = cpr,
                    IdentifierType     = "cpr",
                    Title              = "You have been stalked",
                    ConfigurationId    = _configurationId,
                    ContentReferenceId = attachment.Body.ReferenceId,
                    MaterialId         = "signering",
                    ContentExtension   = "pdf"
                });
            }
        }