Skip to content

Commit 95a8524

Browse files
author
Asgeir Nilsen
committed
Updated readme.
1 parent e81f86f commit 95a8524

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,7 @@ __pycache__/
286286
*.btp.cs
287287
*.btm.cs
288288
*.odx.cs
289-
*.xsd.cs
289+
*.xsd.cs
290+
291+
# Visual Studio Code
292+
/.vscode/

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
11
# FINT.Model.Resource
22

33
FINT Resource Model contains the core classes for FINT data models containing HATEOAS relations.
4+
5+
## Usage
6+
7+
To add links to other resources, FINT resource classes contain `addXXX(Link)` methods for producing
8+
specific links.
9+
10+
Links are URIs, typically https URIs. The `Link` class has a static `Link.with(String)` that can be
11+
used if the full URI to the target is known.
12+
13+
## Robust links
14+
15+
Full https URIs are sensitive to changes in the FINT API deployment configuration. To ensure that
16+
links are robust, the FINT APIs also support convenience methods that enables implementors to
17+
generate links when the target Java class is known. In these cases the methods
18+
`Link.with(Link, String...)` or `Link.with(Type, String)` come in handy. The first argument is the
19+
Java class of the target resource, so to link to a `Person` you use
20+
`Link.with(typeof(Person), ...)`.
21+
22+
The second parameter(s) are the path element that specify the identifier for the target. They are
23+
typically built using two fields, the name of the identifier field, and the identifier value. To
24+
produce a link to a `Person` with a `fodselsnummer` of `12345678901`, this becomes:
25+
26+
```csharp
27+
Link linktoPerson = Link.with(typeof(Person), "fodselsnummer", "12345678901");
28+
```

0 commit comments

Comments
 (0)