Skip to content

Commit f85f4f5

Browse files
SDK regeneration
1 parent 9460a8d commit f85f4f5

File tree

442 files changed

+27466
-10296
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

442 files changed

+27466
-10296
lines changed

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@
55

66
The Intercom PHP library provides convenient access to the Intercom APIs from PHP.
77

8+
## Table of Contents
9+
10+
- [Requirements](#requirements)
11+
- [Installation](#installation)
12+
- [Usage](#usage)
13+
- [Exception Handling](#exception-handling)
14+
- [Pagination](#pagination)
15+
- [Legacy Sdk](#legacy-sdk)
16+
- [Advanced](#advanced)
17+
- [Custom Client](#custom-client)
18+
- [Retries](#retries)
19+
- [Timeouts](#timeouts)
20+
- [Contributing](#contributing)
21+
822
## Requirements
923

1024
This SDK requires PHP ^8.1.
@@ -26,16 +40,14 @@ namespace Example;
2640

2741
use Intercom\IntercomClient;
2842
use Intercom\AiContent\Requests\CreateContentImportSourceRequest;
29-
use Intercom\AiContent\Types\CreateContentImportSourceRequestStatus;
3043

3144
$client = new IntercomClient(
3245
token: '<token>',
3346
);
3447
$client->aiContent->createContentImportSource(
3548
new CreateContentImportSourceRequest([
3649
'syncBehavior' => 'api',
37-
'status' => CreateContentImportSourceRequestStatus::Active->value,
38-
'url' => 'url',
50+
'url' => 'https://www.example.com',
3951
]),
4052
);
4153

@@ -87,6 +99,7 @@ foreach ($items->getPages() as $page) {
8799
}
88100
```
89101

102+
90103
## Legacy SDK
91104

92105
While the new SDK has a lot of improvements, we at Intercom understand that it takes time to upgrade when there are breaking changes.
@@ -156,7 +169,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
156169
Use the `maxRetries` request option to configure this behavior.
157170

158171
```php
159-
$response = $client->articles->create(
172+
$response = $client->aiContent->createContentImportSource(
160173
...,
161174
options: [
162175
'maxRetries' => 0 // Override maxRetries at the request level
@@ -169,7 +182,7 @@ $response = $client->articles->create(
169182
The SDK defaults to a 30 second timeout. Use the `timeout` option to configure this behavior.
170183

171184
```php
172-
$response = $client->articles->create(
185+
$response = $client->aiContent->createContentImportSource(
173186
...,
174187
options: [
175188
'timeout' => 3.0 // Override timeout to 3 seconds

src/Admins/AdminsClient.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ public function __construct(
7272
* queryParameters?: array<string, mixed>,
7373
* bodyProperties?: array<string, mixed>,
7474
* } $options
75-
* @return AdminWithApp
75+
* @return ?AdminWithApp
7676
* @throws IntercomException
7777
* @throws IntercomApiException
7878
*/
79-
public function identify(?array $options = null): AdminWithApp
79+
public function identify(?array $options = null): ?AdminWithApp
8080
{
8181
$options = array_merge($this->options, $options ?? []);
8282
try {
@@ -91,6 +91,9 @@ public function identify(?array $options = null): AdminWithApp
9191
$statusCode = $response->getStatusCode();
9292
if ($statusCode >= 200 && $statusCode < 400) {
9393
$json = $response->getBody()->getContents();
94+
if (empty($json)) {
95+
return null;
96+
}
9497
return AdminWithApp::fromJson($json);
9598
}
9699
} catch (JsonException $e) {
@@ -127,11 +130,11 @@ public function identify(?array $options = null): AdminWithApp
127130
* queryParameters?: array<string, mixed>,
128131
* bodyProperties?: array<string, mixed>,
129132
* } $options
130-
* @return Admin
133+
* @return ?Admin
131134
* @throws IntercomException
132135
* @throws IntercomApiException
133136
*/
134-
public function away(ConfigureAwayAdminRequest $request, ?array $options = null): Admin
137+
public function away(ConfigureAwayAdminRequest $request, ?array $options = null): ?Admin
135138
{
136139
$options = array_merge($this->options, $options ?? []);
137140
try {
@@ -147,6 +150,9 @@ public function away(ConfigureAwayAdminRequest $request, ?array $options = null)
147150
$statusCode = $response->getStatusCode();
148151
if ($statusCode >= 200 && $statusCode < 400) {
149152
$json = $response->getBody()->getContents();
153+
if (empty($json)) {
154+
return null;
155+
}
150156
return Admin::fromJson($json);
151157
}
152158
} catch (JsonException $e) {
@@ -298,11 +304,11 @@ public function list(?array $options = null): AdminList
298304
* queryParameters?: array<string, mixed>,
299305
* bodyProperties?: array<string, mixed>,
300306
* } $options
301-
* @return Admin
307+
* @return ?Admin
302308
* @throws IntercomException
303309
* @throws IntercomApiException
304310
*/
305-
public function find(FindAdminRequest $request, ?array $options = null): Admin
311+
public function find(FindAdminRequest $request, ?array $options = null): ?Admin
306312
{
307313
$options = array_merge($this->options, $options ?? []);
308314
try {
@@ -317,6 +323,9 @@ public function find(FindAdminRequest $request, ?array $options = null): Admin
317323
$statusCode = $response->getStatusCode();
318324
if ($statusCode >= 200 && $statusCode < 400) {
319325
$json = $response->getBody()->getContents();
326+
if (empty($json)) {
327+
return null;
328+
}
320329
return Admin::fromJson($json);
321330
}
322331
} catch (JsonException $e) {

src/Admins/Requests/ConfigureAwayAdminRequest.php

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
class ConfigureAwayAdminRequest extends JsonSerializableType
99
{
1010
/**
11-
* @var string $adminId The unique identifier of a given admin
11+
* @var int $adminId The unique identifier of a given admin
1212
*/
13-
private string $adminId;
13+
private int $adminId;
1414

1515
/**
1616
* @var bool $awayModeEnabled Set to "true" to change the status of the admin to away.
@@ -24,11 +24,18 @@ class ConfigureAwayAdminRequest extends JsonSerializableType
2424
#[JsonProperty('away_mode_reassign')]
2525
private bool $awayModeReassign;
2626

27+
/**
28+
* @var ?int $awayStatusReasonId The unique identifier of the away status reason
29+
*/
30+
#[JsonProperty('away_status_reason_id')]
31+
private ?int $awayStatusReasonId;
32+
2733
/**
2834
* @param array{
29-
* adminId: string,
35+
* adminId: int,
3036
* awayModeEnabled: bool,
3137
* awayModeReassign: bool,
38+
* awayStatusReasonId?: ?int,
3239
* } $values
3340
*/
3441
public function __construct(
@@ -37,20 +44,21 @@ public function __construct(
3744
$this->adminId = $values['adminId'];
3845
$this->awayModeEnabled = $values['awayModeEnabled'];
3946
$this->awayModeReassign = $values['awayModeReassign'];
47+
$this->awayStatusReasonId = $values['awayStatusReasonId'] ?? null;
4048
}
4149

4250
/**
43-
* @return string
51+
* @return int
4452
*/
45-
public function getAdminId(): string
53+
public function getAdminId(): int
4654
{
4755
return $this->adminId;
4856
}
4957

5058
/**
51-
* @param string $value
59+
* @param int $value
5260
*/
53-
public function setAdminId(string $value): self
61+
public function setAdminId(int $value): self
5462
{
5563
$this->adminId = $value;
5664
return $this;
@@ -89,4 +97,21 @@ public function setAwayModeReassign(bool $value): self
8997
$this->awayModeReassign = $value;
9098
return $this;
9199
}
100+
101+
/**
102+
* @return ?int
103+
*/
104+
public function getAwayStatusReasonId(): ?int
105+
{
106+
return $this->awayStatusReasonId;
107+
}
108+
109+
/**
110+
* @param ?int $value
111+
*/
112+
public function setAwayStatusReasonId(?int $value = null): self
113+
{
114+
$this->awayStatusReasonId = $value;
115+
return $this;
116+
}
92117
}

src/Admins/Requests/FindAdminRequest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
class FindAdminRequest extends JsonSerializableType
88
{
99
/**
10-
* @var string $adminId The unique identifier of a given admin
10+
* @var int $adminId The unique identifier of a given admin
1111
*/
12-
private string $adminId;
12+
private int $adminId;
1313

1414
/**
1515
* @param array{
16-
* adminId: string,
16+
* adminId: int,
1717
* } $values
1818
*/
1919
public function __construct(
@@ -23,17 +23,17 @@ public function __construct(
2323
}
2424

2525
/**
26-
* @return string
26+
* @return int
2727
*/
28-
public function getAdminId(): string
28+
public function getAdminId(): int
2929
{
3030
return $this->adminId;
3131
}
3232

3333
/**
34-
* @param string $value
34+
* @param int $value
3535
*/
36-
public function setAdminId(string $value): self
36+
public function setAdminId(int $value): self
3737
{
3838
$this->adminId = $value;
3939
return $this;

src/Admins/Types/Admin.php

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class Admin extends JsonSerializableType
1414
{
1515
/**
16-
* @var ?'admin' $type String representing the object's type. Always has the value `admin`.
16+
* @var ?string $type String representing the object's type. Always has the value `admin`.
1717
*/
1818
#[JsonProperty('type')]
1919
private ?string $type;
@@ -54,6 +54,12 @@ class Admin extends JsonSerializableType
5454
#[JsonProperty('away_mode_reassign')]
5555
private bool $awayModeReassign;
5656

57+
/**
58+
* @var ?int $awayStatusReasonId The unique identifier of the away status reason
59+
*/
60+
#[JsonProperty('away_status_reason_id')]
61+
private ?int $awayStatusReasonId;
62+
5763
/**
5864
* @var bool $hasInboxSeat Identifies if this admin has a paid inbox seat to restrict/allow features that require them.
5965
*/
@@ -67,10 +73,10 @@ class Admin extends JsonSerializableType
6773
private array $teamIds;
6874

6975
/**
70-
* @var ?AdminAvatar $avatar The avatar object associated with the admin
76+
* @var ?string $avatar Image for the associated team or teammate
7177
*/
7278
#[JsonProperty('avatar')]
73-
private ?AdminAvatar $avatar;
79+
private ?string $avatar;
7480

7581
/**
7682
* @var ?TeamPriorityLevel $teamPriorityLevel
@@ -87,9 +93,10 @@ class Admin extends JsonSerializableType
8793
* awayModeReassign: bool,
8894
* hasInboxSeat: bool,
8995
* teamIds: array<int>,
90-
* type?: ?'admin',
96+
* type?: ?string,
9197
* jobTitle?: ?string,
92-
* avatar?: ?AdminAvatar,
98+
* awayStatusReasonId?: ?int,
99+
* avatar?: ?string,
93100
* teamPriorityLevel?: ?TeamPriorityLevel,
94101
* } $values
95102
*/
@@ -103,22 +110,23 @@ public function __construct(
103110
$this->jobTitle = $values['jobTitle'] ?? null;
104111
$this->awayModeEnabled = $values['awayModeEnabled'];
105112
$this->awayModeReassign = $values['awayModeReassign'];
113+
$this->awayStatusReasonId = $values['awayStatusReasonId'] ?? null;
106114
$this->hasInboxSeat = $values['hasInboxSeat'];
107115
$this->teamIds = $values['teamIds'];
108116
$this->avatar = $values['avatar'] ?? null;
109117
$this->teamPriorityLevel = $values['teamPriorityLevel'] ?? null;
110118
}
111119

112120
/**
113-
* @return ?'admin'
121+
* @return ?string
114122
*/
115123
public function getType(): ?string
116124
{
117125
return $this->type;
118126
}
119127

120128
/**
121-
* @param ?'admin' $value
129+
* @param ?string $value
122130
*/
123131
public function setType(?string $value = null): self
124132
{
@@ -228,6 +236,23 @@ public function setAwayModeReassign(bool $value): self
228236
return $this;
229237
}
230238

239+
/**
240+
* @return ?int
241+
*/
242+
public function getAwayStatusReasonId(): ?int
243+
{
244+
return $this->awayStatusReasonId;
245+
}
246+
247+
/**
248+
* @param ?int $value
249+
*/
250+
public function setAwayStatusReasonId(?int $value = null): self
251+
{
252+
$this->awayStatusReasonId = $value;
253+
return $this;
254+
}
255+
231256
/**
232257
* @return bool
233258
*/
@@ -263,17 +288,17 @@ public function setTeamIds(array $value): self
263288
}
264289

265290
/**
266-
* @return ?AdminAvatar
291+
* @return ?string
267292
*/
268-
public function getAvatar(): ?AdminAvatar
293+
public function getAvatar(): ?string
269294
{
270295
return $this->avatar;
271296
}
272297

273298
/**
274-
* @param ?AdminAvatar $value
299+
* @param ?string $value
275300
*/
276-
public function setAvatar(?AdminAvatar $value = null): self
301+
public function setAvatar(?string $value = null): self
277302
{
278303
$this->avatar = $value;
279304
return $this;

0 commit comments

Comments
 (0)