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 Details

  • Method Details

    • 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(SenderId senderId, 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:
    • 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 gitt orgnr, dersom aktuelt, eller null.
      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:
    • 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()` It can also be used by the url supplied by `archive.getNextDocumentsWithAttributes(Map.of("MyKey", "MyVal")` This will return paged results that matches the attributes supplied. More attributes narrows the search (S1 AND S2).
      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 brokerId
      offset - Number of documents to skip. For pagination
      limit - 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)
    • addTag

      public void addTag(Tag tag)
    • removeTag

      public void removeTag(Tag tag)
    • getTags

      public Tags getTags(PersonalIdentificationNumber personalIdentificationNumber)
    • getShareDocumentsRequestState

      public ShareDocumentsRequestState getShareDocumentsRequestState(SenderId senderId, UUID shareDocumentsRequestUuid)
    • getSharedDocumentContentStream

      public InputStream getSharedDocumentContentStream(URI uri)
    • getSharedDocumentContent

      public SharedDocumentContent getSharedDocumentContent(URI uri)
    • stopSharing

      public org.apache.http.client.methods.CloseableHttpResponse stopSharing(SenderId senderId, URI uri)
    • archiveDocuments

      public ArchiveApi.ArchivingDocuments archiveDocuments(Archive archive)
    • getArchiveDocumentByUuid

      public Archive getArchiveDocumentByUuid(UUID uri)
    • getArchiveDocumentByUuid

      public Archive getArchiveDocumentByUuid(SenderId senderId, UUID uuid)
    • 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(URI archiveDocument)
    • updateArchiveDocument

      public ArchiveDocument updateArchiveDocument(ArchiveDocument archiveDocument, URI uri)
    • createBatch

      public Batch createBatch(UUID batchUUID)
    • getBatchInformation

      public Batch getBatchInformation(UUID batchUUID)
    • completeBatch

      public Batch completeBatch(Batch batch)
    • cancelBatch

      public void cancelBatch(Batch batch)