Skip to content

Commit 54d9590

Browse files
Merge pull request #2 from devloopsnet/v2.0
V2.0
2 parents f5507dd + 58b5b72 commit 54d9590

18 files changed

+631
-263
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
}
2020
},
2121
"require": {
22-
"guzzlehttp/guzzle": "^6.0"
22+
"guzzlehttp/guzzle": "^6.0",
23+
"ext-json": "*"
2324
}
2425
}

examples/alias_operations.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,15 @@
77
try {
88
$client = new Client(
99
[
10-
'master_node' => [
11-
'host' => 'HOST',
12-
'port' => '8108',
13-
'protocol' => 'http',
14-
'api_key' => 'API_KEY',
15-
],
16-
'read_replica_nodes' => [
10+
'api_key' => 'abcd',
11+
'nodes' => [
1712
[
18-
'host' => 'HOST',
13+
'host' => 'localhost',
1914
'port' => '8108',
2015
'protocol' => 'http',
21-
'api_key' => 'API_KEY',
2216
],
2317
],
24-
'timeout_seconds' => 2,
18+
'connection_timeout_seconds' => 2,
2519
]
2620
);
2721
echo '<pre>';

examples/collection_operations.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,19 @@
77
try {
88
$client = new Client(
99
[
10-
'master_node' => [
11-
'host' => 'host',
12-
'port' => '8108',
13-
'protocol' => 'http',
14-
'api_key' => 'api_key',
15-
],
16-
'read_replica_nodes' => [
10+
'api_key' => 'abcd',
11+
'nodes' => [
1712
[
18-
'host' => 'host',
13+
'host' => 'localhost',
1914
'port' => '8108',
2015
'protocol' => 'http',
21-
'api_key' => 'api_key',
2216
],
2317
],
24-
'timeout_seconds' => 2,
18+
'connection_timeout_seconds' => 2,
2519
]
2620
);
2721
echo '<pre>';
22+
//print_r($client->collections['books']->delete());
2823
echo "--------Create Collection-------\n";
2924
print_r(
3025
$client->collections->create(
@@ -104,7 +99,8 @@
10499
echo "--------Create Document-------\n";
105100
echo "\n";
106101
echo "--------Export Documents-------\n";
107-
print_r($client->collections['books']->documents->export());
102+
$exportedDocStrs = $client->collections['books']->documents->export();
103+
print_r($exportedDocStrs);
108104
echo "--------Export Documents-------\n";
109105
echo "\n";
110106
echo "--------Fetch Single Document-------\n";
@@ -127,6 +123,16 @@
127123
print_r($client->collections['books']->documents['1']->delete());
128124
echo "--------Delete Document-------\n";
129125
echo "\n";
126+
echo "--------Import Documents-------\n";
127+
$docsToImport = [];
128+
foreach ($exportedDocStrs as $exportedDocStr) {
129+
$docsToImport[] = json_decode($exportedDocStr, true);
130+
}
131+
$importRes =
132+
$client->collections['books']->documents->create_many($docsToImport);
133+
print_r($importRes);
134+
echo "--------Import Documents-------\n";
135+
echo "\n";
130136
echo "--------Delete Collection-------\n";
131137
print_r($client->collections['books']->delete());
132138
echo "--------Delete Collection-------\n";

examples/curation_operations.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,15 @@
77
try {
88
$client = new Client(
99
[
10-
'master_node' => [
11-
'host' => 'HOST',
12-
'port' => '8108',
13-
'protocol' => 'http',
14-
'api_key' => 'API_KEY',
15-
],
16-
'read_replica_nodes' => [
10+
'api_key' => 'abcd',
11+
'nodes' => [
1712
[
18-
'host' => 'HOST',
13+
'host' => 'localhost',
1914
'port' => '8108',
2015
'protocol' => 'http',
21-
'api_key' => 'API_KEY',
2216
],
2317
],
24-
'timeout_seconds' => 2,
18+
'connection_timeout_seconds' => 2,
2519
]
2620
);
2721
echo '<pre>';

src/Alias.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ public function retrieve(): array
6363
/**
6464
* @return array
6565
* @throws \Devloops\Typesence\Exceptions\TypesenseClientError
66-
* @throws \GuzzleHttp\Exception\GuzzleException
6766
*/
6867
public function delete(): array
6968
{

src/Aliases.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public function endPointPath(string $aliasName): string
5959
*
6060
* @return array
6161
* @throws \Devloops\Typesence\Exceptions\TypesenseClientError
62-
* @throws \GuzzleHttp\Exception\GuzzleException
6362
*/
6463
public function upsert(string $name, array $mapping): array
6564
{

0 commit comments

Comments
 (0)