diff --git a/CHANGELOG.md b/CHANGELOG.md index 111557f..ceffd08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,25 @@ All notable changes to the Apify Go client are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.8.2] - 2026-08-15 + +### Changed + +- Synced against Apify OpenAPI spec `v2-2026-08-14T072928Z`, which formally documents the + Task `isPublic`/`publicConfig` fields this client already implemented; updated the + `Task.IsPublic` doc comment and `docs/tasks.md` to no longer describe them as undocumented. +- Bumped `APISpecVersion` to `v2-2026-08-14T072928Z` and `ClientVersion` to `0.8.2`. +- Updated `README.md`'s documented `APISpecVersion` example, which was stale by two spec + versions. + +### Fixed + +- Corrected the `TaskClient.Unpublish` doc comment (and the matching integration-test + comment): the spec's `PUT /actor-tasks/{id}` description now states that both publishing + and unpublishing require write permission to the task's Actor, which this client's comment + had (incorrectly, per the previous release's changelog) claimed was not the case for + unpublishing. + ## [0.8.1] - 2026-08-11 ### Changed diff --git a/README.md b/README.md index 6806bc5..e5ea80f 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ func main() { - `apify.ClientVersion` — the semantic version of this library. - `apify.APISpecVersion` — the Apify OpenAPI spec version this client was built against - (`v2-2026-07-13T092445Z`). + (`v2-2026-08-14T072928Z`). ### Releasing diff --git a/docs/tasks.md b/docs/tasks.md index d9463b5..63bacfb 100644 --- a/docs/tasks.md +++ b/docs/tasks.md @@ -22,7 +22,7 @@ A task is a pre-configured Actor run with stored input. Access the task collecti | `Title` | `string` | Human-readable title shown in the UI. | | `CreatedAt` | `*time.Time` | When the task was created. | | `ModifiedAt` | `*time.Time` | When the task was last modified. | -| `IsPublic` | `*bool` | Whether the task is published on its public landing page. Not part of the documented Task schema, but returned by the API in practice; use `Publish`/`Unpublish` to change it. | +| `IsPublic` | `*bool` | Whether the task is published on its public landing page, derived from `PublicConfig.PublishedAt`; use `Publish`/`Unpublish` to change it. | | `PublicConfig` | `*TaskPublicConfig` | Public-facing display configuration of the landing page, set once the task has been configured for publishing. | | `Extra` | `map[string]json.RawMessage` | Any other fields returned by the API. | @@ -92,7 +92,7 @@ if ok { `Publish`/`Unpublish` toggle the task's public landing page by updating `IsPublic`; both reuse the same `PUT /actor-tasks/{id}` endpoint as `Update`. `IsPublic` is a `*bool` (nil-checked -before use below) since it is not part of the documented Task schema. +before use below) so a missing field can be distinguished from `false`. ```go published, err := client.Task("my-task-id").Publish(ctx) diff --git a/models.go b/models.go index 7273a29..b4babf2 100644 --- a/models.go +++ b/models.go @@ -157,9 +157,10 @@ type Task struct { CreatedAt *time.Time `json:"createdAt"` // ModifiedAt is when the task was last modified. ModifiedAt *time.Time `json:"modifiedAt"` - // IsPublic reports whether the task is published on its public landing page. It is not part - // of the documented Task schema in the OpenAPI spec, but the API returns it in practice - // (mirroring the reference JS client); use TaskClient.Publish/Unpublish to change it. + // IsPublic reports whether the task is published on its public landing page, derived from + // PublicConfig.PublishedAt; use TaskClient.Publish/Unpublish to change it. Kept as *bool + // (the OpenAPI schema declares a plain boolean) so a missing field can be distinguished + // from false. IsPublic *bool `json:"isPublic,omitempty"` // PublicConfig is the public-facing display configuration of the task's landing page, set // when the task has been configured for publishing (nil otherwise). diff --git a/task.go b/task.go index 747de65..a465f70 100644 --- a/task.go +++ b/task.go @@ -47,9 +47,8 @@ func (c *TaskClient) Publish(ctx context.Context) (Task, error) { // Update. // // The public display configuration (PublicConfig) is preserved, so the task can be published -// again without re-entering it. Unlike Publish, Unpublish only requires write permission to -// the task itself - it succeeds even if the task's Actor is unowned or private. Unpublishing -// a task that is not published does nothing. +// again without re-entering it. Like Publish, Unpublish requires write permission to both the +// task and its Actor. Unpublishing a task that is not published does nothing. func (c *TaskClient) Unpublish(ctx context.Context) (Task, error) { return c.Update(ctx, map[string]any{"isPublic": false}) } diff --git a/tests/task_test.go b/tests/task_test.go index 8483690..a559f10 100644 --- a/tests/task_test.go +++ b/tests/task_test.go @@ -78,10 +78,13 @@ func TestTaskCRUDFlow(t *testing.T) { // TestTaskPublishUnpublish exercises Publish/Unpublish against a task whose Actor // (apify/hello-world) is not owned by the test account. // -// Publish requires write permission to both the task and its Actor, so it is expected to fail -// (400 for the missing PublicConfig, or 403 for the unowned Actor - the server may reject on -// either ground first). Unpublish only requires write permission to the task itself, so it is -// expected to succeed even though the Actor is unowned, and leaves IsPublic not-true. +// Publish (like Unpublish) requires write permission to both the task and its Actor, so it is +// expected to fail (400 for the missing PublicConfig, or 403 for the unowned Actor - the server +// may reject on either ground first). Unpublish is expected to succeed here because the task is +// already unpublished (created with IsPublic unset/false) and the API treats setting isPublic to +// its current value as a no-op, not because Unpublish has a smaller permission requirement than +// Publish - it does not create/verify an actually-published state on an unowned Actor, which is +// not achievable via this API (publishing always requires Actor write permission). func TestTaskPublishUnpublish(t *testing.T) { client := requireClient(t) ctx, cancel := testContext(t) diff --git a/version.go b/version.go index 1e88da2..ff9c5f6 100644 --- a/version.go +++ b/version.go @@ -4,10 +4,10 @@ package apify // // It follows Semantic Versioning (https://semver.org/). Changes to the public // interface (other than additive ones) are considered breaking changes. -const ClientVersion = "0.8.1" +const ClientVersion = "0.8.2" // APISpecVersion is the version of the Apify OpenAPI specification that this // client was generated and verified against. // // It corresponds to the `info.version` field of the Apify OpenAPI document. -const APISpecVersion = "v2-2026-08-05T133145Z" +const APISpecVersion = "v2-2026-08-14T072928Z"