Package com.cosmicpush.app.domain.clients

Examples of com.cosmicpush.app.domain.clients.ApiClient


  public List<ApiClient> getApiClients() {
    return apiClients;
  }
  public ApiClient add(CreateClientAction action) {
    action.validate(new RequestErrors()).assertNoErrors();
    ApiClient apiClient = new ApiClient().create(action);
    apiClients.add(apiClient);
    return apiClient;
  }
View Full Code Here


      throw ApiException.badRequest(String.format("The client name %s already exists.", clientName));
    }

    CreateClientAction action = new CreateClientAction(clientName, clientPassword);

    ApiClient apiClient = account.add(action);
    config.getAccountStore().update(account);

    return Response.seeOther(new URI("manage/api-client/"+apiClient.getClientName())).build();
  }
View Full Code Here

    String accountId = config.getApiClientUser().getAccountId();
    Account account = config.getAccountStore().getByAccountId(accountId);

    String clientName = config.getApiClientUser().getClientName();
    ApiClient apiClient = account.getApiClientByName(clientName);

    return new ApiResource(config, account, apiClient);
  }
View Full Code Here

      Account account = getRequestConfig().getAccountStore().getByClientId(request.getApiClientId());
      if (account == null) {
        throw ApiException.notFound("Account not found given client id " + request.getApiClientId());
      }

      ApiClient apiClient = account.getApiClientById(request.getApiClientId());
      if (apiClient == null) {
        throw ApiException.notFound("API client not found for " + request.getApiClientId());
      }

      if (request.getPushType().isNotification()) {
        String path = String.format("manage/api-client/%s/notifications/%s", apiClient.getClientName(), id);
        return Response.seeOther(new URI(path)).build();

      } else if (request.getPushType().isUserEvent()) {
        String deviceId = request.getUserEventPush().getDeviceId();
        String path = String.format("manage/api-client/%s/user-events/%s", apiClient.getClientName(), deviceId);
        return Response.seeOther(new URI(path)).build();
      }

    }
View Full Code Here

TOP

Related Classes of com.cosmicpush.app.domain.clients.ApiClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.