Skip to content

Commit 4b112d5

Browse files
committed
Improved readme
1 parent 8a83a0a commit 4b112d5

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
11
# ![TypedRest](logo.svg) for Java
22

33
[![Build status](https://img.shields.io/appveyor/ci/TypedRest/TypedRest-Java.svg)](https://ci.appveyor.com/project/TypedRest/TypedRest-Java)
4-
TypedRest for Java helps you build type-safe, fluent-style REST API clients.
5-
6-
Common REST patterns such as collections are represented as classes, allowing you to write more idiomatic code. For example, TypedRest lets you turn this:
4+
TypedRest for Java helps you build type-safe, fluent-style REST API clients. Common REST patterns such as collections are represented as classes, allowing you to write more idiomatic code.
75

86
```java
9-
HttpRequest request = HttpRequest.newBuilder().uri(URI.create("http://example.com/contacts/123")).build();
10-
HttpResponse<> response = HttpClient.newHttpClient().send(request, BodyHandlers.ofString());
11-
Contact contact = objectMapper.readValue(response.body(), Contact.class);
12-
```
7+
MyClient client = new MyClient(URI.create("http://example.com/"));
138

14-
into this:
9+
// GET /contacts
10+
List<Contact> contactList = client.getContacts().readAll();
1511

16-
```java
17-
MyServiceClient myService = new MyServiceClient(URI.create("http://example.com/"));
18-
Contact contact = myService.getContacts().get("123").read();
12+
// POST /contacts
13+
client.getContacts().create(new Contact("smith"));
14+
15+
// GET /contacts/smith
16+
Contact contact = client.getContacts().get("smith").read();
17+
18+
// DELETE /contacts/smith
19+
client.getContacts().get("smith").delete();
20+
21+
// PUT /contacts/smith/note
22+
client.getContacts().get("smith").getNote().set(new Note("some note"));
23+
24+
// GET /contacts/smith/note
25+
Note note = client.getContacts().get("smith").getNote().read();
1926
```
2027

28+
Read an **[Introduction](https://typedrest.net/introduction/)** to TypedRest or jump right in with the **[Getting started](https://typedrest.net/getting-started/java/)** guide.
29+
30+
For information about specific Java classes or interfaces you can read the **[API Documentation](https://java.typedrest.net/)**.
31+
2132
## Maven artifacts
2233

2334
Artifact group: `com.oneandone`
@@ -33,10 +44,3 @@ Build [Vaadin](https://vaadin.com/) GUIs for TypedRest clients.
3344

3445
[![typedrest-archetype](https://img.shields.io/maven-central/v/com.oneandone/typedrest-archetype.svg?label=typedrest-archetype)](https://mvnrepository.com/artifact/com.oneandone/typedrest-archetype)
3546
[Maven archetype](https://maven.apache.org/guides/introduction/introduction-to-archetypes.html) (template) for creating TypedRest projects.
36-
37-
38-
## Documentation
39-
40-
Read an **[Introduction](https://typedrest.net/introduction/)** to TypedRest or jump right in with the **[Getting started](https://typedrest.net/getting-started/java/)** guide.
41-
42-
For information about specific classes or interfaces you can read the **[API Documentation](https://java.typedrest.net/)**.

0 commit comments

Comments
 (0)