Convenience factory method to return local numbers based on a given search criteria for a given client
@param client the client
@param params the params
@return the list
@throws IOException unexpected error.
191164
public static List<AvailableNumber> searchLocal(final BandwidthClient client, final Map<String, Object>params) 
    																							throws Exception {
    	
        final String tollFreeUri = BandwidthConstants.AVAILABLE_NUMBERS_LOCAL_URI_PATH;
        final JSONArray array = toJSONArray(client.get(tollFreeUri, params));

        final List<AvailableNumber> numbers = new ArrayList<AvailableNumber>();
        for (final Object obj : array) {
            numbers.add(new AvailableNumber(client, (JSONObject) obj));
        }
        return numbers;
    }
1070827
protected final List<T> findSortedByQuery(String query, String sort, Object... params) {
        return this.dataAccess.findSortedByQuery(query, sort, params);
    }
422184
public List<Integer> getIntegerList(final String param) {
    return getList(param, new StringToInteger(),
        new AlwaysValid<Integer>(), "integer");
  }
617034
public JSONObject getReasons(HashMap<String, String> params) throws JSONException {
        return oClient.get("/profiles/v1/metadata/reasons", params);
    }
26715
public final void client(Parameters parameters) {
    String host = parameters.getHost();
    String port = parameters.getPort();
    try (Socket socketClient = new Socket(host, Integer.parseInt(port));
        BufferedReader inFromUser = new BufferedReader(
            new InputStreamReader(System.in, "UTF-8"));
        BufferedWriter outToUser = new BufferedWriter(
            new OutputStreamWriter(System.out, "UTF-8"));
        BufferedWriter outToServer = new BufferedWriter(
            new OutputStreamWriter(socketClient.getOutputStream(), "UTF-8"));
        BufferedReader inFromServer = new BufferedReader(
            new InputStreamReader(socketClient.getInputStream(), "UTF-8"));) {

      // send data to server socket
      StringBuilder inText = new StringBuilder();
      String line;
      while ((line = inFromUser.readLine()) != null) {
        inText.append(line).append("\n");
      }
      inText.append("<ENDOFDOCUMENT>").append("\n");
      outToServer.write(inText.toString());
      outToServer.flush();

      // get data from server
      StringBuilder sb = new StringBuilder();
      String kafString;
      while ((kafString = inFromServer.readLine()) != null) {
        sb.append(kafString).append("\n");
      }
      outToUser.write(sb.toString());
    } catch (UnsupportedEncodingException e) {
      // this cannot happen but...
      throw new AssertionError("UTF-8 not supported");
    } catch (UnknownHostException e) {
      LOG.error("ERROR: Unknown hostname or IP address!");
      System.exit(1);
    } catch (NumberFormatException e) {
      LOG.error("Port number not correct!");
      System.exit(1);
    } catch (IOException e) {
      LOG.error("Exception", e);
    }
  }
1328230
@Override
    public ResourceSet<PhoneNumber> read(final TwilioRestClient client) {
        return new ResourceSet<>(this, client, firstPage(client));
    }
881918
public JSONObject find(HashMap<String, String> params) throws JSONException {   
        return oClient.get("/profiles/v2/search/providers", params);
    }
672886
@RequestMapping(value = "/api/profile/{profileIdentifier}/clients", method = RequestMethod.GET)
    public
    @ResponseBody
    HashMap<String, Object> getClientList(Model model,
                                          @PathVariable("profileIdentifier") String profileIdentifier) throws Exception {

        Integer profileId = ControllerUtils.convertProfileIdentifier(profileIdentifier);
        return Utils.getJQGridJSON(clientService.findAllClients(profileId), "clients");
    }
475846
public static LocalFilter fromOptionalParams(List<Param> optionalParams) {
		LocalFilter filter = new LocalFilter();
		Param p = filter.getQueryParam(optionalParams);

		if (p == null) {
			return null;
		}

		filter.value = p.getValue();
		return filter;
	}
964500
public static int getIntParam(JSONObject params, String paramName) throws ApiException {
		if (!params.containsKey(paramName)) {
			throw new ApiException(ApiException.Type.MISSING_PARAMETER, paramName);
		}

		try {
			return params.getInt(paramName);
		} catch (JSONException e) {
			throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, paramName, e);
		}
	}
934554
public ImmutableList<String> getFileAsStringList(String param) throws IOException {
    return FileUtils.loadStringList(Files.asCharSource(getExistingFile(param), Charsets.UTF_8));
  }
1232809
public static ResourceList<AvailableNumber> list(final int page, final int size) throws IOException {
    	        
        return list(BandwidthClient.getInstance(), page, size);
    }
481683
public T execute(HyperionClient client)
    {
        EntityList<T> response = client.create(build());
        List<T> entries = response.getEntries();
        return entries.size() == 0 ? null : entries.get(0);
    }
112650
private ReadOnlyDiscoveryClient getDiscoveryClient(Map<String, String> params) throws IOException {
        final UUID discoveryId = getDiscoveryId(params);

        final ReadOnlyDiscoveryClient discoveryClient = DISCO_CLIENTS.get(discoveryId);

        if (discoveryClient == null) {
            throw new IOException("No discovery client registered for id " + discoveryId);
        }
        return discoveryClient;
    }
463244
private List<ServiceInformation> getServiceInformations(URI location, final Map<String, String> params)
            throws IOException {
        final ReadOnlyDiscoveryClient discoveryClient = getDiscoveryClient(params);

        final String serviceType = params.get("serviceType");

        final List<ServiceInformation> services;

        if (serviceType != null) {
            services = discoveryClient.findAllServiceInformation(location.getHost(), serviceType);
        } else {
            services = discoveryClient.findAllServiceInformation(location.getHost());
        }
        return services;
    }
1166028
private String getClientIndex(Client client) {
        return getClientIndex(client.getOrganizationId(), client.getClientId(), client.getVersion());
    }
803386
public static ResourceList<PhoneNumber> list(final BandwidthClient client, final int page, final int size) throws IOException {
    	
        final String resourceUri = client.getUserResourceUri(BandwidthConstants.PHONE_NUMBER_URI_PATH);
        final ResourceList<PhoneNumber> phoneNumbers = 
        			new ResourceList<PhoneNumber>(page, size, resourceUri, PhoneNumber.class);

        phoneNumbers.setClient(client);
        phoneNumbers.initialize();
        
        return phoneNumbers;
    }