|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace InShore\Bookwhen\Responses\Events; |
|
6
|
|
|
|
|
7
|
|
|
use InShore\Bookwhen\Contracts\ResponseContract; |
|
8
|
|
|
use InShore\Bookwhen\Responses\Concerns\ArrayAccessible; |
|
9
|
|
|
|
|
10
|
|
|
//use OpenAI\Testing\Responses\Concerns\Fakeable; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @implements ResponseContract<array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}> |
|
14
|
|
|
*/ |
|
15
|
|
|
final class RetrieveResponse implements ResponseContract |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* @use ArrayAccessible<array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}> |
|
19
|
|
|
*/ |
|
20
|
|
|
use ArrayAccessible; |
|
21
|
|
|
|
|
22
|
|
|
//use Fakeable; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @param array<array-key, mixed>|null $statusDetails |
|
|
|
|
|
|
26
|
|
|
*/ |
|
27
|
|
|
private function __construct( |
|
28
|
|
|
public readonly bool $allDay, |
|
29
|
|
|
public readonly array $attachments, |
|
30
|
|
|
public readonly int $attendeeCount, |
|
31
|
|
|
public readonly int $attendeeLimit, |
|
32
|
|
|
public readonly string $details, |
|
33
|
|
|
public readonly string $endAt, |
|
34
|
|
|
public readonly string $id, |
|
35
|
|
|
public readonly string $locationId, |
|
36
|
|
|
public readonly int $maxTicketsPerBooking, |
|
37
|
|
|
public readonly string $startAt, |
|
38
|
|
|
public readonly array $tickets, |
|
39
|
|
|
public readonly string $title, |
|
40
|
|
|
public readonly bool $waitingList |
|
41
|
|
|
) { |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Acts as static factory, and returns a new Response instance. |
|
46
|
|
|
* |
|
47
|
|
|
* @param array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null} $attributes |
|
|
|
|
|
|
48
|
|
|
*/ |
|
49
|
|
|
public static function from(array $attributes): self |
|
50
|
|
|
{ |
|
51
|
|
|
return new self( |
|
52
|
|
|
$attributes['attributes']['all_day'], |
|
53
|
|
|
$attributes['relationships']['attachments']['data'], |
|
54
|
|
|
$attributes['attributes']['attendee_count'], |
|
55
|
|
|
$attributes['attributes']['attendee_limit'], |
|
56
|
|
|
$attributes['attributes']['details'], |
|
57
|
|
|
$attributes['attributes']['end_at'], |
|
58
|
|
|
$attributes['id'], |
|
59
|
|
|
$attributes['relationships']['location']['data']['id'], |
|
60
|
|
|
$attributes['attributes']['max_tickets_per_booking'], |
|
61
|
|
|
$attributes['attributes']['start_at'], |
|
62
|
|
|
$attributes['relationships']['tickets']['data'], |
|
63
|
|
|
$attributes['attributes']['title'], |
|
64
|
|
|
$attributes['attributes']['waiting_list'] |
|
65
|
|
|
); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|