-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMessageGetStatusResponse.php
More file actions
136 lines (116 loc) · 3.24 KB
/
MessageGetStatusResponse.php
File metadata and controls
136 lines (116 loc) · 3.24 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
declare(strict_types=1);
namespace SentDm\Messages;
use SentDm\Core\Attributes\Optional;
use SentDm\Core\Concerns\SdkModel;
use SentDm\Core\Contracts\BaseModel;
use SentDm\Messages\MessageGetStatusResponse\Data;
use SentDm\Webhooks\APIMeta;
use SentDm\Webhooks\ErrorDetail;
/**
* Standard API response envelope for all v3 endpoints.
*
* @phpstan-import-type DataShape from \SentDm\Messages\MessageGetStatusResponse\Data
* @phpstan-import-type ErrorDetailShape from \SentDm\Webhooks\ErrorDetail
* @phpstan-import-type APIMetaShape from \SentDm\Webhooks\APIMeta
*
* @phpstan-type MessageGetStatusResponseShape = array{
* data?: null|Data|DataShape,
* error?: null|ErrorDetail|ErrorDetailShape,
* meta?: null|APIMeta|APIMetaShape,
* success?: bool|null,
* }
*/
final class MessageGetStatusResponse implements BaseModel
{
/** @use SdkModel<MessageGetStatusResponseShape> */
use SdkModel;
/**
* Message response for v3 API — same shape as v2 with snake_case JSON conventions.
*/
#[Optional(nullable: true)]
public ?Data $data;
/**
* Error information.
*/
#[Optional(nullable: true)]
public ?ErrorDetail $error;
/**
* Request and response metadata.
*/
#[Optional]
public ?APIMeta $meta;
/**
* Indicates whether the request was successful.
*/
#[Optional]
public ?bool $success;
public function __construct()
{
$this->initialize();
}
/**
* Construct an instance from the required parameters.
*
* You must use named parameters to construct any parameters with a default value.
*
* @param Data|DataShape|null $data
* @param ErrorDetail|ErrorDetailShape|null $error
* @param APIMeta|APIMetaShape|null $meta
*/
public static function with(
Data|array|null $data = null,
ErrorDetail|array|null $error = null,
APIMeta|array|null $meta = null,
?bool $success = null,
): self {
$self = new self;
null !== $data && $self['data'] = $data;
null !== $error && $self['error'] = $error;
null !== $meta && $self['meta'] = $meta;
null !== $success && $self['success'] = $success;
return $self;
}
/**
* Message response for v3 API — same shape as v2 with snake_case JSON conventions.
*
* @param Data|DataShape|null $data
*/
public function withData(Data|array|null $data): self
{
$self = clone $this;
$self['data'] = $data;
return $self;
}
/**
* Error information.
*
* @param ErrorDetail|ErrorDetailShape|null $error
*/
public function withError(ErrorDetail|array|null $error): self
{
$self = clone $this;
$self['error'] = $error;
return $self;
}
/**
* Request and response metadata.
*
* @param APIMeta|APIMetaShape $meta
*/
public function withMeta(APIMeta|array $meta): self
{
$self = clone $this;
$self['meta'] = $meta;
return $self;
}
/**
* Indicates whether the request was successful.
*/
public function withSuccess(bool $success): self
{
$self = clone $this;
$self['success'] = $success;
return $self;
}
}