getClient(name: $name); } catch (InvalidArgumentException $e) { return api_error($e->getMessage(), HTTP_STATUS::HTTP_NOT_FOUND); } $opts = []; $params = DataUtil::fromRequest($request, true); if (true === (bool)$params->get('tokens', false)) { $opts['tokens'] = true; } if (true === (bool)$params->get('raw', false)) { $opts[Options::RAW_RESPONSE] = true; } try { $users = $client->getUsersList($opts); } catch (Throwable $e) { return api_error($e->getMessage(), HTTP_STATUS::HTTP_INTERNAL_SERVER_ERROR); } $apiUrl = $request->getUri()->withHost('')->withPort(0)->withScheme(''); $response = [ 'users' => $users, 'links' => [ 'self' => (string)$apiUrl, 'list' => (string)$apiUrl->withPath(parseConfigValue(Index::URL)), ], ]; return api_response(HTTP_STATUS::HTTP_OK, $response); } }