-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathmain.dart
64 lines (59 loc) · 1.75 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import 'dart:io';
import 'package:typesense/typesense.dart';
import 'package:logging/logging.dart';
import 'collections.dart' as collections;
import 'documents.dart' as documents;
import 'search.dart' as search;
import 'keys.dart' as keys;
import 'overrides.dart' as overrides;
import 'synonyms.dart' as synonyms;
import 'aliases.dart' as aliases;
import 'presets.dart' as presets;
import 'cluster_operations.dart' as cluster_operations;
import 'miscellaneous.dart' as miscellaneous;
void main() async {
Logger.root.level = Level.ALL;
Logger.root.onRecord.listen((record) {
// ignore: avoid_print
print('${record.level.name}: ${record.message}');
});
final host = InternetAddress.loopbackIPv4.address, protocol = Protocol.http;
final config = Configuration(
// Replace with your configuration
'xyz',
nodes: {
Node(
protocol,
host,
port: 7108,
),
Node.withUri(
Uri(
scheme: 'http',
host: host,
port: 8108,
),
),
Node(
protocol,
host,
port: 9108,
),
},
numRetries: 3, // A total of 4 tries (1 original try + 3 retries)
connectionTimeout: const Duration(seconds: 2),
);
final client = Client(config);
await collections.runExample(client);
await documents.runExample(
// Set a longer timeout in case of large imports.
Client(config.copyWith(connectionTimeout: const Duration(seconds: 120))));
await search.runExample(client);
await keys.runExample(client);
await overrides.runExample(client);
await synonyms.runExample(client);
await aliases.runExample(client);
await presets.runExample(client);
await cluster_operations.runExample(client);
await miscellaneous.runExample(client);
}