Package no.digipost.api.client
Class DigipostClient
- java.lang.Object
-
- no.digipost.api.client.DigipostClient
-
public class DigipostClient extends java.lang.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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addData(AddDataLink addDataLink, AdditionalData data)
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
deleteInboxDocument(InboxDocument inboxDocument)
Delets the given document from the serverAutocomplete
getAutocompleteSuggestions(java.lang.String searchString)
java.io.InputStream
getContent(java.lang.String path)
DocumentEvents
getDocumentEvents(java.lang.String organisation, java.lang.String partId, java.time.ZonedDateTime from, java.time.ZonedDateTime to, int offset, int maxResults)
DocumentEvents
getDocumentEvents(java.time.ZonedDateTime from, java.time.ZonedDateTime to, int offset, int maxResults)
DocumentStatus
getDocumentStatus(Link linkToDocumentStatus)
DocumentStatus
getDocumentStatus(SenderId senderId, java.util.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.java.io.InputStream
getInboxDocumentContent(InboxDocument inboxDocument)
Get the content of a document as a stream.SenderInformation
getSenderInformation(java.lang.String orgnr, java.lang.String avsenderenhet)
Hent informasjon om en gitt avsender.SenderInformation
getSenderInformation(SenderId senderId)
Hent informasjon om en gitt avsender.IdentificationResult
identifyRecipient(Identification identification)
Recipients
search(java.lang.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)
-
-
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(java.lang.String searchString)
-
getAutocompleteSuggestions
public Autocomplete getAutocompleteSuggestions(java.lang.String searchString)
-
getDocumentEvents
public DocumentEvents getDocumentEvents(java.time.ZonedDateTime from, java.time.ZonedDateTime to, int offset, int maxResults)
-
getDocumentEvents
public DocumentEvents getDocumentEvents(java.lang.String organisation, java.lang.String partId, java.time.ZonedDateTime from, java.time.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(java.lang.String orgnr, java.lang.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, java.util.UUID uuid)
-
getContent
public java.io.InputStream getContent(java.lang.String path)
-
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 java.io.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)
-
-