@@ -292,22 +292,28 @@ public function getEnvironmentFlags(): Flags
292292
293293 /**
294294 * Get all the flags for the current environment for a given identity. Will also
295- * upsert all traits to the Flagsmith API for future evaluations. Providing a
296- * trait with a value of None will remove the trait from the identity if it exists.
295+ * upsert all traits to the Flagsmith API for future evaluations.
296+ *
297+ * Providing a trait with a value of None will remove the trait from the identity if it exists.
298+ *
299+ * To send a transient trait, use an object as value:
300+ *
301+ * `$flagsmith->getIdentityFlags($identifier, (object)['transient' => ['value' => 'no-persist', 'transient' => true]])->allFlags();`
302+ *
297303 * @param string $identifier
298304 * @param object|null $traits
299305 * @return Flags
300306 *
301307 * @throws FlagsmithThrowable
302308 */
303- public function getIdentityFlags (string $ identifier , ?object $ traits = null ): Flags
309+ public function getIdentityFlags (string $ identifier , ?object $ traits = null , ? bool $ transient = false ): Flags
304310 {
305- $ traits = $ traits ?? (object ) [];
311+ $ traits = $ traits ?? (object )[];
306312 if ($ this ->environment ) {
307313 return $ this ->getIdentityFlagsFromDocument ($ identifier , $ traits );
308314 }
309315
310- return $ this ->getIdentityFlagsFromApi ($ identifier , $ traits );
316+ return $ this ->getIdentityFlagsFromApi ($ identifier , $ traits, $ transient );
311317 }
312318
313319 /**
@@ -426,11 +432,11 @@ private function getEnvironmentFlagsFromApi(): Flags
426432 *
427433 * @throws FlagsmithAPIError
428434 */
429- private function getIdentityFlagsFromApi (string $ identifier , ?object $ traits ): Flags
435+ private function getIdentityFlagsFromApi (string $ identifier , ?object $ traits, ? bool $ transient ): Flags
430436 {
431437 try {
432- $ data = IdentitiesGenerator::generateIdentitiesData ($ identifier , $ traits );
433- $ cacheKey = IdentitiesGenerator::generateIdentitiesCacheKey ($ identifier , $ traits );
438+ $ data = IdentitiesGenerator::generateIdentitiesData ($ identifier , $ traits, $ transient );
439+ $ cacheKey = IdentitiesGenerator::generateIdentitiesCacheKey ($ identifier , $ traits, $ transient );
434440 $ apiFlags = $ this ->cachedCall (
435441 $ cacheKey ,
436442 'POST ' ,
0 commit comments