Skip to content

Support for Members and Membership type, status and include objects#114

Merged
seba-aln merged 9 commits intomasterfrom
feat/membership-type-and-status
Feb 5, 2025
Merged

Support for Members and Membership type, status and include objects#114
seba-aln merged 9 commits intomasterfrom
feat/membership-type-and-status

Conversation

@seba-aln
Copy link

@seba-aln seba-aln commented Feb 3, 2025

feat: Support for Members and Membership type, status and include objects

Extended functionality of Channel Members and User Membership. Now it's possible to use fine-grade includes and set member/membership status and type.

* @param string $ch
* @return $this
*/
public function channel($ch)
Copy link
Contributor

Choose a reason for hiding this comment

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

What about:
public function channel(string $ch): self
?

Copy link
Author

@seba-aln seba-aln Feb 3, 2025

Choose a reason for hiding this comment

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

fixed for uniformity

Copy link
Contributor

Choose a reason for hiding this comment

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

I would check all files in this PR for this unification.

Copy link
Author

Choose a reason for hiding this comment

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

hopefully I didn't miss anything

protected bool $endpointAuthRequired = true;
protected string $endpointHttpMethod = PNHttpMethod::PATCH;
protected int $endpointOperationType = PNOperationType::PNRemoveMembersOperation;
protected string $endpointName = "ManageMembers";
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this correct?

Copy link
Author

Choose a reason for hiding this comment

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

yep. it's to lower the amount of copypaste between files. Down at the bottom you see that I removed a lot of boilerplate methods and in the meantime in Endpoint class I expose the values through proper methods

Copy link
Contributor

Choose a reason for hiding this comment

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

ok


/**
* @param string $ch
* @return $this
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't be:
public function channel(string $ch): self
?

Copy link
Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

I would check all files in this PR for this unification.

Copy link
Author

Choose a reason for hiding this comment

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

ok

*
* @return $this
*/
public function uuids($uuids)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't be:
public function uuids(array $uuids): self
?

Copy link
Author

Choose a reason for hiding this comment

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

it's a bit more complex than just say it's an array (phpStan watches for doc block describing what type of input it should be and since it is deprecated I omited it

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

* @param PNChannelMember[] $members
* @return $this
*/
public function members(array $members)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't be:
public function members(array $members): self
?

Copy link
Author

Choose a reason for hiding this comment

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

fixed

$this->status = $status;
}

public function setchannel(string $channel): self
Copy link
Contributor

Choose a reason for hiding this comment

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

setChannel ?

Copy link
Author

Choose a reason for hiding this comment

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

good catch

return $this->custom;
}

public function getType(): string
Copy link
Contributor

Choose a reason for hiding this comment

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

What about:
public function getType(): ?string
public function getStatus(): ?string

Copy link
Author

Choose a reason for hiding this comment

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

fixed

}

/**
* @return string[] | \StdClass
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't be:

Copy link
Author

Choose a reason for hiding this comment

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

well not exactly because mixed says it can be a primitive type yet here we may have an array or an StdClass object so it's a bit more precise

/**
* @return string[]
*/
public function toArray()
Copy link
Contributor

Choose a reason for hiding this comment

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

What about:
public function toArray(): array
?

*/
function __construct($id, $name, $description, $custom = null, $updated = null, $eTag = null)
{
public function __construct(
Copy link
Contributor

Choose a reason for hiding this comment

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

What about:
public function __construct(
string $id,
string $name,
string $description,
mixed $custom = null,
?string $updated = null,
?string $eTag = null,
?string $status = null,
?string $type = null
)
?

Copy link
Author

Choose a reason for hiding this comment

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

no. this object is made from a response so it would require more attention to do a proper strict typing, so I would leave the docblock type hints only

@seba-aln seba-aln force-pushed the feat/membership-type-and-status branch from 6725275 to d4fc4a1 Compare February 4, 2025 13:28
@seba-aln
Copy link
Author

seba-aln commented Feb 5, 2025

@pubnub-release-bot release

@seba-aln seba-aln merged commit c476491 into master Feb 5, 2025
8 checks passed
@seba-aln seba-aln deleted the feat/membership-type-and-status branch February 5, 2025 12:45
@pubnub-release-bot
Copy link
Contributor

🚀 Release successfully completed 🚀

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.

4 participants