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
The table of contents is too big for display.
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": "e5cd0731cb3a1f2ed5821f8d60191bd58934c3dd",
"originGitCommit": "31a712963c171ce9ebd6815e873c9895e389afc2",
"originGitCommitIsDirty": false,
"invokedBy": "ci",
"requestedVersion": "3.0.0-alpha.9",
"requestedVersion": "3.0.0-alpha.10",
"ciProvider": "github",
"sdkVersion": "3.0.0-alpha.9"
"sdkVersion": "3.0.0-alpha.10"
}
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.9",
"sdkVersion": "3.0.0-alpha.9",
"canonicalVersion": "3.0.0-next.10",
"sdkVersion": "3.0.0-alpha.10",
"source": {
"repository": "embedpdf/embed-pdf-viewer",
"openapi": "cloudpdf/contract/openapi.json",
"openapiSha256": "4ee27900dbb0b13408ce00a0e80d606444ab81e9d5a76186fa984c8c8dfe09fe",
"gitCommit": "e5cd0731cb3a1f2ed5821f8d60191bd58934c3dd",
"openapiSha256": "9d6c7cdd459982ba9e718a3842c969003b466e3fd73883fef7783dc78e12cdfe",
"gitCommit": "31a712963c171ce9ebd6815e873c9895e389afc2",
"gitCommitIsDirty": false
},
"fern": {
Expand Down
74 changes: 74 additions & 0 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1963,6 +1963,80 @@ $client->tokens->revoke(
</details>

## Doc Annotations
<details><summary><code>$client-&gt;doc-&gt;annotations-&gt;listAll($docId, $layerName, $request) -> ?DocAnnotationsListAll200Response</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Returns one entry per page plus the audit-log cursor for reconciling subsequent document events. Page order is unspecified; join by `pageState.pageObjectNumber` when display order matters.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```php
$client->doc->annotations->listAll(
'docId',
'layerName',
new ListAllAnnotationsRequest([]),
);
```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**$docId:** `string`

</dd>
</dl>

<dl>
<dd>

**$layerName:** `string`

</dd>
</dl>

<dl>
<dd>

**$documentPassword:** `?string` — Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.

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


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

<details><summary><code>$client-&gt;doc-&gt;annotations-&gt;list($docId, $layerName, $pon, $request) -> ?DocAnnotationsList200Response</code></summary>
<dl>
<dd>
Expand Down
4 changes: 2 additions & 2 deletions src/CloudPDFClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public function __construct(
$defaultHeaders = [
'X-Fern-Language' => 'PHP',
'X-Fern-SDK-Name' => 'CloudPDF',
'X-Fern-SDK-Version' => '3.0.0-alpha.9',
'User-Agent' => 'cloudpdf/sdk/3.0.0-alpha.9',
'X-Fern-SDK-Version' => '3.0.0-alpha.10',
'User-Agent' => 'cloudpdf/sdk/3.0.0-alpha.10',
];
if ($token != null) {
$defaultHeaders['Authorization'] = "Bearer $token";
Expand Down
70 changes: 68 additions & 2 deletions src/Doc/Annotations/AnnotationsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

use Psr\Http\Client\ClientInterface;
use CloudPDF\Core\Client\RawClient;
use CloudPDF\Doc\Annotations\Requests\ListAnnotationsRequest;
use CloudPDF\Types\DocAnnotationsList200Response;
use CloudPDF\Doc\Annotations\Requests\ListAllAnnotationsRequest;
use CloudPDF\Types\DocAnnotationsListAll200Response;
use CloudPDF\Exceptions\CloudPDFException;
use CloudPDF\Exceptions\CloudPDFApiException;
use CloudPDF\Core\Json\JsonApiRequest;
use CloudPDF\Core\Client\HttpMethod;
use JsonException;
use Psr\Http\Client\ClientExceptionInterface;
use CloudPDF\Doc\Annotations\Requests\ListAnnotationsRequest;
use CloudPDF\Types\DocAnnotationsList200Response;
use CloudPDF\Doc\Annotations\Requests\CreateAnnotationsRequest;
use CloudPDF\Types\DocAnnotationsCreate200Response;
use CloudPDF\Doc\Annotations\Requests\DeleteAnnotationsRequest;
Expand Down Expand Up @@ -55,6 +57,70 @@ public function __construct(
$this->options = $options ?? [];
}

/**
* Returns one entry per page plus the audit-log cursor for reconciling subsequent document events. Page order is unspecified; join by `pageState.pageObjectNumber` when display order matters.
*
* Example:
* ```php
* $client->doc->annotations->listAll(
* 'docId',
* 'layerName',
* new ListAllAnnotationsRequest([]),
* );
* ```
*
* @param string $docId
* @param string $layerName
* @param ListAllAnnotationsRequest $request
* @param ?array{
* baseUrl?: string,
* maxRetries?: int,
* timeout?: float,
* headers?: array<string, string>,
* queryParameters?: array<string, mixed>,
* bodyProperties?: array<string, mixed>,
* } $options
* @return ?DocAnnotationsListAll200Response
* @throws CloudPDFException
* @throws CloudPDFApiException
*/
public function listAll(string $docId, string $layerName, ListAllAnnotationsRequest $request = new ListAllAnnotationsRequest(), ?array $options = null): ?DocAnnotationsListAll200Response
{
$options = array_merge($this->options, $options ?? []);
$headers = [];
if ($request->documentPassword != null) {
$headers['X-Document-Password'] = $request->documentPassword;
}
try {
$response = $this->client->sendRequest(
new JsonApiRequest(
baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? '',
path: "v1/docs/{$docId}/layers/{$layerName}/annotations/items",
method: HttpMethod::GET,
headers: $headers,
),
$options,
);
$statusCode = $response->getStatusCode();
if ($statusCode >= 200 && $statusCode < 400) {
$json = $response->getBody()->getContents();
if (empty($json)) {
return null;
}
return DocAnnotationsListAll200Response::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
24 changes: 24 additions & 0 deletions src/Doc/Annotations/Requests/ListAllAnnotationsRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace CloudPDF\Doc\Annotations\Requests;

use CloudPDF\Core\Json\JsonSerializableType;

class ListAllAnnotationsRequest extends JsonSerializableType
{
/**
* @var ?string $documentPassword Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
*/
public ?string $documentPassword;

/**
* @param array{
* documentPassword?: ?string,
* } $values
*/
public function __construct(
array $values = [],
) {
$this->documentPassword = $values['documentPassword'] ?? null;
}
}
8 changes: 8 additions & 0 deletions src/Types/DocAnnotationsCreate200ResponseMetaCacheDelta.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ class DocAnnotationsCreate200ResponseMetaCacheDelta extends JsonSerializableType
#[JsonProperty('docVersion')]
public int $docVersion;

/**
* @var ?int $annotationsVersion
*/
#[JsonProperty('annotationsVersion')]
public ?int $annotationsVersion;

/**
* @var array<DocAnnotationsCreate200ResponseMetaCacheDeltaPagesItem> $pages
*/
Expand All @@ -31,13 +37,15 @@ class DocAnnotationsCreate200ResponseMetaCacheDelta extends JsonSerializableType
* previousDocVersion: int,
* docVersion: int,
* pages: array<DocAnnotationsCreate200ResponseMetaCacheDeltaPagesItem>,
* annotationsVersion?: ?int,
* } $values
*/
public function __construct(
array $values,
) {
$this->previousDocVersion = $values['previousDocVersion'];
$this->docVersion = $values['docVersion'];
$this->annotationsVersion = $values['annotationsVersion'] ?? null;
$this->pages = $values['pages'];
}

Expand Down
8 changes: 8 additions & 0 deletions src/Types/DocAnnotationsDelete200ResponseMetaCacheDelta.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ class DocAnnotationsDelete200ResponseMetaCacheDelta extends JsonSerializableType
#[JsonProperty('docVersion')]
public int $docVersion;

/**
* @var ?int $annotationsVersion
*/
#[JsonProperty('annotationsVersion')]
public ?int $annotationsVersion;

/**
* @var array<DocAnnotationsDelete200ResponseMetaCacheDeltaPagesItem> $pages
*/
Expand All @@ -31,13 +37,15 @@ class DocAnnotationsDelete200ResponseMetaCacheDelta extends JsonSerializableType
* previousDocVersion: int,
* docVersion: int,
* pages: array<DocAnnotationsDelete200ResponseMetaCacheDeltaPagesItem>,
* annotationsVersion?: ?int,
* } $values
*/
public function __construct(
array $values,
) {
$this->previousDocVersion = $values['previousDocVersion'];
$this->docVersion = $values['docVersion'];
$this->annotationsVersion = $values['annotationsVersion'] ?? null;
$this->pages = $values['pages'];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ class DocAnnotationsList200ResponseAnnotationsItemCaret extends JsonSerializable
#[JsonProperty('contents')]
public ?string $contents;

/**
* @var ?string $subject
*/
#[JsonProperty('subject')]
public ?string $subject;

/**
* @var ?string $author
*/
Expand Down Expand Up @@ -172,6 +178,7 @@ class DocAnnotationsList200ResponseAnnotationsItemCaret extends JsonSerializable
* opacity: float,
* nm?: ?string,
* contents?: ?string,
* subject?: ?string,
* author?: ?string,
* created?: ?DateTime,
* modified?: ?DateTime,
Expand Down Expand Up @@ -199,6 +206,7 @@ public function __construct(
$this->flags = $values['flags'];
$this->rect = $values['rect'];
$this->contents = $values['contents'] ?? null;
$this->subject = $values['subject'] ?? null;
$this->author = $values['author'] ?? null;
$this->created = $values['created'] ?? null;
$this->modified = $values['modified'] ?? null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ class DocAnnotationsList200ResponseAnnotationsItemCircle extends JsonSerializabl
#[JsonProperty('contents')]
public ?string $contents;

/**
* @var ?string $subject
*/
#[JsonProperty('subject')]
public ?string $subject;

/**
* @var ?string $author
*/
Expand Down Expand Up @@ -199,6 +205,7 @@ class DocAnnotationsList200ResponseAnnotationsItemCircle extends JsonSerializabl
* borderStyle: value-of<DocAnnotationsList200ResponseAnnotationsItemCircleBorderStyle>,
* nm?: ?string,
* contents?: ?string,
* subject?: ?string,
* author?: ?string,
* created?: ?DateTime,
* modified?: ?DateTime,
Expand Down Expand Up @@ -228,6 +235,7 @@ public function __construct(
$this->flags = $values['flags'];
$this->rect = $values['rect'];
$this->contents = $values['contents'] ?? null;
$this->subject = $values['subject'] ?? null;
$this->author = $values['author'] ?? null;
$this->created = $values['created'] ?? null;
$this->modified = $values['modified'] ?? null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ class DocAnnotationsList200ResponseAnnotationsItemFileAttachment extends JsonSer
#[JsonProperty('contents')]
public ?string $contents;

/**
* @var ?string $subject
*/
#[JsonProperty('subject')]
public ?string $subject;

/**
* @var ?string $author
*/
Expand Down Expand Up @@ -162,6 +168,7 @@ class DocAnnotationsList200ResponseAnnotationsItemFileAttachment extends JsonSer
* file: DocAnnotationsList200ResponseAnnotationsItemFileAttachmentFile,
* nm?: ?string,
* contents?: ?string,
* subject?: ?string,
* author?: ?string,
* created?: ?DateTime,
* modified?: ?DateTime,
Expand All @@ -185,6 +192,7 @@ public function __construct(
$this->flags = $values['flags'];
$this->rect = $values['rect'];
$this->contents = $values['contents'] ?? null;
$this->subject = $values['subject'] ?? null;
$this->author = $values['author'] ?? null;
$this->created = $values['created'] ?? null;
$this->modified = $values['modified'] ?? null;
Expand Down
Loading
Loading