-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from digipost/document_status
Add support to fetch DocumentStatus for a sent document
- Loading branch information
Showing
16 changed files
with
349 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Digipost.Api.Client.Common.Enums | ||
{ | ||
public enum HashAlgoritm | ||
{ | ||
NONE, | ||
MD5, | ||
SHA256 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using Digipost.Api.Client.Common; | ||
using Digipost.Api.Client.Send; | ||
|
||
namespace Digipost.Api.Client.Docs | ||
{ | ||
public class DocumentsExamples | ||
{ | ||
private static readonly DigipostClient client; | ||
private static readonly Sender sender; | ||
|
||
public void Hent_document_status() | ||
{ | ||
DocumentStatus documentStatus = client.GetDocumentStatus(sender) | ||
.GetDocumentStatus(Guid.Parse("10ff4c99-8560-4741-83f0-1093dc4deb1c")) | ||
.Result; | ||
|
||
// example information: | ||
// documentStatus.DeliveryStatus => DELIVERED | ||
// documentStatus.DeliveryMethod => PRINT | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using System; | ||
using Digipost.Api.Client.Common; | ||
using Digipost.Api.Client.Common.Enums; | ||
|
||
namespace Digipost.Api.Client.Send | ||
{ | ||
public class DocumentStatus | ||
{ | ||
public DocumentStatus( | ||
string guid, | ||
long senderId, | ||
DateTime created, | ||
DocumentDeliveryStatus documentDeliveryStatus, | ||
Read? read, | ||
DeliveryMethod deliveryMethod, | ||
string contentHash, | ||
DateTime? delivered, | ||
Boolean? isPrimaryDocument, | ||
HashAlgoritm? contentHashAlgoritm | ||
) | ||
{ | ||
Guid = guid; | ||
Sender = new Sender(senderId); | ||
Created = created; | ||
DeliveryStatus = documentDeliveryStatus; | ||
DocumentRead = read; | ||
DeliveryMethod = deliveryMethod; | ||
ContentHash = contentHash; | ||
Delivered = delivered; | ||
IsPrimaryDocument = isPrimaryDocument; | ||
ContentHashAlgoritm = contentHashAlgoritm; | ||
} | ||
|
||
public string Guid { get; } | ||
|
||
public Sender Sender { get; } | ||
|
||
public DateTime Created { get; } | ||
|
||
/** | ||
* If DeliveryStatus is NOT_DELIVERED, Delivered will not have a value | ||
*/ | ||
public DateTime? Delivered { get; } | ||
|
||
public DocumentDeliveryStatus DeliveryStatus { get; } | ||
|
||
public Read? DocumentRead { get; } | ||
|
||
public DeliveryMethod DeliveryMethod { get; } | ||
|
||
public String ContentHash { get; } | ||
|
||
public HashAlgoritm? ContentHashAlgoritm { get; } | ||
|
||
/** | ||
* isPrimaryDocument has value only if you ask api are the actual sender asking for DocumentStatus. | ||
* If you are, then this will be true for the primary document else false. | ||
*/ | ||
public Boolean? IsPrimaryDocument { get; } | ||
|
||
public enum DocumentDeliveryStatus | ||
{ | ||
/** | ||
* The document has been delivered | ||
*/ | ||
DELIVERED, | ||
|
||
/** | ||
* The document is still being processed | ||
*/ | ||
NOT_DELIVERED | ||
} | ||
|
||
/** | ||
* Indicates whether the document is read or not | ||
*/ | ||
public enum Read | ||
{ | ||
YES, | ||
NO | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.