The Terms API usage.

@throws JsonProcessingException
@throws ApiException
18897
private void termsApiUsage() throws JsonProcessingException, ApiException {
        /**
         * 
         */
        LOG.info("The Terms API usage.");
        Terms api = retinaApisInstance.termsApi();
        /**
         * 
         */
        LOG.info("Terms API: getContextsForTerm");
        List<Context> contexts = api.getContexts("apple");
        logContext(contexts);
        contexts = api.getContexts("apple", new Pagination(0, 2), true);
        
        logContext(contexts);
        /**
         * 
         */
        List<Term> terms;
        LOG.info("Terms API: getSimilarTerms");
        
        terms = api.getSimilarTerms("tiger");
        
        logTerms(terms);
        
        terms = api.getSimilarTerms("tiger", null, PosType.NOUN);
        
        logTerms(terms);
        
        //**** ERROR *****
        terms = api.getSimilarTerms("tiger", null, PosType.NOUN, true);
        logTerms(terms);
        /**
         * 
         */
        LOG.info("Terms API: getTerm");
        terms = api.getTerm("apple");
        logTerms(terms);
        System.out.println();
        
        terms = api.getTerm("banana", new Pagination(0, 2), true);
        logTerms(terms);
        System.out.println();
        
        LOG.info("Terms API: getTerm NULL TEST");
        terms = api.getTerm(null);
        logTerms(terms);
    }
157758
boolean term(Object o) throws JSONException {
		boolean result = false;
		for (int i = 0; o != null && i < getChildrenCount(); ++i) {
			result = at(i).test(o);
			if (!result) break; // first FALSE stops this eval
		}
		return result;
	}
634329
private function appendApiKeyToRequestParameters()
	{
		if (! $this->client->getApiKey())
			throw new AuthorizationException('Missing API key.');

		$this->setParameter(
			Client::API_KEY_PARAM_NAME,
			$this->client->getApiKey()
		);
	}
180006
public void afterPropertiesSet() throws Exception {
        // Ensure that all post-processors requested are registered
        String[] actions = StringUtils.commaDelimitedListToStringArray( getPostProcessorActionsToRun() );
        for( int i = 0; i < actions.length; i++ ) {
            if( !postProcessorActionIds.contains( actions[i] ) ) {
                throw new IllegalArgumentException( "Requested post-processor action '" + actions[i]
                        + "' is not registered." );
            }
        }
    }
136783
@PostConstruct
    public void process() {
        Collection<BeanDefinition<?>> filterDefinitions = beanContext.getBeanDefinitions(Qualifiers.byStereotype(Filter.class));
        for (BeanDefinition<?> beanDefinition : filterDefinitions) {
            if (HttpClientFilter.class.isAssignableFrom(beanDefinition.getBeanType())) {
                // ignore http client filters
                continue;
            }
            String[] patterns = beanDefinition.getValue(Filter.class, String[].class).orElse(null);
            if (ArrayUtils.isNotEmpty(patterns)) {
                HttpMethod[] methods = beanDefinition.getValue(Filter.class, "methods", HttpMethod[].class).orElse(null);
                String first = patterns[0];
                FilterRoute filterRoute = addFilter(first, () -> beanContext.getBean((Class<HttpFilter>) beanDefinition.getBeanType()));
                if (patterns.length > 1) {
                    for (int i = 1; i < patterns.length; i++) {
                        String pattern = patterns[i];
                        filterRoute.pattern(pattern);
                    }
                }
                if (ArrayUtils.isNotEmpty(methods)) {
                    filterRoute.methods(methods);
                }
            }
        }
    }
315072
public ResponseWrapper addSensitiveWords(String...words) throws APIConnectionException, APIRequestException {
        JsonArray array = new JsonArray();
        for (String word: words) {
            Preconditions.checkArgument(word.length() <= 10, "one word's max length is 10");
            array.add(new JsonPrimitive(word));
        }
        return _httpClient.sendPost(_baseUrl + sensitiveWordPath, array.toString());
    }
1017449
private boolean isJsonProcessingException(Exception e) {
        // Unfortunately Jackson doesn't have specific subclasses for each parse exception, so we have to use the
        // more brittle approach of checking the exception message.
        return e instanceof JsonProcessingException &&
                !(e instanceof JsonParseException &&
                    e.getMessage() != null &&
                    e.getMessage().startsWith("Unexpected end-of-input"));
    }
1180356
private void processProperty(ApiModelProperty apiModelPropertyAnnotation, Model model) {
        if (apiModelPropertyAnnotation == null) {
            return;
        }

        String apiModelPropertyAccess = apiModelPropertyAnnotation.access();
        String apiModelPropertyName = apiModelPropertyAnnotation.name();

        // If the @ApiModelProperty is not populated with both #name and #access, skip it
        if (apiModelPropertyAccess.isEmpty() || apiModelPropertyName.isEmpty()) {
            return;
        }

        // Check to see if the value of @ApiModelProperty#access is one to exclude.
        // If so, remove it from the previously-calculated model.
        if (apiModelPropertyAccessExclusions.contains(apiModelPropertyAccess)) {
            model.getProperties().remove(apiModelPropertyName);
        }
    }
511970
public function registerCall( string $api_key, string $region, string $endpoint, string $app_header = null, string $method_header = null )
	{
		if ($app_header)
		{
			$limits = self::parseLimitHeaders($app_header);
			foreach ($limits as $interval => $used)
				$this->setAppUsed($api_key, $region, $interval, $used);
		}

		if ($method_header)
		{
			$limits = self::parseLimitHeaders($method_header);
			foreach ($limits as $interval => $used)
				$this->setMethodUsed($api_key, $region, $endpoint, $interval, $used);
		}
	}
15092
public function processSource(): void
    {
        if (null === $this->adapter) {
            throw new GridException('Grid Adapter is not initiated, please update method `init()` and try again');
        }

        try {
            $this->data = $this->getAdapter()->process(
                $this->getPage(),
                $this->getLimit(),
                $this->getFilters(),
                $this->getOrders()
            );
        } catch (\Exception $e) {
            throw new GridException('Grid Adapter can\'t process request: '. $e->getMessage());
        }
    }
1017093
private function decodeBody(): void
    {
        if (empty($this->body) || $this->body === null) {
            $this->decodedBody = [];

            return;
        }

        $this->decodedBody = json_decode($this->body, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new JsonException('The body of the response could not be decoded as JSON.');
        }

        if (!\is_array($this->decodedBody)) {
            $this->decodedBody = [];
        }
    }
213032
private void processSpecialTags(JsonParser jsonParser) throws IOException {
        LOG.info("@odata tags found - start parsing");
        String key = jsonParser.getCurrentName();
        jsonParser.nextToken();
        String value = jsonParser.getText();
        odataValues.put(key, value);
    }
1346935
public ApiResponse handleApiAction(String name, JSONObject params) throws ApiException {
		throw new ApiException(ApiException.Type.BAD_ACTION, name);
	}
451015
public void create() throws APIException {
        CreateDirectoryRequest reqObj = new CreateDirectoryRequest(this.getName(), null);
        Gson gson = new Gson();
        JsonElement inputJson = gson.toJsonTree(reqObj);

        String url = this.getParent().getUrl();
        HttpResponse response = this.client.post(url, new StringEntity(inputJson.toString(), ContentType.APPLICATION_JSON));
        HttpClientHelpers.throwIfNotOk(response);
    }
617115
public ApiResponse<TokenInfoSuccessResponse> tokenInfoWithHttpInfo() throws ApiException {
        com.squareup.okhttp.Call call = tokenInfoValidateBeforeCall(null, null);
        Type localVarReturnType = new TypeToken<TokenInfoSuccessResponse>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
1236565
protected function processApiRequest()
    {
        $inputParams = $this->getInputParamsResolver()->resolve();

        $route = $this->getInputParamsResolver()->getRoute();
        $serviceMethodName = $route->getServiceMethod();
        $serviceClassName = $route->getServiceClass();

        $service = $this->_objectManager->get($serviceClassName);
        /** @var \Magento\Framework\Api\AbstractExtensibleObject $outputData */
        $outputData = call_user_func_array([$service, $serviceMethodName], $inputParams);
        $outputData = $this->serviceOutputProcessor->process(
            $outputData,
            $serviceClassName,
            $serviceMethodName
        );
        $filters = $this->getFilters();
        if ($filters && is_array($outputData)) {
            foreach ($filters as $filterClassName) {
                $outputData = $this->applyFilter($filterClassName, $outputData);
            }
        }
        $header = $this->getDeploymentConfig()->get(ConfigOptionsListConstants::CONFIG_PATH_X_FRAME_OPT);
        if ($header) {
            $this->_response->setHeader('X-Frame-Options', $header);
        }
        $this->_response->prepareResponse($outputData);
    }
647759
public function processAnnotations(): void
    {
        $class    = $this->property->getClass();
        $imports  = $class ? array_change_key_case($class->getUseStatements()) : [];
        $filename = $class ? $class->getFilename() : 'memory';

        // Get all the namespaces in which annotations reside.
        $namespaces = [];
        foreach ($this->annotation_processors as $processor) {
            $namespaces[] = $processor->getProcessableAnnotationNamespace();
        }

        // Filter all imports that could lead to non loaded annotations,
        // this would let the DocParser explode with an Exception, while
        // the goal is to ignore other annotations besides the one explicitly
        // loaded.
        $without_foreign_annotations = array_filter(
            $imports,
            function ($import) use ($namespaces) {
                foreach ($namespaces as $namespace) {
                    if (stripos($namespace, $import) === 0) {
                        return true;
                    }
                }

                return false;
            }
        );

        $this->parser->setImports($without_foreign_annotations);
        $this->parser->setIgnoreNotImportedAnnotations(true);

        $annotations = $this->parser->parse($this->property->getDocComment(), $filename);

        // If the property is encrypted, column type MUST be string.
        $is_encrypted = false;
        $is_string    = true;
        foreach ($this->annotation_processors as $processor) {
            foreach ($annotations as $annotation) {
                $processor->processAnnotation($annotation, $this);

                if ($annotation instanceof Generate && isset($annotation->encryption_alias)) {
                    $is_encrypted = true;
                }

                if (!($annotation instanceof Column)
                    || !isset($annotation->type)
                    || \in_array($annotation->type, ['string', 'text'])
                ) {
                    continue;
                }

                $is_string = false;
            }
        }

        if ($is_encrypted && !$is_string) {
            throw new \RuntimeException(sprintf(
                'Property %s in class %s\%s has an encryption_alias set, but is not declared as column type \'string\'',
                $this->getName(),
                $this->getNamespace(),
                $this->getClass()
            ));
        }
    }