Skip to content

Conversation

@StanBarrows
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings November 14, 2025 07:19
Copilot finished reviewing on behalf of StanBarrows November 14, 2025 07:22
@StanBarrows StanBarrows merged commit 26f2f22 into main Nov 14, 2025
11 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for HTML-formatted content in post creation by introducing an html parameter alongside the existing text parameter. Both fields are now optional, allowing posts to be created with either plain text, HTML, or both.

  • Adds optional html parameter to CreateAPostInAGivenStream request
  • Makes text parameter optional (previously required)
  • Updates documentation to reflect the new html field in the response

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/Requests/CreateAPostInAGivenStream.php Adds optional html parameter, makes text optional, and includes html in request body
src/Requests/CreateAChildToAnArtifact.php Adds blank line in defaultBody() method (appears unintentional)
README.md Documents the new html parameter in both request examples and response structure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

protected readonly string $streamId,
protected readonly string $text,
protected readonly ?string $text = null,
protected readonly ?string $html = null,
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The html parameter is added to the request constructor and body, but the Post data class (at src/Data/Streams/Post.php) does not have an html property. This means that when the API response includes an html field, it will be silently ignored and not accessible on the returned Post object.

You need to add the html property to the Post class constructor and the make() method:

public function __construct(
    public int $id,
    public ?string $text,
    public ?string $html,  // Add this
    // ... rest of properties
)

And in the make() method:

return new self(
    id: Arr::get($data, 'id'),
    text: Arr::get($data, 'text'),
    html: Arr::get($data, 'html'),  // Add this
    // ... rest of properties
)

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +24
protected readonly ?string $text = null,
protected readonly ?string $html = null,
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both text and html parameters are now optional (nullable with default null), but there's no validation to ensure that at least one of them is provided. Creating a post with neither text nor html would likely result in an API error.

Consider adding validation in the constructor to ensure at least one content field is provided:

public function __construct(
    protected readonly string $streamId,
    protected readonly ?string $text = null,
    protected readonly ?string $html = null,
    // ... rest of parameters
) {
    if (empty($this->text) && empty($this->html)) {
        throw new \InvalidArgumentException('Either text or html must be provided');
    }
}

Copilot uses AI. Check for mistakes.

public function defaultBody(): array
{

Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This extra blank line appears to be unintentional and doesn't add value to the code. Consider removing it to maintain consistency with the codebase style.

Suggested change

Copilot uses AI. Check for mistakes.
+id: 2234 // int
+text: "Please indicate your preferred dates for next team event in the poll below. Thanks!" // string
+text: "Please indicate your preferred dates for next team event in the poll below. Thanks!" // string|null
+html: "<p>Please <b>indicate</b> your preferred dates below.</p><p>Thanks!</p>" // string|null
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation shows that the Post response object has an html property, but the actual Post data class at src/Data/Streams/Post.php does not include this field. This documentation is misleading as the html field will not actually be available on the returned Post object until the data class is updated.

This documentation should either be removed or the Post data class should be updated to include the html property.

Suggested change
+html: "<p>Please <b>indicate</b> your preferred dates below.</p><p>Thanks!</p>" // string|null

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants