feat: add broadcasts->cancel() method - #135
Conversation
Cancels a queued or scheduled broadcast via POST /broadcasts/:id/cancel, mirroring emails->cancel()'s use of the shared Payload::cancel() helper. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 4/5
- In
tests/Service/Broadcast.php, the newBroadcast::cancel()path (POST /broadcasts/{id}/cancel) introduces a fresh SDK operation that may require API-key permissions not yet validated in this test coverage, which could cause runtime 403/authorization failures for users — add an explicit permission/negative-path check (or documentation guard) for the required key scope.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/Service/Broadcast.php">
<violation number="1" location="tests/Service/Broadcast.php:65">
P2: Custom agent: **API Key Permission Check SDK Methods**
This PR introduces a new provider SDK operation, `Broadcast::cancel()` (calling `POST /broadcasts/{id}/cancel`), which is not previously used by this SDK. Since this adds a new broadcast-management permission scope, please confirm that the broadcast API keys used in production have the required permission for the `cancel` operation, so the call doesn't fail with a permission error after deployment.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| ->id->toBe('559ac32e-9ef5-46fb-82a1-b76b840c0f7b'); | ||
| }); | ||
|
|
||
| it('can cancel a broadcast resource', function () { |
There was a problem hiding this comment.
P2: Custom agent: API Key Permission Check SDK Methods
This PR introduces a new provider SDK operation, Broadcast::cancel() (calling POST /broadcasts/{id}/cancel), which is not previously used by this SDK. Since this adds a new broadcast-management permission scope, please confirm that the broadcast API keys used in production have the required permission for the cancel operation, so the call doesn't fail with a permission error after deployment.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/Service/Broadcast.php, line 65:
<comment>This PR introduces a new provider SDK operation, `Broadcast::cancel()` (calling `POST /broadcasts/{id}/cancel`), which is not previously used by this SDK. Since this adds a new broadcast-management permission scope, please confirm that the broadcast API keys used in production have the required permission for the `cancel` operation, so the call doesn't fail with a permission error after deployment.</comment>
<file context>
@@ -62,6 +62,15 @@
->id->toBe('559ac32e-9ef5-46fb-82a1-b76b840c0f7b');
});
+it('can cancel a broadcast resource', function () {
+ $client = mockClient('POST', 'broadcasts/559ac32e-9ef5-46fb-82a1-b76b840c0f7b/cancel', [], [], broadcast());
+
</file context>
|
Looks good @dielduarte. Can you please add a PHPdoc for the new method? This makes it easier for developers to understand the method and refer to the docs quickly. |
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.
Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.
Re-trigger cubic
Summary
Broadcast::cancel($id), callingPOST /broadcasts/:id/cancelvia the sharedPayload::cancel()helper (already used byEmail::cancel()).Part of the broadcast cancel rollout: resend/resend-monorepo#8126, resend/resend-openapi#85, resend/resend-node#1059, resend/resend-docs#1722, resend/resend-go#144, resend/resend-java#122.
Test plan
vendor/bin/pest— 183/183 passing, including the newcan cancel a broadcast resourcecasephp -lon touched files — clean🤖 Generated with Claude Code
Summary by cubic
Add support to cancel a queued or scheduled broadcast via
Broadcast::cancel($id)(POST /broadcasts/:id/cancel), mirroringEmail::cancel(). Bumps SDK version to 1.8.0.New Features
Broadcast::cancel($id)using the sharedPayload::cancel()helper; returns aBroadcastresource.Broadcast::cancel().Dependencies
1.8.0.Written for commit 7a93e65. Summary will update on new commits.