Skip to content

Commit 2818f71

Browse files
committed
chore: sync PHP client with Apify OpenAPI spec v2-2026-08-05T133145Z
- Bump Version::API_SPEC_VERSION (no schema/behavior changes required beyond the version constant: the spec delta is additive nullability, new error responses and doc-only tag/description changes). - Add TaskClient::publish()/unpublish() convenience methods and Task::isPublic()/getPublicConfig() getters, mirroring the reference JS client's new task publish/unpublish support (apify/apify-client-js#989). - De-duplicate the "official, but experimental, AI-generated" disclaimer so it appears only in the top-level README, per the updated client requirements (apify/apify-client-orchestration#41).
1 parent b0504b1 commit 2818f71

9 files changed

Lines changed: 94 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 0.4.0
4+
5+
- Synced to Apify OpenAPI spec `v2-2026-08-05T133145Z` (additive nullability/response/description
6+
changes only; no client code changes required beyond the version constant).
7+
- Added `TaskClient::publish()` and `TaskClient::unpublish()` convenience methods (mirroring the
8+
reference JS client), plus `Task::isPublic()` and `Task::getPublicConfig()` getters.
9+
- Removed the duplicated "official, but experimental, AI-generated" disclaimer from
10+
`docs/README.md` and the `ApifyClient` class docblock; it is now stated only once, in the
11+
top-level `README.md`.
12+
313
## 0.3.4
414

515
- Synced to Apify OpenAPI spec `v2-2026-07-13T092445Z` (adds `402`/`408` error responses to the

docs/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Apify PHP client documentation
22

3-
> **Official, but experimental — AI-generated and AI-maintained.** This is an official Apify client,
4-
> but it is experimental: it is generated and maintained by AI. Review the code before relying on it
5-
> in production and report issues on the repository.
6-
73
This directory documents the public API of the Apify PHP client, organized by resource. Each page
84
lists the available methods with their parameters and short, runnable snippets. For an overview,
95
configuration and error handling, see the [top-level README](../README.md).

docs/models.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ model is also used as an input object and therefore additionally exposes setters
7272
| `getTitle(): ?string` | Human-readable title. |
7373
| `getCreatedAt(): ?string` | ISO-8601 creation timestamp. |
7474
| `getModifiedAt(): ?string` | ISO-8601 last-modification timestamp. |
75+
| `isPublic(): ?bool` | Whether the task is published on its public landing page. |
76+
| `getPublicConfig(): ?array` | Public landing page display configuration, or `null` if not published. |
7577

7678
### `Schedule`
7779
| Getter | Description |

docs/tasks.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ foreach ($client->tasks()->iterate(new ListOptions(), 50) as $t) {
2424
## A single task — `$client->task($id)`
2525

2626
- `get(): ?Task`, `update(mixed $newFields): Task`, `delete(): void`
27+
- `publish(): Task`, `unpublish(): Task` — publish/unpublish the task's public landing page, by
28+
setting `isPublic` through `update()`. Publishing requires the task's Actor to be public and the
29+
task to already have its `publicConfig` set up.
2730
- `start(mixed $input = null, ?TaskStartOptions $options = null): ActorRun`
2831
- `call(mixed $input = null, ?TaskStartOptions $options = null, ?int $waitSecs = null): ActorRun`
2932
- `getInput(): mixed`, `updateInput(mixed $input): mixed`
@@ -34,4 +37,5 @@ foreach ($client->tasks()->iterate(new ListOptions(), 50) as $t) {
3437
```php
3538
$run = $client->task('me~my-task')->call(['message' => 'override'], null, 120);
3639
$input = $client->task('me~my-task')->getInput();
40+
$client->task('me~my-task')->publish();
3741
```

src/ApifyClient.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
/**
4343
* The entry point for interacting with the Apify API.
4444
*
45-
* <b>Official, but experimental — AI-generated and AI-maintained.</b> This is an official Apify
46-
* client, but it is experimental: it is generated and maintained by AI. Review the code before
47-
* relying on it in production and report issues on the repository.
48-
*
4945
* Construct it with an API token (and optional settings via named arguments), then obtain resource
5046
* clients via the accessor methods, e.g. {@see actor()}, {@see dataset()}, {@see run()}.
5147
*

src/Model/Task.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,27 @@ public function getModifiedAt(): ?string
4848
{
4949
return $this->getString('modifiedAt');
5050
}
51+
52+
/**
53+
* Whether the task is published on its public landing page. Derived from
54+
* {@code publicConfig.publishedAt} — use {@see TaskClient::publish()} and
55+
* {@see TaskClient::unpublish()} to change it.
56+
*/
57+
public function isPublic(): ?bool
58+
{
59+
return $this->getBool('isPublic');
60+
}
61+
62+
/**
63+
* The public-facing display configuration of the task's public landing page, or {@code null}
64+
* if the task is not published. Contains fields such as {@code publishedAt}, {@code seoTitle}
65+
* and {@code datasetView}.
66+
*
67+
* @return array<string,mixed>|null
68+
*/
69+
public function getPublicConfig(): ?array
70+
{
71+
$value = $this->get('publicConfig');
72+
return is_array($value) ? $value : null;
73+
}
5174
}

src/Resource/TaskClient.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,32 @@ public function delete(): void
5757
$this->ctx->deleteResource('');
5858
}
5959

60+
/**
61+
* Publishes the task on its public landing page, by setting {@code isPublic} through
62+
* {@see update()}.
63+
*
64+
* The task's Actor must be public and the task must have its public display configuration
65+
* ({@code publicConfig}) set up first. Requires write permission to both the task and its
66+
* Actor. Publishing an already published task does nothing.
67+
*/
68+
public function publish(): Task
69+
{
70+
return $this->update(['isPublic' => true]);
71+
}
72+
73+
/**
74+
* Unpublishes the task from its public landing page, by setting {@code isPublic} through
75+
* {@see update()}.
76+
*
77+
* The public display configuration ({@code publicConfig}) is preserved, so the task can be
78+
* published again without re-entering it. Requires write permission to both the task and its
79+
* Actor. Unpublishing a task that is not published does nothing.
80+
*/
81+
public function unpublish(): Task
82+
{
83+
return $this->update(['isPublic' => false]);
84+
}
85+
6086
/**
6187
* Starts the task and returns immediately with the created run.
6288
*

src/Version.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ final class Version
1717
* The semantic version of this client library (see https://semver.org/).
1818
* Changes to the public interface other than additive ones are considered breaking changes.
1919
*/
20-
public const CLIENT_VERSION = '0.3.4';
20+
public const CLIENT_VERSION = '0.4.0';
2121

2222
/**
2323
* The version of the Apify OpenAPI specification this client was generated and verified
2424
* against. Corresponds to the {@code info.version} field of the Apify OpenAPI document.
2525
*/
26-
public const API_SPEC_VERSION = 'v2-2026-07-13T092445Z';
26+
public const API_SPEC_VERSION = 'v2-2026-08-05T133145Z';
2727

2828
private function __construct()
2929
{

tests/Integration/TaskIntegrationTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Apify\Client\Tests\Integration;
66

7+
use Apify\Client\Exception\ApifyApiException;
78
use Apify\Client\Options\ListOptions;
89
use Apify\Client\Options\RunListOptions;
910

@@ -66,6 +67,32 @@ public function testIterateTasks(): void
6667
}
6768
}
6869

70+
public function testPublishUnpublish(): void
71+
{
72+
$client = $this->requireClient();
73+
$task = $client->tasks()->create(self::taskDef(self::uniqueName('task-publish')));
74+
try {
75+
$tc = $client->task((string) $task->getId());
76+
77+
// unpublish() is safe to call even on an unpublished task (no publicConfig required)
78+
// and always echoes the isPublic value back, unlike publish() below.
79+
$unpublished = $tc->unpublish();
80+
self::assertFalse($unpublished->isPublic());
81+
82+
// publish() requires write permission to the task's Actor. The task's Actor
83+
// (apify/hello-world) is not owned by the test account, so this is expected to fail
84+
// with a 403 rather than silently succeed.
85+
try {
86+
$tc->publish();
87+
self::fail('expected publish() to fail: the task Actor is not owned by the test account');
88+
} catch (ApifyApiException $e) {
89+
self::assertSame(403, $e->getStatusCode());
90+
}
91+
} finally {
92+
$client->task((string) $task->getId())->delete();
93+
}
94+
}
95+
6996
public function testTaskCrudFlow(): void
7097
{
7198
$client = $this->requireClient();

0 commit comments

Comments
 (0)