Formats a suggestion response
@param suggestions List of suggestions for the given type
@return A ChannelBuffer object to pass on to the caller
@throws BadRequestException if the plugin has not implemented this method
332141
public ChannelBuffer formatSuggestV1(final List<String> suggestions) {
    throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, 
        "The requested API endpoint has not been implemented", 
        this.getClass().getCanonicalName() + 
        " has not implemented formatSuggestV1");
  }
90406
@Override
  public <T extends IncomingDataPoint> List<T> parsePutV1(
      final Class<T> type, final TypeReference<ArrayList<T>> typeReference) {
    if (!query.hasContent()) {
      throw new BadRequestException("Missing request content");
    }

    // convert to a string so we can handle character encoding properly
    final String content = query.getContent().trim();
    final int firstbyte = content.charAt(0);
    try {
      if (firstbyte == '{') {
        final T dp =
          JSON.parseToObject(content, type);
        final ArrayList<T> dps =
          new ArrayList<T>(1);
        dps.add(dp);
        return dps;
      } else if (firstbyte == '[') {
        return JSON.parseToObject(content, typeReference);
      } else {
        throw new BadRequestException("The JSON must start as an object or an array");
      }
    } catch (IllegalArgumentException iae) {
      throw new BadRequestException("Unable to parse the given JSON", iae);
    }
  }
25972
public Channel joinPeer(Orderer orderer, Peer peer, PeerOptions peerOptions) throws ProposalException {

        logger.debug(format("Channel %s joining peer %s, url: %s", name, peer.getName(), peer.getUrl()));

        if (shutdown) {
            throw new ProposalException(format("Channel %s has been shutdown.", name));
        }

        Channel peerChannel = peer.getChannel();
        if (null != peerChannel && peerChannel != this) {
            throw new ProposalException(format("Can not add peer %s to channel %s because it already belongs to channel %s.", peer.getName(), name, peerChannel.getName()));

        }

        logger.info(format("%s joining %s.", toString(), peer));

        if (genesisBlock == null && orderers.isEmpty()) {
            ProposalException e = new ProposalException("Channel missing genesis block and no orderers configured");
            logger.error(e.getMessage(), e);
        }
        try {

            genesisBlock = getGenesisBlock(orderer);
            logger.debug(format("Channel %s got genesis block", name));

            final Channel systemChannel = newSystemChannel(client); //channel is not really created and this is targeted to system channel

            TransactionContext transactionContext = systemChannel.getTransactionContext();

            FabricProposal.Proposal joinProposal = JoinPeerProposalBuilder.newBuilder()
                    .context(transactionContext)
                    .genesisBlock(genesisBlock)
                    .build();

            logger.debug("Getting signed proposal.");
            SignedProposal signedProposal = getSignedProposal(transactionContext, joinProposal);
            logger.debug("Got signed proposal.");

            addPeer(peer, peerOptions); //need to add peer.

            Collection<ProposalResponse> resp = sendProposalToPeers(new ArrayList<>(Collections.singletonList(peer)),
                    signedProposal, transactionContext);

            ProposalResponse pro = resp.iterator().next();

            if (pro.getStatus() == ProposalResponse.Status.SUCCESS) {
                logger.info(format("Peer %s joined into channel %s", peer, toString()));
            } else {
                removePeerInternal(peer);
                throw new ProposalException(format("Join peer to channel %s failed.  Status %s, details: %s",
                        name, pro.getStatus().toString(), pro.getMessage()));

            }
        } catch (ProposalException e) {
            logger.error(format("%s removing peer %s due to exception %s", toString(), peer, e.getMessage()));
            removePeerInternal(peer);
            logger.error(e);
            throw e;
        } catch (Exception e) {
            logger.error(format("%s removing peer %s due to exception %s", toString(), peer, e.getMessage()));
            peers.remove(peer);
            logger.error(e);
            throw new ProposalException(e.getMessage(), e);
        }

        return this;
    }
379958
async function requestInput(message, suggestions = []) {
  const answerName = 'requestInput';
  const answers = await inquirer.prompt([
    {
      message,
      suggestions,
      name: answerName,
      type: suggestions.length ? 'suggest' : 'input',
    },
  ]);
  return answers[answerName];
}
595066
function (suggestions) {
        var that = this,
            shouldRestrict = that.shouldRestrictValues(),
            label = that.getFirstConstraintLabel();

        $.each(suggestions, function (i, suggestion) {
            if (!suggestion.unrestricted_value) {
                suggestion.unrestricted_value = shouldRestrict ? label + ', ' + suggestion.value : suggestion.value;
            }
        });
    }
471588
function (suggestion, selectionOptions) {
        var that = this,
            formatSelected = that.options.formatSelected || that.type.formatSelected,
            hasSameValues = selectionOptions && selectionOptions.hasSameValues,
            hasBeenEnriched = selectionOptions && selectionOptions.hasBeenEnriched,
            formattedValue,
            typeFormattedValue = null;


        if ($.isFunction(formatSelected)) {
            formattedValue = formatSelected.call(that, suggestion);
        }

        if (typeof formattedValue !== 'string') {
            formattedValue = suggestion.value;

            if (that.type.getSuggestionValue) {
                typeFormattedValue = that.type.getSuggestionValue(that, {
                    suggestion: suggestion,
                    hasSameValues: hasSameValues,
                    hasBeenEnriched: hasBeenEnriched,
                });

                if (typeFormattedValue !== null) {
                    formattedValue = typeFormattedValue;
                }
            }
        }

        return formattedValue;
    }
178629
public HttpJsonRequest createConversationTokenRequest(ConversationTokenRequest conversationTokenRequest, HttpRequest.Listener<HttpJsonRequest> listener) {
		HttpJsonRequest request = createJsonRequest(ENDPOINT_CONVERSATION, conversationTokenRequest, HttpRequestMethod.POST);
		request.addListener(listener);
		return request;
	}
1305883
static SocketChannelUDT newConnectorChannelUDT(final TypeUDT type) {
        try {
            return SelectorProviderUDT.from(type).openSocketChannel();
        } catch (final IOException e) {
            throw new ChannelException("failed to open a socket channel", e);
        }
    }
469284
@Override
    public void getUserSuggestions(final String categorySlug) {
        getDispatcher().invokeLater(new AsyncTask(USER_SUGGESTIONS, listeners) {
            @Override
            public void invoke(List<TwitterListener> listeners) throws TwitterException {
                ResponseList<User> users = twitter.getUserSuggestions(categorySlug);
                for (TwitterListener listener : listeners) {
                    try {
                        listener.gotUserSuggestions(users);
                    } catch (Exception e) {
                        logger.warn("Exception at getUserSuggestions", e);
                    }
                }
            }
        });
    }
941929
public function getSuggestions(
        UtilityServiceContract $utilityService,
        Request $request
    ): SuggestionsResponseContract {
        $search = $request->get('q', '');
        $type = $request->get('type', '');

        $items = $utilityService->getSuggestions($search);

        return $this->app->make(SuggestionsResponseContract::class, compact('items', 'type'));
    }
355509
private void badRequest(HttpServletResponse res) throws IOException {
		res.setContentType("text/html");
		PrintWriter pw = res.getWriter();
		pw.write(BAD_REQUEST);
		pw.close();
	}
970672
@Override
    public void addClientBehaviorRenderer(String type, ClientBehaviorRenderer renderer)
    {
        if (type == null)
        {
            throw new NullPointerException("client behavior renderer type must not be null");
        }
        if ( renderer == null)
        {
            throw new NullPointerException("client behavior renderer must not be null");
        }
        
        _clientBehaviorRenderers.put(type, renderer);
    }
563943
public ChannelBuffer formatTSMetaListV1(final List<TSMeta> metas) {
    throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, 
        "The requested API endpoint has not been implemented", 
        this.getClass().getCanonicalName() + 
        " has not implemented formatTSMetaV1");
  }
1242950
function (suggestions) {
                var selectedSuggestions = this.selectedSuggestions;
                var filteredSuggestions = [];
                for (var i = 0; i < suggestions.length; i++) {
                    var curSuggestion = suggestions[i];
                    if (this._findSuggestion(selectedSuggestions, curSuggestion) == -1) {
                        filteredSuggestions.push(curSuggestion);
                    }
                }
                return filteredSuggestions;
            }
910287
@Override
    public SuggestAccountsRequest suggestAccounts() throws RestApiException {
        return new SuggestAccountsRequest() {
            @Override
            public List<AccountInfo> get() throws RestApiException {
                return AccountsRestClient.this.suggestAccounts(this);
            }
        };
    }
927822
public static StringBuffer appendComment(StringBuffer buffer, String comment)
	{
		StringBuffer _buffer = initStringBufferIfNecessary(buffer);
		return doAppendComment(_buffer, comment);
	}
1348197
function suggest (opts) {
  return new Promise(function (resolve) {
    if (!opts && !opts.term) {
      throw Error('term missing');
    }

    return resolve(BASE_URL + encodeURIComponent(opts.term));
  })
    .then(url => common.request(url, {}, opts.requestOptions))
    .then(parseXML)
    .then(extractSuggestions);
}