Skip to content

Commit 0c4201f

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 0752f9c + 97683cb commit 0c4201f

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ You need a Context that explains a bit your working environment, something like:
3434

3535
```java
3636
Context context = new ContextBuilder()
37-
.apiKey("your-api-key")
3837
.priority(Priority.REALTIME)
3938
.build();
4039
```
@@ -43,7 +42,13 @@ Then you need an executor and a mode:
4342

4443
```java
4544
CommandExecutor executor = NameApiRemoteExecutors.get();
46-
Mode mode = NameApiModeFactory.minimal(context);
45+
Mode mode = NameApiModeFactory.withContext(
46+
"your-api-key",
47+
context,
48+
//the default and live server is "api.nameapi.org"
49+
//we're using the latest release candidate with latest features here:
50+
new Host("rc50-api.nameapi.org", 80), NameApiPortUrlFactory.versionLatestStable()
51+
);
4752
```
4853

4954
Now you're ready to execute commands.
@@ -56,8 +61,8 @@ Now you're ready to execute commands.
5661
This code sends a simple ping to nameapi to test the connection:
5762

5863
```java
59-
PingerCommand command = new PingerCommand();
60-
executor.execute(command, mode, null).get().getPong(); //returns "pong"
64+
PingCommand command = new PingCommand();
65+
executor.execute(command, mode, null).get(); //returns "pong"
6166
```
6267

6368

@@ -119,7 +124,7 @@ Using the objects created earlier:
119124

120125
```java
121126
PersonGenderizerCommand command = new PersonGenderizerCommand();
122-
PersonGenderizerResult result = executor.execute(command, mode, inputPerson).get();
127+
GenderizerResult result = executor.execute(command, mode, inputPerson).get();
123128
```
124129

125130

@@ -145,7 +150,7 @@ The Name Formatter displays personal names in the desired form. This includes th
145150
```java
146151
PersonNameFormatterCommand command = new PersonNameFormatterCommand();
147152
NaturalInputPerson person = new NaturalInputPersonBuilder().name( NameBuilders.western().fullname("john f. kennedy").build() ).build();
148-
FormatterProperties properties = new FormatterPropertiesBuilder().build();
153+
FormatterProperties properties = new FormatterProperties(true);
149154
PersonNameFormatterArgument argument = new PersonNameFormatterArgument(person, properties);
150155
FormatterResult formatterResult = executor.execute(command, mode, argument).get();
151156
```
@@ -167,7 +172,7 @@ The DEA-Detector checks email addresses against a list of known "trash domains"
167172

168173
```java
169174
DisposableEmailAddressDetectorCommand command = new DisposableEmailAddressDetectorCommand();
170-
DisposableEmailAddressDetectorResult result = executor.execute(command, mode, "[email protected]");
175+
DisposableEmailAddressDetectorResult result = executor.execute(command, mode, "[email protected]").get();
171176
```
172177

173178

0 commit comments

Comments
 (0)