forked from NativePHP/laravel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.php
60 lines (47 loc) · 1.26 KB
/
App.php
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
<?php
namespace Native\Laravel;
use Native\Laravel\Client\Client;
class App
{
public function __construct(protected Client $client) {}
public function focus(): void
{
$this->client->post('app/focus');
}
public function hide(): void
{
$this->client->post('app/hide');
}
public function isHidden(): bool
{
return $this->client->get('app/is-hidden')->json('is_hidden');
}
public function version(): string
{
return $this->client->get('app/version')->json('version');
}
public function badgeCount($count = null): int
{
if ($count === null) {
return (int) $this->client->get('app/badge-count')->json('count');
}
$this->client->post('app/badge-count', [
'count' => (int) $count,
]);
return (int) $count;
}
public function addRecentDocument(string $path): void
{
$this->client->post('app/recent-documents', [
'path' => $path,
]);
}
public function recentDocuments(): array
{
return $this->client->get('app/recent-documents')->json('documents');
}
public function clearRecentDocuments(): void
{
$this->client->delete('app/recent-documents');
}
}