diff --git a/package-lock.json b/package-lock.json index d2c22ce..517709b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "devDependencies": { "@prettier/plugin-php": "^0.22.1", "@seamapi/nextlove-sdk-generator": "1.18.0", - "@seamapi/types": "1.380.1", + "@seamapi/types": "1.384.0", "del": "^7.1.0", "prettier": "^3.0.0" } @@ -455,9 +455,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.380.1", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.380.1.tgz", - "integrity": "sha512-Z8gYDeVIOJ4StYukgiHJD8QGYfydtha6qLeMCmh5W/3QO6VvgdjzonlgqIcGd5Fm1XlAA9f9ixTgCJE30lyvVQ==", + "version": "1.384.0", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.384.0.tgz", + "integrity": "sha512-pFQF4O7LaLu9J2yfNxtiuN/kCYX5WH0Sdccx6BC1rYQqwQSD1m5/yXTq14iCBa6z2R8Fw09WRU5Zp+NjHtleQQ==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index d8d1f79..267f83b 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "devDependencies": { "@prettier/plugin-php": "^0.22.1", "@seamapi/nextlove-sdk-generator": "1.18.0", - "@seamapi/types": "1.380.1", + "@seamapi/types": "1.384.0", "del": "^7.1.0", "prettier": "^3.0.0" } diff --git a/src/Objects/InstantKey.php b/src/Objects/InstantKey.php new file mode 100644 index 0000000..667871e --- /dev/null +++ b/src/Objects/InstantKey.php @@ -0,0 +1,33 @@ +client_session_id, + created_at: $json->created_at, + expires_at: $json->expires_at, + instant_key_id: $json->instant_key_id, + instant_key_url: $json->instant_key_url, + user_identity_id: $json->user_identity_id, + workspace_id: $json->workspace_id + ); + } + + public function __construct( + public string $client_session_id, + public string $created_at, + public string $expires_at, + public string $instant_key_id, + public string $instant_key_url, + public string $user_identity_id, + public string $workspace_id + ) { + } +} diff --git a/src/SeamClient.php b/src/SeamClient.php index 61c1886..de8a7e4 100644 --- a/src/SeamClient.php +++ b/src/SeamClient.php @@ -19,6 +19,7 @@ use Seam\Objects\DeviceProvider; use Seam\Objects\EnrollmentAutomation; use Seam\Objects\Event; +use Seam\Objects\InstantKey; use Seam\Objects\Network; use Seam\Objects\NoiseThreshold; use Seam\Objects\Pagination; @@ -4415,6 +4416,23 @@ public function delete(string $user_identity_id): void ); } + public function generate_instant_key(string $user_identity_id): InstantKey + { + $request_payload = []; + + if ($user_identity_id !== null) { + $request_payload["user_identity_id"] = $user_identity_id; + } + + $res = $this->seam->request( + "POST", + "/user_identities/generate_instant_key", + json: (object) $request_payload + ); + + return InstantKey::from_json($res->instant_key); + } + public function get( ?string $user_identity_id = null, ?string $user_identity_key = null