Skip to content

Commit 2a9637f

Browse files
feat(api): api update
1 parent d613bd4 commit 2a9637f

File tree

4 files changed

+431
-2
lines changed

4 files changed

+431
-2
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 232
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-df015666c8d57cf91d4239bffeb549736581af5653e0ec2cd94357c434975e31.yml
3-
openapi_spec_hash: fceca44f4bd5f5f8fdbbaa6c80fc0410
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-1a3093fde00ba57a88035a89fca1627e3343e5c6cba2854ee6ebf8bac9640489.yml
3+
openapi_spec_hash: 547e0e84b0d09880a8305ddac57cc44a
44
config_hash: 27e44ed36b9c5617b580ead7231a594a

src/Events/UnwrapWebhookEvent.php

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Increase\Events;
6+
7+
use Increase\Core\Attributes\Required;
8+
use Increase\Core\Concerns\SdkModel;
9+
use Increase\Core\Contracts\BaseModel;
10+
use Increase\Events\UnwrapWebhookEvent\Category;
11+
use Increase\Events\UnwrapWebhookEvent\Type;
12+
13+
/**
14+
* Events are records of things that happened to objects at Increase. Events are accessible via the List Events endpoint and can be delivered to your application via webhooks. For more information, see our [webhooks guide](https://increase.com/documentation/webhooks).
15+
*
16+
* @phpstan-type UnwrapWebhookEventShape = array{
17+
* id: string,
18+
* associatedObjectID: string,
19+
* associatedObjectType: string,
20+
* category: Category|value-of<Category>,
21+
* createdAt: \DateTimeInterface,
22+
* type: Type|value-of<Type>,
23+
* }
24+
*/
25+
final class UnwrapWebhookEvent implements BaseModel
26+
{
27+
/** @use SdkModel<UnwrapWebhookEventShape> */
28+
use SdkModel;
29+
30+
/**
31+
* The Event identifier.
32+
*/
33+
#[Required]
34+
public string $id;
35+
36+
/**
37+
* The identifier of the object that generated this Event.
38+
*/
39+
#[Required('associated_object_id')]
40+
public string $associatedObjectID;
41+
42+
/**
43+
* The type of the object that generated this Event.
44+
*/
45+
#[Required('associated_object_type')]
46+
public string $associatedObjectType;
47+
48+
/**
49+
* The category of the Event. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully.
50+
*
51+
* @var value-of<Category> $category
52+
*/
53+
#[Required(enum: Category::class)]
54+
public string $category;
55+
56+
/**
57+
* The time the Event was created.
58+
*/
59+
#[Required('created_at')]
60+
public \DateTimeInterface $createdAt;
61+
62+
/**
63+
* A constant representing the object's type. For this resource it will always be `event`.
64+
*
65+
* @var value-of<Type> $type
66+
*/
67+
#[Required(enum: Type::class)]
68+
public string $type;
69+
70+
/**
71+
* `new UnwrapWebhookEvent()` is missing required properties by the API.
72+
*
73+
* To enforce required parameters use
74+
* ```
75+
* UnwrapWebhookEvent::with(
76+
* id: ...,
77+
* associatedObjectID: ...,
78+
* associatedObjectType: ...,
79+
* category: ...,
80+
* createdAt: ...,
81+
* type: ...,
82+
* )
83+
* ```
84+
*
85+
* Otherwise ensure the following setters are called
86+
*
87+
* ```
88+
* (new UnwrapWebhookEvent)
89+
* ->withID(...)
90+
* ->withAssociatedObjectID(...)
91+
* ->withAssociatedObjectType(...)
92+
* ->withCategory(...)
93+
* ->withCreatedAt(...)
94+
* ->withType(...)
95+
* ```
96+
*/
97+
public function __construct()
98+
{
99+
$this->initialize();
100+
}
101+
102+
/**
103+
* Construct an instance from the required parameters.
104+
*
105+
* You must use named parameters to construct any parameters with a default value.
106+
*
107+
* @param Category|value-of<Category> $category
108+
* @param Type|value-of<Type> $type
109+
*/
110+
public static function with(
111+
string $id,
112+
string $associatedObjectID,
113+
string $associatedObjectType,
114+
Category|string $category,
115+
\DateTimeInterface $createdAt,
116+
Type|string $type,
117+
): self {
118+
$self = new self;
119+
120+
$self['id'] = $id;
121+
$self['associatedObjectID'] = $associatedObjectID;
122+
$self['associatedObjectType'] = $associatedObjectType;
123+
$self['category'] = $category;
124+
$self['createdAt'] = $createdAt;
125+
$self['type'] = $type;
126+
127+
return $self;
128+
}
129+
130+
/**
131+
* The Event identifier.
132+
*/
133+
public function withID(string $id): self
134+
{
135+
$self = clone $this;
136+
$self['id'] = $id;
137+
138+
return $self;
139+
}
140+
141+
/**
142+
* The identifier of the object that generated this Event.
143+
*/
144+
public function withAssociatedObjectID(string $associatedObjectID): self
145+
{
146+
$self = clone $this;
147+
$self['associatedObjectID'] = $associatedObjectID;
148+
149+
return $self;
150+
}
151+
152+
/**
153+
* The type of the object that generated this Event.
154+
*/
155+
public function withAssociatedObjectType(string $associatedObjectType): self
156+
{
157+
$self = clone $this;
158+
$self['associatedObjectType'] = $associatedObjectType;
159+
160+
return $self;
161+
}
162+
163+
/**
164+
* The category of the Event. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully.
165+
*
166+
* @param Category|value-of<Category> $category
167+
*/
168+
public function withCategory(Category|string $category): self
169+
{
170+
$self = clone $this;
171+
$self['category'] = $category;
172+
173+
return $self;
174+
}
175+
176+
/**
177+
* The time the Event was created.
178+
*/
179+
public function withCreatedAt(\DateTimeInterface $createdAt): self
180+
{
181+
$self = clone $this;
182+
$self['createdAt'] = $createdAt;
183+
184+
return $self;
185+
}
186+
187+
/**
188+
* A constant representing the object's type. For this resource it will always be `event`.
189+
*
190+
* @param Type|value-of<Type> $type
191+
*/
192+
public function withType(Type|string $type): self
193+
{
194+
$self = clone $this;
195+
$self['type'] = $type;
196+
197+
return $self;
198+
}
199+
}

0 commit comments

Comments
 (0)