Skip to content

Commit b2158fa

Browse files
authored
Add function to get organization by external id (#270)
And fix typo in getOrganization docstring
1 parent e1ab9c0 commit b2158fa

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lib/Organizations.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function updateOrganization(
163163
}
164164

165165
/**
166-
* Get a Directory Group.
166+
* Get an Organization
167167
*
168168
* @param string $organization WorkOS organization ID
169169
*
@@ -180,6 +180,24 @@ public function getOrganization($organization)
180180
return Resource\Organization::constructFromResponse($response);
181181
}
182182

183+
/**
184+
* Get an Organization by its external id
185+
*
186+
* @param string $externalId external id
187+
*
188+
* @throws Exception\WorkOSException
189+
*
190+
* @return Resource\Organization
191+
*/
192+
public function getOrganizationByExternalId($externalId)
193+
{
194+
$organizationsPath = "organizations/external_id/{$externalId}";
195+
196+
$response = Client::request(Client::METHOD_GET, $organizationsPath, null, null, true);
197+
198+
return Resource\Organization::constructFromResponse($response);
199+
}
200+
183201
/**
184202
* Delete an Organization.
185203
*

0 commit comments

Comments
 (0)