Skip to content

Commit

Permalink
Replace ShareDoccumentsRequestEvent with separate classes for each ac…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
hermanwh committed Nov 10, 2023
1 parent 5abea5f commit 96983b9
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 97 deletions.
8 changes: 4 additions & 4 deletions datatypes-examples.xml
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,11 @@
<purpose>We require to see your latest pay slip in order to grant you a loan.</purpose>
</share-documents-request>

<share-documents-request-event xmlns="http://api.digipost.no/schema/datatypes">
<event-type>FILES_SHARED</event-type>
<timestamp>2017-09-30T13:37:00+02:00</timestamp>
<share-documents-request-documents-shared xmlns="http://api.digipost.no/schema/datatypes">
<document-ids>123</document-ids>
</share-documents-request-event>
</share-documents-request-documents-shared>

<share-documents-request-sharing-stopped xmlns="http://api.digipost.no/schema/datatypes"/>

<signedDocument xmlns="http://api.digipost.no/schema/datatypes">
<document-issuer>Bedrift AS</document-issuer>
Expand Down
27 changes: 12 additions & 15 deletions datatypes.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

<xs:element name="share-documents-request" type="tns:shareDocumentsRequest"/>

<xs:element name="share-documents-request-event" type="tns:shareDocumentsRequestEvent"/>
<xs:element name="share-documents-request-documents-shared" type="tns:shareDocumentsRequestDocumentsShared"/>

<xs:element name="share-documents-request-sharing-stopped" type="tns:shareDocumentsRequestSharingStopped"/>

<xs:element name="signedDocument" type="tns:signedDocument"/>

Expand Down Expand Up @@ -491,29 +493,31 @@
</xs:sequence>
</xs:complexType>

<xs:complexType final="extension restriction" name="shareDocumentsRequestEvent">
<xs:complexType final="extension restriction" name="shareDocumentsRequestDocumentsShared">
<xs:sequence>
<xs:element name="event-type" type="tns:shareDocumentsRequestEventType"/>
<xs:element name="timestamp" type="xs:dateTime"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="document-ids" type="xs:long"/>
</xs:sequence>
</xs:complexType>

<xs:complexType final="extension restriction" name="shareDocumentsRequestSharingStopped">
<xs:sequence/>
</xs:complexType>

<xs:simpleType name="language">
<xs:restriction base="xs:string">
<xs:enumeration value="EN"/>
<xs:enumeration value="NN"/>
<xs:enumeration value="NB"/>
<xs:enumeration value="NN"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="status">
<xs:restriction base="xs:string">
<xs:enumeration value="UNKNOWN"/>
<xs:enumeration value="DEVIATION"/>
<xs:enumeration value="PICKED_UP"/>
<xs:enumeration value="RETURNED"/>
<xs:enumeration value="READY_FOR_PICKUP"/>
<xs:enumeration value="RETURNED"/>
<xs:enumeration value="PICKED_UP"/>
<xs:enumeration value="UNKNOWN"/>
</xs:restriction>
</xs:simpleType>

Expand All @@ -524,11 +528,4 @@
<xs:enumeration value="POSTEN"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="shareDocumentsRequestEventType">
<xs:restriction base="xs:string">
<xs:enumeration value="SHARING_STOPPED"/>
<xs:enumeration value="FILES_SHARED"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
37 changes: 23 additions & 14 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
|[Receipt](#receipt)|Receipt represents a document containing details about a purchase|
|[Residence](#residence)|Residence is a way of linking separate data for the same residence|
|[ShareDocumentsRequest](#sharedocumentsrequest)|A request for a user to share one or more documents|
|[ShareDocumentsRequestEvent](#sharedocumentsrequestevent)|An update or event related to a ShareDocumentsRequest|
|[ShareDocumentsRequestDocumentsShared](#sharedocumentsrequestdocumentsshared)|Documents have been shared for ShareDocumentsRequest|
|[ShareDocumentsRequestSharingStopped](#sharedocumentsrequestsharingstopped)|Stop sharing of documents for ShareDocumentsRequest|
|[SignedDocument](#signeddocument)|Details about a signed document|

## Appointment
Expand Down Expand Up @@ -1086,6 +1087,9 @@ Residence is a way of linking separate data for the same residence

A request for a user to share one or more documents

### Complemented by:
[ShareDocumentsRequestSharingStopped](#sharedocumentsrequestsharingstopped)

### Fields

|Name|Type|Required|Description|
Expand All @@ -1102,33 +1106,38 @@ A request for a user to share one or more documents
</share-documents-request>
```

## ShareDocumentsRequestEvent
## ShareDocumentsRequestDocumentsShared

An update or event related to a ShareDocumentsRequest
Documents have been shared for ShareDocumentsRequest

### Fields

|Name|Type|Required|Description|
|----|----|--------|-----------|
|eventType|[ShareDocumentsRequestEventType](#sharedocumentsrequesteventsharedocumentsrequesteventtype)|yes|The type of event that has occurred|
|timestamp|ZonedDateTime|yes|When the event occurred|
|documentIds|List|no|The IDs of the documents related to this specific event|

### ShareDocumentsRequestEvent.ShareDocumentsRequestEventType
### XML

Valid values:
```xml
<share-documents-request-documents-shared xmlns="http://api.digipost.no/schema/datatypes">
<document-ids>123</document-ids>
</share-documents-request-documents-shared>
```

## ShareDocumentsRequestSharingStopped

Stop sharing of documents for ShareDocumentsRequest

### Fields

|Name|Type|Required|Description|
|----|----|--------|-----------|

* FILES_SHARED
* SHARING_STOPPED

### XML

```xml
<share-documents-request-event xmlns="http://api.digipost.no/schema/datatypes">
<event-type>FILES_SHARED</event-type>
<timestamp>2017-09-30T13:37:00+02:00</timestamp>
<document-ids>123</document-ids>
</share-documents-request-event>
<share-documents-request-sharing-stopped xmlns="http://api.digipost.no/schema/datatypes"/>
```

## SignedDocument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toMap;
import static java.util.stream.Collectors.toSet;
import no.digipost.api.datatypes.types.share.ShareDocumentsRequestEvent;

import no.digipost.api.datatypes.types.share.ShareDocumentsRequestDocumentsShared;
import no.digipost.api.datatypes.types.share.ShareDocumentsRequestSharingStopped;

/**
* HOWTO: Add new data type
Expand All @@ -53,7 +55,8 @@ public enum DataTypeIdentifier {
, INVOICE(Invoice.class, "INVO", Invoice.EXAMPLE)
, INVOICE_PAYMENT(InvoicePayment.class, "INVP", InvoicePayment.EXAMPLE)
, SHARE_DOCUMENT_REQUEST(ShareDocumentsRequest.class, "SHAR", ShareDocumentsRequest.EXAMPLE)
, SHARE_DOCUMENT_REQUEST_EVENT(ShareDocumentsRequestEvent.class, "SHRE", ShareDocumentsRequestEvent.EXAMPLE)
, SHARE_DOCUMENT_REQUEST_SHARING_STOPPED(ShareDocumentsRequestSharingStopped.class, "SHSS", ShareDocumentsRequestSharingStopped.EXAMPLE)
, SHARE_DOCUMENT_REQUEST_DOCUMENTS_SHARED(ShareDocumentsRequestDocumentsShared.class, "SHDS", ShareDocumentsRequestDocumentsShared.EXAMPLE)
;

private final Class<? extends DataType> dataType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE)
@With
@Description("A request for a user to share one or more documents")
@ComplementedBy({ShareDocumentsRequestEvent.class})
@ComplementedBy({ShareDocumentsRequestSharingStopped.class})
public class ShareDocumentsRequest implements DataType {

@XmlElement(name="max-share-duration-seconds", required = true)
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package no.digipost.api.datatypes.types.share;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Value;
import lombok.With;
import no.digipost.api.datatypes.DataType;
import no.digipost.api.datatypes.documentation.Description;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "share-documents-request-sharing-stopped")
@Value
@NoArgsConstructor(force = true, access = AccessLevel.PRIVATE)
@With
@Description("Stop sharing of documents for ShareDocumentsRequest")
public class ShareDocumentsRequestSharingStopped implements DataType {

public static final ShareDocumentsRequestSharingStopped EXAMPLE = new ShareDocumentsRequestSharingStopped();

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ invoice.Invoice
invoice.InvoicePayment
Inkasso
share.ShareDocumentsRequest
share.ShareDocumentsRequestEvent
share.ShareDocumentsRequestSharingStopped
share.ShareDocumentsRequestDocumentsShared

0 comments on commit 96983b9

Please sign in to comment.