-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathFileUriPart.php
More file actions
39 lines (34 loc) · 811 Bytes
/
FileUriPart.php
File metadata and controls
39 lines (34 loc) · 811 Bytes
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
<?php
namespace GeminiAPI\Resources\Parts;
use GeminiAPI\Resources\Parts\PartInterface;
use GeminiAPI\Enums\MimeType;
use JsonSerializable;
class FileUriPart implements PartInterface, JsonSerializable
{
public function __construct(
public readonly MimeType $mimeType,
public readonly string $uri
) {
}
/**
* @return array{
* file_data: array{
* mime_type: string,
* file_uri: string,
* },
* }
*/
public function jsonSerialize(): array
{
return [
'file_data' => [
'mime_type' => $this->mimeType->value,
'file_uri' => $this->uri
],
];
}
public function __toString(): string
{
return json_encode($this) ?: '';
}
}