Skip to content

Commit 9371eba

Browse files
SDK regeneration (#397)
Co-authored-by: fern-api[bot] <115122769+fern-api[bot]@users.noreply.github.com>
1 parent 574c907 commit 9371eba

File tree

47 files changed

+3474
-316
lines changed

Some content is hidden

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

47 files changed

+3474
-316
lines changed

reference.md

Lines changed: 545 additions & 306 deletions
Large diffs are not rendered by default.

src/IntercomClient.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Intercom\DataExport\DataExportClient;
1111
use Intercom\HelpCenters\HelpCentersClient;
1212
use Intercom\InternalArticles\InternalArticlesClient;
13+
use Intercom\IpAllowlist\IpAllowlistClient;
1314
use Intercom\Companies\CompaniesClient;
1415
use Intercom\Contacts\ContactsClient;
1516
use Intercom\Notes\NotesClient;
@@ -78,6 +79,11 @@ class IntercomClient
7879
*/
7980
public InternalArticlesClient $internalArticles;
8081

82+
/**
83+
* @var IpAllowlistClient $ipAllowlist
84+
*/
85+
public IpAllowlistClient $ipAllowlist;
86+
8187
/**
8288
* @var CompaniesClient $companies
8389
*/
@@ -223,8 +229,8 @@ public function __construct(
223229
'Authorization' => "Bearer $token",
224230
'X-Fern-Language' => 'PHP',
225231
'X-Fern-SDK-Name' => 'Intercom',
226-
'X-Fern-SDK-Version' => '6.0.0',
227-
'User-Agent' => 'intercom/intercom-php/6.0.0',
232+
'X-Fern-SDK-Version' => '5.0.2',
233+
'User-Agent' => 'intercom/intercom-php/5.0.2',
228234
'Intercom-Version' => '2.14',
229235
];
230236

@@ -247,6 +253,7 @@ public function __construct(
247253
$this->dataExport = new DataExportClient($this->client, $this->options);
248254
$this->helpCenters = new HelpCentersClient($this->client, $this->options);
249255
$this->internalArticles = new InternalArticlesClient($this->client, $this->options);
256+
$this->ipAllowlist = new IpAllowlistClient($this->client, $this->options);
250257
$this->companies = new CompaniesClient($this->client, $this->options);
251258
$this->contacts = new ContactsClient($this->client, $this->options);
252259
$this->notes = new NotesClient($this->client, $this->options);
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
<?php
2+
3+
namespace Intercom\IpAllowlist;
4+
5+
use GuzzleHttp\ClientInterface;
6+
use Intercom\Core\Client\RawClient;
7+
use Intercom\Types\IpAllowlist;
8+
use Intercom\Exceptions\IntercomException;
9+
use Intercom\Exceptions\IntercomApiException;
10+
use Intercom\Core\Json\JsonApiRequest;
11+
use Intercom\Environments;
12+
use Intercom\Core\Client\HttpMethod;
13+
use JsonException;
14+
use GuzzleHttp\Exception\RequestException;
15+
use Psr\Http\Client\ClientExceptionInterface;
16+
17+
class IpAllowlistClient
18+
{
19+
/**
20+
* @var array{
21+
* baseUrl?: string,
22+
* client?: ClientInterface,
23+
* maxRetries?: int,
24+
* timeout?: float,
25+
* headers?: array<string, string>,
26+
* } $options @phpstan-ignore-next-line Property is used in endpoint methods via HttpEndpointGenerator
27+
*/
28+
private array $options;
29+
30+
/**
31+
* @var RawClient $client
32+
*/
33+
private RawClient $client;
34+
35+
/**
36+
* @param RawClient $client
37+
* @param ?array{
38+
* baseUrl?: string,
39+
* client?: ClientInterface,
40+
* maxRetries?: int,
41+
* timeout?: float,
42+
* headers?: array<string, string>,
43+
* } $options
44+
*/
45+
public function __construct(
46+
RawClient $client,
47+
?array $options = null,
48+
) {
49+
$this->client = $client;
50+
$this->options = $options ?? [];
51+
}
52+
53+
/**
54+
* Retrieve the current IP allowlist configuration for the workspace.
55+
*
56+
* @param ?array{
57+
* baseUrl?: string,
58+
* maxRetries?: int,
59+
* timeout?: float,
60+
* headers?: array<string, string>,
61+
* queryParameters?: array<string, mixed>,
62+
* bodyProperties?: array<string, mixed>,
63+
* } $options
64+
* @return IpAllowlist
65+
* @throws IntercomException
66+
* @throws IntercomApiException
67+
*/
68+
public function getIpAllowlist(?array $options = null): IpAllowlist
69+
{
70+
$options = array_merge($this->options, $options ?? []);
71+
try {
72+
$response = $this->client->sendRequest(
73+
new JsonApiRequest(
74+
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::UsProduction->value,
75+
path: "ip_allowlist",
76+
method: HttpMethod::GET,
77+
),
78+
$options,
79+
);
80+
$statusCode = $response->getStatusCode();
81+
if ($statusCode >= 200 && $statusCode < 400) {
82+
$json = $response->getBody()->getContents();
83+
return IpAllowlist::fromJson($json);
84+
}
85+
} catch (JsonException $e) {
86+
throw new IntercomException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e);
87+
} catch (RequestException $e) {
88+
$response = $e->getResponse();
89+
if ($response === null) {
90+
throw new IntercomException(message: $e->getMessage(), previous: $e);
91+
}
92+
throw new IntercomApiException(
93+
message: "API request failed",
94+
statusCode: $response->getStatusCode(),
95+
body: $response->getBody()->getContents(),
96+
);
97+
} catch (ClientExceptionInterface $e) {
98+
throw new IntercomException(message: $e->getMessage(), previous: $e);
99+
}
100+
throw new IntercomApiException(
101+
message: 'API request failed',
102+
statusCode: $statusCode,
103+
body: $response->getBody()->getContents(),
104+
);
105+
}
106+
107+
/**
108+
* Update the IP allowlist configuration for the workspace.
109+
*
110+
* {% admonition type="warning" name="Lockout Protection" %}
111+
* The API will reject updates that would lock out the caller's IP address. Ensure your current IP is included in the allowlist when enabling the feature.
112+
* {% /admonition %}
113+
*
114+
* @param IpAllowlist $request
115+
* @param ?array{
116+
* baseUrl?: string,
117+
* maxRetries?: int,
118+
* timeout?: float,
119+
* headers?: array<string, string>,
120+
* queryParameters?: array<string, mixed>,
121+
* bodyProperties?: array<string, mixed>,
122+
* } $options
123+
* @return IpAllowlist
124+
* @throws IntercomException
125+
* @throws IntercomApiException
126+
*/
127+
public function updateIpAllowlist(IpAllowlist $request, ?array $options = null): IpAllowlist
128+
{
129+
$options = array_merge($this->options, $options ?? []);
130+
try {
131+
$response = $this->client->sendRequest(
132+
new JsonApiRequest(
133+
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::UsProduction->value,
134+
path: "ip_allowlist",
135+
method: HttpMethod::PUT,
136+
body: $request,
137+
),
138+
$options,
139+
);
140+
$statusCode = $response->getStatusCode();
141+
if ($statusCode >= 200 && $statusCode < 400) {
142+
$json = $response->getBody()->getContents();
143+
return IpAllowlist::fromJson($json);
144+
}
145+
} catch (JsonException $e) {
146+
throw new IntercomException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e);
147+
} catch (RequestException $e) {
148+
$response = $e->getResponse();
149+
if ($response === null) {
150+
throw new IntercomException(message: $e->getMessage(), previous: $e);
151+
}
152+
throw new IntercomApiException(
153+
message: "API request failed",
154+
statusCode: $response->getStatusCode(),
155+
body: $response->getBody()->getContents(),
156+
);
157+
} catch (ClientExceptionInterface $e) {
158+
throw new IntercomException(message: $e->getMessage(), previous: $e);
159+
}
160+
throw new IntercomApiException(
161+
message: 'API request failed',
162+
statusCode: $statusCode,
163+
body: $response->getBody()->getContents(),
164+
);
165+
}
166+
}

src/Types/ActivityLogActivityType.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ enum ActivityLogActivityType: string
5858
case InboxAccessChange = "inbox_access_change";
5959
case MacroCreation = "macro_creation";
6060
case MacroDeletion = "macro_deletion";
61-
case MacroUpdated = "macro_updated";
61+
case MacroUpdate = "macro_update";
6262
case MaliciousDomainsSettingChange = "malicious_domains_setting_change";
6363
case MessageDeletion = "message_deletion";
6464
case MessageStateChange = "message_state_change";
@@ -80,6 +80,11 @@ enum ActivityLogActivityType: string
8080
case SeatChange = "seat_change";
8181
case SeatRevoke = "seat_revoke";
8282
case SecuritySettingsChange = "security_settings_change";
83+
case SeriesCreation = "series_creation";
84+
case SeriesDeletion = "series_deletion";
85+
case SeriesSettingsUpdate = "series_settings_update";
86+
case SeriesStatusChange = "series_status_change";
87+
case SeriesUpdate = "series_update";
8388
case StripInboundEmailLinksChange = "strip_inbound_email_links_change";
8489
case TemporaryExpectationChange = "temporary_expectation_change";
8590
case TeamAssignmentLimitChange = "team_assignment_limit_change";

src/Types/IpAllowlist.php

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?php
2+
3+
namespace Intercom\Types;
4+
5+
use Intercom\Core\Json\JsonSerializableType;
6+
use Intercom\Core\Json\JsonProperty;
7+
use Intercom\Core\Types\ArrayType;
8+
9+
/**
10+
* IP allowlist settings for the workspace.
11+
*/
12+
class IpAllowlist extends JsonSerializableType
13+
{
14+
/**
15+
* @var ?string $type String representing the object's type. Always has the value `ip_allowlist`.
16+
*/
17+
#[JsonProperty('type')]
18+
private ?string $type;
19+
20+
/**
21+
* @var ?bool $enabled Whether the IP allowlist is enabled for the workspace.
22+
*/
23+
#[JsonProperty('enabled')]
24+
private ?bool $enabled;
25+
26+
/**
27+
* List of allowed IP addresses and/or IP ranges in CIDR notation.
28+
* Examples:
29+
* - Single IP: `192.168.0.1`
30+
* - IP range: `192.168.0.1/24` (allows 192.168.0.0 - 192.168.0.255)
31+
*
32+
* @var ?array<string> $ipAllowlist
33+
*/
34+
#[JsonProperty('ip_allowlist'), ArrayType(['string'])]
35+
private ?array $ipAllowlist;
36+
37+
/**
38+
* @param array{
39+
* type?: ?string,
40+
* enabled?: ?bool,
41+
* ipAllowlist?: ?array<string>,
42+
* } $values
43+
*/
44+
public function __construct(
45+
array $values = [],
46+
) {
47+
$this->type = $values['type'] ?? null;
48+
$this->enabled = $values['enabled'] ?? null;
49+
$this->ipAllowlist = $values['ipAllowlist'] ?? null;
50+
}
51+
52+
/**
53+
* @return ?string
54+
*/
55+
public function getType(): ?string
56+
{
57+
return $this->type;
58+
}
59+
60+
/**
61+
* @param ?string $value
62+
*/
63+
public function setType(?string $value = null): self
64+
{
65+
$this->type = $value;
66+
return $this;
67+
}
68+
69+
/**
70+
* @return ?bool
71+
*/
72+
public function getEnabled(): ?bool
73+
{
74+
return $this->enabled;
75+
}
76+
77+
/**
78+
* @param ?bool $value
79+
*/
80+
public function setEnabled(?bool $value = null): self
81+
{
82+
$this->enabled = $value;
83+
return $this;
84+
}
85+
86+
/**
87+
* @return ?array<string>
88+
*/
89+
public function getIpAllowlist(): ?array
90+
{
91+
return $this->ipAllowlist;
92+
}
93+
94+
/**
95+
* @param ?array<string> $value
96+
*/
97+
public function setIpAllowlist(?array $value = null): self
98+
{
99+
$this->ipAllowlist = $value;
100+
return $this;
101+
}
102+
103+
/**
104+
* @return string
105+
*/
106+
public function __toString(): string
107+
{
108+
return $this->toJson();
109+
}
110+
}

src/Unstable/AiAgent/Types/AiAgentResolutionState.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ enum AiAgentResolutionState: string
88
case ConfirmedResolution = "confirmed_resolution";
99
case Escalated = "escalated";
1010
case NegativeFeedback = "negative_feedback";
11+
case ProcedureHandoff = "procedure_handoff";
1112
}

src/Unstable/Contacts/Requests/UpdateContactRequest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ class UpdateContactRequest extends JsonSerializableType
7373
#[JsonProperty('unsubscribed_from_emails')]
7474
private ?bool $unsubscribedFromEmails;
7575

76+
/**
77+
* @var ?string $languageOverride A preferred language setting for the contact, used by Intercom as the language of Fin and the Messenger even if their browser has a different setting. Supports ISO 639-1 two-letter language codes. If an unsupported code is supplied, the field will be set to null.
78+
*/
79+
#[JsonProperty('language_override')]
80+
private ?string $languageOverride;
81+
7682
/**
7783
* @var ?array<string, mixed> $customAttributes The custom attributes which are set for the contact
7884
*/
@@ -92,6 +98,7 @@ class UpdateContactRequest extends JsonSerializableType
9298
* lastSeenAt?: ?int,
9399
* ownerId?: ?int,
94100
* unsubscribedFromEmails?: ?bool,
101+
* languageOverride?: ?string,
95102
* customAttributes?: ?array<string, mixed>,
96103
* } $values
97104
*/
@@ -109,6 +116,7 @@ public function __construct(
109116
$this->lastSeenAt = $values['lastSeenAt'] ?? null;
110117
$this->ownerId = $values['ownerId'] ?? null;
111118
$this->unsubscribedFromEmails = $values['unsubscribedFromEmails'] ?? null;
119+
$this->languageOverride = $values['languageOverride'] ?? null;
112120
$this->customAttributes = $values['customAttributes'] ?? null;
113121
}
114122

@@ -299,6 +307,23 @@ public function setUnsubscribedFromEmails(?bool $value = null): self
299307
return $this;
300308
}
301309

310+
/**
311+
* @return ?string
312+
*/
313+
public function getLanguageOverride(): ?string
314+
{
315+
return $this->languageOverride;
316+
}
317+
318+
/**
319+
* @param ?string $value
320+
*/
321+
public function setLanguageOverride(?string $value = null): self
322+
{
323+
$this->languageOverride = $value;
324+
return $this;
325+
}
326+
302327
/**
303328
* @return ?array<string, mixed>
304329
*/

0 commit comments

Comments
 (0)