Package no.digipost.api.client
Class DigipostClient
- java.lang.Object
-
- no.digipost.api.client.DigipostClient
-
public class DigipostClient extends Object
En klient for å sende brev gjennom Digipost. Hvis et objekt av denne klassen er opprettet med et fungerende sertifikat og tilhørende passord, kan man gjøre søk og sende brev gjennom Digipost.
-
-
Constructor Summary
Constructors Constructor Description DigipostClient(DigipostClientConfig config, BrokerId brokerId, Signer signer)
DigipostClient(DigipostClientConfig config, BrokerId brokerId, Signer signer, org.apache.http.impl.client.HttpClientBuilder clientBuilder)
DigipostClient(DigipostClientConfig config, MessageDeliveryApi apiService, InboxApi inboxApiService, DocumentApi documentApi, ArchiveApi archiveApi)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addData(AddDataLink addDataLink, AdditionalData data)
Archive
addUniqueUUIDToArchiveDocument(UUID uuid, UUID newuuid)
Archive
addUniqueUUIDToArchiveDocument(SenderId senderId, UUID uuid, UUID newuuid)
ArchiveApi.ArchivingDocuments
archiveDocuments(Archive archive)
OngoingDelivery.WithPrintFallback
createMessage(Message message)
Oppretter en forsendelse for sending gjennom Digipost.UserAccount
createOrActivateUserAccount(SenderId senderId, UserInformation user)
OngoingDelivery.ForPrintOnly
createPrintOnlyMessage(Message printMessage)
Opprette forsendelse som skal gå direkte til print og videre til utsending gjennom vanlig postgang.void
deleteArchiveDocument(ArchiveDocument archiveDocument)
void
deleteInboxDocument(InboxDocument inboxDocument)
Delets the given document from the serverArchive
getArchiveDocumentByUuid(UUID uri)
Archive
getArchiveDocumentByUuid(SenderId senderId, UUID uuid)
ArchiveDocumentContent
getArchiveDocumentContent(URI uri)
InputStream
getArchiveDocumentContentStream(URI uri)
Archive
getArchiveDocuments(URI uri)
An Archive has an optional URL to fetch documents paged 100 at a time.Archives
getArchiveDocumentsByReferenceId(SenderId senderId, String referenceId)
Archives
getArchives()
Get a list of all the archivesArchives
getArchives(SenderId senderId)
Get a list of all the archives for the organisation represented by senderId.Autocomplete
getAutocompleteSuggestions(String searchString)
InputStream
getContent(String path)
DocumentEvents
getDocumentEvents(String organisation, String partId, ZonedDateTime from, ZonedDateTime to, int offset, int maxResults)
DocumentEvents
getDocumentEvents(ZonedDateTime from, ZonedDateTime to, int offset, int maxResults)
DocumentStatus
getDocumentStatus(Link linkToDocumentStatus)
DocumentStatus
getDocumentStatus(SenderId senderId, UUID uuid)
Inbox
getInbox(SenderId senderId)
Get the first 100 documents in the inbox for the organisation represented by senderId.Inbox
getInbox(SenderId senderId, int offset, int limit)
Get documents from the inbox for the organisation represented by senderId.InputStream
getInboxDocumentContent(InboxDocument inboxDocument)
Get the content of a document as a stream.SenderInformation
getSenderInformation(String orgnr, String avsenderenhet)
Hent informasjon om en gitt avsender.SenderInformation
getSenderInformation(SenderId senderId)
Hent informasjon om en gitt avsender.IdentificationResult
identifyRecipient(Identification identification)
Recipients
search(String searchString)
-
-
-
Constructor Detail
-
DigipostClient
public DigipostClient(DigipostClientConfig config, BrokerId brokerId, Signer signer)
-
DigipostClient
public DigipostClient(DigipostClientConfig config, BrokerId brokerId, Signer signer, org.apache.http.impl.client.HttpClientBuilder clientBuilder)
-
DigipostClient
public DigipostClient(DigipostClientConfig config, MessageDeliveryApi apiService, InboxApi inboxApiService, DocumentApi documentApi, ArchiveApi archiveApi)
-
-
Method Detail
-
createMessage
public OngoingDelivery.WithPrintFallback createMessage(Message message)
Oppretter en forsendelse for sending gjennom Digipost. Dersom mottaker ikke er digipostbruker og det ligger printdetaljer på forsendelsen bestiller vi print av brevet til vanlig postgang. (Krever at avsender har fått tilgang til print.)
-
createPrintOnlyMessage
public OngoingDelivery.ForPrintOnly createPrintOnlyMessage(Message printMessage)
Opprette forsendelse som skal gå direkte til print og videre til utsending gjennom vanlig postgang. Krever at avsender har tilgang til å sende direkte til print.
-
identifyRecipient
public IdentificationResult identifyRecipient(Identification identification)
-
addData
public void addData(AddDataLink addDataLink, AdditionalData data)
-
search
public Recipients search(String searchString)
-
getAutocompleteSuggestions
public Autocomplete getAutocompleteSuggestions(String searchString)
-
getDocumentEvents
public DocumentEvents getDocumentEvents(ZonedDateTime from, ZonedDateTime to, int offset, int maxResults)
-
getDocumentEvents
public DocumentEvents getDocumentEvents(String organisation, String partId, ZonedDateTime from, ZonedDateTime to, int offset, int maxResults)
-
getSenderInformation
public SenderInformation getSenderInformation(SenderId senderId)
Hent informasjon om en gitt avsender. Kan enten be om informasjon om "deg selv", eller en avsender du har fullmakt til å sende post for.- Parameters:
senderId
- avsender-IDen til avsenderen du vil ha informasjon om.- Returns:
- informasjon om avsenderen, dersom den finnes, og du har tilgang til å informasjon om avsenderen. Det er ikke mulig å skille på om avsenderen ikke finnes, eller man ikke har tilgang til informasjonen.
- See Also:
SenderInformation
-
getSenderInformation
public SenderInformation getSenderInformation(String orgnr, String avsenderenhet)
Hent informasjon om en gitt avsender. Kan enten be om informasjon om "deg selv", eller en avsender du har fullmakt til å sende post for.- Parameters:
orgnr
- organisasjonsnummeret til avsenderen (påkrevet).avsenderenhet
- underenhet for gittorgnr
, dersom aktuelt, ellernull
.- Returns:
- informasjon om avsenderen, dersom den finnes, og du har tilgang til å informasjon om avsenderen. Det er ikke mulig å skille på om avsenderen ikke finnes, eller man ikke har tilgang til informasjonen.
- See Also:
SenderInformation
-
getDocumentStatus
public DocumentStatus getDocumentStatus(Link linkToDocumentStatus)
-
getDocumentStatus
public DocumentStatus getDocumentStatus(SenderId senderId, UUID uuid)
-
getContent
public InputStream getContent(String path)
-
getArchives
public Archives getArchives()
Get a list of all the archives- Returns:
- An Archives contains a list of archives
-
getArchives
public Archives getArchives(SenderId senderId)
Get a list of all the archives for the organisation represented by senderId.- Parameters:
senderId
- Either an organisation that you operate on behalf of or your brokerId- Returns:
- An Archives contains a list of archives
-
getArchiveDocuments
public Archive getArchiveDocuments(URI uri)
An Archive has an optional URL to fetch documents paged 100 at a time. Eg.: `archive.getNextDocuments()` This Optional URI cat be put into this method to fetch that page of documents. We supply this fuctionality so that senders can use it to get an idea of the content of an archive. However it's use is strongly discouraged because it leads to the idea that an archive can be itereated. We expect an archive to possibly reach many million rows so the iteration will possibly give huge loads. On the other hand being able to dump all data is a nessary feature of any archive. Please use fetch document by UUID or referenceID instead to create functionality on top of the archive.- Parameters:
uri
- URI supplied by the api with Relation NEXT_DOCUMENTS- Returns:
- An archive with documents.
-
getInbox
public Inbox getInbox(SenderId senderId)
Get the first 100 documents in the inbox for the organisation represented by senderId.- Parameters:
senderId
- Either an organisation that you operate on behalf of or your brokerId- Returns:
- Inbox element with the 100 first documents
-
getInbox
public Inbox getInbox(SenderId senderId, int offset, int limit)
Get documents from the inbox for the organisation represented by senderId.- Parameters:
senderId
- Either an organisation that you operate on behalf of or your brokerIdoffset
- Number of documents to skip. For paginationlimit
- Maximum number of documents to retrieve (max 1000)- Returns:
- Inbox element with the n=limit first documents
-
getInboxDocumentContent
public InputStream getInboxDocumentContent(InboxDocument inboxDocument)
Get the content of a document as a stream. The content is streamed from the server so remember to close the stream to prevent connection leaks.- Parameters:
inboxDocument
- The document to get content for- Returns:
- Entire content of the document as a stream
-
deleteInboxDocument
public void deleteInboxDocument(InboxDocument inboxDocument)
Delets the given document from the server- Parameters:
inboxDocument
- The document to delete
-
createOrActivateUserAccount
public UserAccount createOrActivateUserAccount(SenderId senderId, UserInformation user)
-
archiveDocuments
public ArchiveApi.ArchivingDocuments archiveDocuments(Archive archive)
-
addUniqueUUIDToArchiveDocument
public Archive addUniqueUUIDToArchiveDocument(UUID uuid, UUID newuuid)
-
addUniqueUUIDToArchiveDocument
public Archive addUniqueUUIDToArchiveDocument(SenderId senderId, UUID uuid, UUID newuuid)
-
getArchiveDocumentsByReferenceId
public Archives getArchiveDocumentsByReferenceId(SenderId senderId, String referenceId)
-
getArchiveDocumentContent
public ArchiveDocumentContent getArchiveDocumentContent(URI uri)
-
getArchiveDocumentContentStream
public InputStream getArchiveDocumentContentStream(URI uri)
-
deleteArchiveDocument
public void deleteArchiveDocument(ArchiveDocument archiveDocument)
-
-