Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"homepage": "https://www.cloudpdf.com"
}
},
"originGitCommit": "622018abaf6e4578d1f4d8377982c48b92c9ced3",
"originGitCommit": "3283147ded32fc15c426768f75557a4d95943d84",
"originGitCommitIsDirty": false,
"invokedBy": "ci",
"requestedVersion": "3.0.0-alpha.20",
"requestedVersion": "3.0.0-alpha.21",
"ciProvider": "github",
"sdkVersion": "3.0.0-alpha.20"
"sdkVersion": "3.0.0-alpha.21"
}
8 changes: 4 additions & 4 deletions cloudpdf-generation.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"language": "php",
"canonicalVersion": "3.0.0-next.20",
"sdkVersion": "3.0.0-alpha.20",
"canonicalVersion": "3.0.0-next.21",
"sdkVersion": "3.0.0-alpha.21",
"source": {
"repository": "embedpdf/embed-pdf-viewer",
"openapi": "cloudpdf/contract/openapi.json",
"openapiSha256": "47d739acb956ce8ba0c3990117e505be2e9406038d9e0cd1729608921a40b2d9",
"gitCommit": "622018abaf6e4578d1f4d8377982c48b92c9ced3",
"openapiSha256": "f85648401f5c683a32e2b50acc3d753df9f4ce06df8492e5d2b599beceb0e788",
"gitCommit": "3283147ded32fc15c426768f75557a4d95943d84",
"gitCommitIsDirty": false
},
"fern": {
Expand Down
71 changes: 71 additions & 0 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,77 @@ $client->tenants->delete(
</dl>


</dd>
</dl>
</details>

<details><summary><code>$client-&gt;tenants-&gt;update($tenantId, $request) -> ?TenantsUpdate200Response</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

A feature names an installed module; any other id is a 400. A module route answers a tenant without its feature 403 FeatureNotEnabled, and one whose feature is stopped 402 FeatureStopped (details.feature, details.stopped). Other replicas apply a change within 30 seconds.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```php
$client->tenants->update(
'tenantId',
new TenantsUpdateRequest([
'features' => [
new TenantFeature([
'id' => 'id',
]),
],
]),
);
```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**$tenantId:** `string`

</dd>
</dl>

<dl>
<dd>

**$features:** `array`

</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>
Expand Down
4 changes: 2 additions & 2 deletions src/CloudPDFClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public function __construct(
$defaultHeaders = [
'X-Fern-Language' => 'PHP',
'X-Fern-SDK-Name' => 'CloudPDF',
'X-Fern-SDK-Version' => '3.0.0-alpha.20',
'User-Agent' => 'cloudpdf/sdk/3.0.0-alpha.20',
'X-Fern-SDK-Version' => '3.0.0-alpha.21',
'User-Agent' => 'cloudpdf/sdk/3.0.0-alpha.21',
];
if ($token != null) {
$defaultHeaders['Authorization'] = "Bearer $token";
Expand Down
28 changes: 28 additions & 0 deletions src/Tenants/Requests/TenantsUpdateRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace CloudPDF\Tenants\Requests;

use CloudPDF\Core\Json\JsonSerializableType;
use CloudPDF\Types\TenantFeature;
use CloudPDF\Core\Json\JsonProperty;
use CloudPDF\Core\Types\ArrayType;

class TenantsUpdateRequest extends JsonSerializableType
{
/**
* @var array<TenantFeature> $features
*/
#[JsonProperty('features'), ArrayType([TenantFeature::class])]
public array $features;

/**
* @param array{
* features: array<TenantFeature>,
* } $values
*/
public function __construct(
array $values,
) {
$this->features = $values['features'];
}
}
66 changes: 66 additions & 0 deletions src/Tenants/TenantsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
use CloudPDF\Tenants\Requests\TenantsCreateRequest;
use CloudPDF\Types\TenantsCreate200Response;
use CloudPDF\Types\TenantsGet200Response;
use CloudPDF\Tenants\Requests\TenantsUpdateRequest;
use CloudPDF\Types\TenantsUpdate200Response;
use CloudPDF\Tenants\Requests\TenantsSuspendRequest;
use CloudPDF\Tenants\Requests\UsageTenantsRequest;
use CloudPDF\Types\TenantsUsage200Response;
Expand Down Expand Up @@ -274,6 +276,70 @@ public function delete(string $tenantId, ?array $options = null): void
);
}

/**
* A feature names an installed module; any other id is a 400. A module route answers a tenant without its feature 403 FeatureNotEnabled, and one whose feature is stopped 402 FeatureStopped (details.feature, details.stopped). Other replicas apply a change within 30 seconds.
*
* Example:
* ```php
* $client->tenants->update(
* 'tenantId',
* new TenantsUpdateRequest([
* 'features' => [
* new TenantFeature([
* 'id' => 'id',
* ]),
* ],
* ]),
* );
* ```
*
* @param string $tenantId
* @param TenantsUpdateRequest $request
* @param ?array{
* baseUrl?: string,
* maxRetries?: int,
* timeout?: float,
* headers?: array<string, string>,
* queryParameters?: array<string, mixed>,
* bodyProperties?: array<string, mixed>,
* } $options
* @return ?TenantsUpdate200Response
* @throws CloudPDFException
* @throws CloudPDFApiException
*/
public function update(string $tenantId, TenantsUpdateRequest $request, ?array $options = null): ?TenantsUpdate200Response
{
$options = array_merge($this->options, $options ?? []);
try {
$response = $this->client->sendRequest(
new JsonApiRequest(
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Saas->value,
path: "v1/tenants/{$tenantId}",
method: HttpMethod::PATCH,
body: $request,
),
$options,
);
$statusCode = $response->getStatusCode();
if ($statusCode >= 200 && $statusCode < 400) {
$json = $response->getBody()->getContents();
if (empty($json)) {
return null;
}
return TenantsUpdate200Response::fromJson($json);
}
} catch (JsonException $e) {
throw new CloudPDFException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e);
} catch (ClientExceptionInterface $e) {
throw new CloudPDFException(message: $e->getMessage(), previous: $e);
}
throw new CloudPDFApiException(
message: 'API request failed',
statusCode: $statusCode,
body: $response->getBody()->getContents(),
);
}

/**
* Example:
* ```php
Expand Down
42 changes: 42 additions & 0 deletions src/Types/TenantFeature.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace CloudPDF\Types;

use CloudPDF\Core\Json\JsonSerializableType;
use CloudPDF\Core\Json\JsonProperty;

class TenantFeature extends JsonSerializableType
{
/**
* @var string $id
*/
#[JsonProperty('id')]
public string $id;

/**
* @var ?value-of<TenantFeatureStopped> $stopped
*/
#[JsonProperty('stopped')]
public ?string $stopped;

/**
* @param array{
* id: string,
* stopped?: ?value-of<TenantFeatureStopped>,
* } $values
*/
public function __construct(
array $values,
) {
$this->id = $values['id'];
$this->stopped = $values['stopped'] ?? null;
}

/**
* @return string
*/
public function __toString(): string
{
return $this->toJson();
}
}
8 changes: 8 additions & 0 deletions src/Types/TenantFeatureStopped.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace CloudPDF\Types;

enum TenantFeatureStopped: string
{
case Cap = "cap";
}
9 changes: 9 additions & 0 deletions src/Types/TenantsCreate200ResponseTenant.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use CloudPDF\Core\Json\JsonSerializableType;
use CloudPDF\Core\Json\JsonProperty;
use CloudPDF\Core\Types\ArrayType;

class TenantsCreate200ResponseTenant extends JsonSerializableType
{
Expand Down Expand Up @@ -31,6 +32,12 @@ class TenantsCreate200ResponseTenant extends JsonSerializableType
#[JsonProperty('status')]
public ?string $status;

/**
* @var ?array<TenantFeature> $features
*/
#[JsonProperty('features'), ArrayType([TenantFeature::class])]
public ?array $features;

/**
* @var float $createdAt
*/
Expand All @@ -44,6 +51,7 @@ class TenantsCreate200ResponseTenant extends JsonSerializableType
* autoProvisioned: bool,
* createdAt: float,
* status?: ?value-of<TenantsCreate200ResponseTenantStatus>,
* features?: ?array<TenantFeature>,
* } $values
*/
public function __construct(
Expand All @@ -53,6 +61,7 @@ public function __construct(
$this->name = $values['name'];
$this->autoProvisioned = $values['autoProvisioned'];
$this->status = $values['status'] ?? null;
$this->features = $values['features'] ?? null;
$this->createdAt = $values['createdAt'];
}

Expand Down
9 changes: 9 additions & 0 deletions src/Types/TenantsGet200ResponseTenant.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use CloudPDF\Core\Json\JsonSerializableType;
use CloudPDF\Core\Json\JsonProperty;
use CloudPDF\Core\Types\ArrayType;

class TenantsGet200ResponseTenant extends JsonSerializableType
{
Expand Down Expand Up @@ -31,6 +32,12 @@ class TenantsGet200ResponseTenant extends JsonSerializableType
#[JsonProperty('status')]
public ?string $status;

/**
* @var ?array<TenantFeature> $features
*/
#[JsonProperty('features'), ArrayType([TenantFeature::class])]
public ?array $features;

/**
* @var float $createdAt
*/
Expand All @@ -44,6 +51,7 @@ class TenantsGet200ResponseTenant extends JsonSerializableType
* autoProvisioned: bool,
* createdAt: float,
* status?: ?value-of<TenantsGet200ResponseTenantStatus>,
* features?: ?array<TenantFeature>,
* } $values
*/
public function __construct(
Expand All @@ -53,6 +61,7 @@ public function __construct(
$this->name = $values['name'];
$this->autoProvisioned = $values['autoProvisioned'];
$this->status = $values['status'] ?? null;
$this->features = $values['features'] ?? null;
$this->createdAt = $values['createdAt'];
}

Expand Down
9 changes: 9 additions & 0 deletions src/Types/TenantsList200ResponseTenantsItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use CloudPDF\Core\Json\JsonSerializableType;
use CloudPDF\Core\Json\JsonProperty;
use CloudPDF\Core\Types\ArrayType;

class TenantsList200ResponseTenantsItem extends JsonSerializableType
{
Expand Down Expand Up @@ -31,6 +32,12 @@ class TenantsList200ResponseTenantsItem extends JsonSerializableType
#[JsonProperty('status')]
public ?string $status;

/**
* @var ?array<TenantFeature> $features
*/
#[JsonProperty('features'), ArrayType([TenantFeature::class])]
public ?array $features;

/**
* @var float $createdAt
*/
Expand All @@ -44,6 +51,7 @@ class TenantsList200ResponseTenantsItem extends JsonSerializableType
* autoProvisioned: bool,
* createdAt: float,
* status?: ?value-of<TenantsList200ResponseTenantsItemStatus>,
* features?: ?array<TenantFeature>,
* } $values
*/
public function __construct(
Expand All @@ -53,6 +61,7 @@ public function __construct(
$this->name = $values['name'];
$this->autoProvisioned = $values['autoProvisioned'];
$this->status = $values['status'] ?? null;
$this->features = $values['features'] ?? null;
$this->createdAt = $values['createdAt'];
}

Expand Down
Loading
Loading