From e937f500f5f4b88f9ef04ebbd3e7f0ec62f3232f Mon Sep 17 00:00:00 2001 From: Kayne Middleton Date: Thu, 23 Jan 2025 11:41:00 -0800 Subject: [PATCH 1/3] Update Members.php --- src/Endpoint/Member/Members.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Endpoint/Member/Members.php b/src/Endpoint/Member/Members.php index 7e3a170..84cb4d2 100644 --- a/src/Endpoint/Member/Members.php +++ b/src/Endpoint/Member/Members.php @@ -146,4 +146,28 @@ public function remove(string $email, ?int $communityId = null): mixed ) ); } + + /** + * Invite Member to Community + */ + public function invite(string $email, ?int $communityId = null): mixed { + $this->ensureCommunityIdIsPresent($communityId); + + $endpoint = "/community_members/"; + + $data = [ + 'email' => $email, + ]; + + if ($communityId) { + $data['community_id'] = $communityId; + } + + return $this->factorResponse( + $this->circleSo->getHttpClient()->post( + uri: $endpoint, + body: json_encode($data), + ) + ); + } } From af1ef1b85e4aae9d3da3622043756c68cf695ec0 Mon Sep 17 00:00:00 2001 From: Kayne Middleton Date: Thu, 23 Jan 2025 11:46:49 -0800 Subject: [PATCH 2/3] Update Members.php --- src/Endpoint/Member/Members.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Endpoint/Member/Members.php b/src/Endpoint/Member/Members.php index 84cb4d2..43098bd 100644 --- a/src/Endpoint/Member/Members.php +++ b/src/Endpoint/Member/Members.php @@ -159,7 +159,7 @@ public function invite(string $email, ?int $communityId = null): mixed { 'email' => $email, ]; - if ($communityId) { + if (!empty($communityId)) { $data['community_id'] = $communityId; } From a2118bd53e1201b8fc5f8a31faf7f6a9f2266575 Mon Sep 17 00:00:00 2001 From: Kayne Middleton Date: Thu, 23 Jan 2025 11:49:13 -0800 Subject: [PATCH 3/3] Update Members.php --- src/Endpoint/Member/Members.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Endpoint/Member/Members.php b/src/Endpoint/Member/Members.php index 43098bd..6d7dd8d 100644 --- a/src/Endpoint/Member/Members.php +++ b/src/Endpoint/Member/Members.php @@ -151,8 +151,7 @@ public function remove(string $email, ?int $communityId = null): mixed * Invite Member to Community */ public function invite(string $email, ?int $communityId = null): mixed { - $this->ensureCommunityIdIsPresent($communityId); - + $endpoint = "/community_members/"; $data = [ @@ -160,6 +159,7 @@ public function invite(string $email, ?int $communityId = null): mixed { ]; if (!empty($communityId)) { + $this->ensureCommunityIdIsPresent($communityId); $data['community_id'] = $communityId; }