You are here

public function TeamAppKeysController::teamAppKeys in Apigee Edge 8

Returns app credentials.

Return value

\Symfony\Component\HttpFoundation\JsonResponse The app credentials.

File

modules/apigee_edge_teams/src/Controller/TeamAppKeysController.php, line 36

Class

TeamAppKeysController
Controller for the team app credentials.

Namespace

Drupal\apigee_edge_teams\Controller

Code

public function teamAppKeys($team, $app) : JsonResponse {
  $payload = [];
  if ($team) {
    $app_storage = $this->entityTypeManager
      ->getStorage('team_app');
    $app_ids = $app_storage
      ->getQuery()
      ->condition('companyName', $team
      ->id())
      ->condition('name', $app
      ->getName())
      ->execute();
    if (!empty($app_ids)) {
      $app_id = reset($app_ids);
      $payload = $this
        ->getAppKeys($app_storage
        ->load($app_id));
    }
  }
  return new JsonResponse($payload);
}