removed old samples

This commit is contained in:
Tony Tam 2015-02-06 05:48:27 -08:00
parent 3885991439
commit 1e717addf4
284 changed files with 0 additions and 24982 deletions

View File

@ -1,51 +0,0 @@
/**
* Copyright 2014 Wordnik, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.wordnik.swagger.codegen.BasicAndroidJavaGenerator
object AndroidWordnikApiCodegen extends BasicAndroidJavaGenerator {
def main(args: Array[String]) = generateClient(args)
// location of templates
override def templateDir = "src/main/resources/android-java"
def destinationRoot = "samples/client/wordnik-api/android"
// where to write generated code
override def destinationDir = destinationRoot + "/src/main/java"
// package for api invoker, error files
override def invokerPackage = Some("com.wordnik.client.common")
// package for models
override def modelPackage = Some("com.wordnik.client.model")
// package for api classes
override def apiPackage = Some("com.wordnik.client.api")
additionalParams ++= Map(
"artifactId" -> "wordnik-android-client",
"artifactVersion" -> "1.0.0",
"groupId" -> "com.wordnik")
// supporting classes
override def supportingFiles =
List(
("apiInvoker.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "ApiInvoker.java"),
("JsonUtil.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "JsonUtil.java"),
("apiException.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "ApiException.java"),
("pom.mustache", destinationRoot, "pom.xml"))
}

View File

@ -1,79 +0,0 @@
# Wordnik Android client library
## Overview
This is a full client library for the Wordnik API. It requires that you have a valid Wordnik API Key--you
can get one for free at http://developer.wordnik.com.
This library is built using the Wordnik [Swagger](http://swagger.wordnik.com) client library generator. You
can re-generate this library by running ./bin/android-java-wordnik-api.sh from the swagger-codegen project
## Usage
You can use maven central to add this library to your current project:
```xml
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>wordnik-android-client</artifactId>
<version>4.0</version>
</dependency>
```
or with gradle:
```gradle
repositories {
mavenCentral()
}
dependencies {
compile 'com.wordnik:wordnik-android-client:4.0'
}
```
or you can pull the source and re-generate the client library with Maven:
```
mvn package
```
Add the library to your project and you're ready to go:
```java
import com.wordnik.client.api.*;
import com.wordnik.client.model.*;
import android.os.AsyncTask;
import android.util.Log;
class WordOfTheDayAsyncTask extends AsyncTask<Void, Void, WordOfTheDay> {
@Override
protected WordOfTheDay doInBackground(Void... params) {
WordsApi api = new WordsApi();
api.addHeader("api_key", "YOUR_API_KEY");
try {
return api.getWordOfTheDay("2014-02-19");
}
catch (Exception e) {
Log.d("WordOfTheDayAsyncTask", e.getMessage());
return null;
}
}
@Override
protected void onPostExecute(WordOfTheDay d) {
Log.d("WordOfTheDayAsyncTask", d.toString());
}
}
```
You can now invoke the async task anywhere in your app. Of course you'll want to do
something more in your `onPostExecute` function.
```java
new WordOfTheDayAsyncTask().execute();
```
This project was built with the following minimum requirements:
* Maven 3.0
* Java JDK 6

View File

@ -1,214 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.wordnik</groupId>
<artifactId>wordnik-android-client</artifactId>
<packaging>jar</packaging>
<name>wordnik-android-client</name>
<version>4.0</version>
<scm>
<connection>scm:git:git@github.com:wordnik/swagger-mustache.git</connection>
<developerConnection>scm:git:git@github.com:wordnik/swagger-codegen.git</developerConnection>
<url>https://github.com/wordnik/swagger-codegen</url>
</scm>
<prerequisites>
<maven>2.2.0</maven>
</prerequisites>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<systemProperties>
<property>
<name>loggerPath</name>
<value>conf/log4j.properties</value>
</property>
</systemProperties>
<argLine>-Xms512m -Xmx1500m</argLine>
<parallel>methods</parallel>
<forkMode>pertest</forkMode>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- attach test jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add_sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add_test_sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin-version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<configuration>
<recompileMode>incremental</recompileMode>
</configuration>
<jvmArgs>
<jvmArg>-Xmx384m</jvmArg>
</jvmArgs>
<args>
<arg>-target:jvm-1.5</arg>
<arg>-deprecation</arg>
</args>
<launchers>
<launcher>
<id>run-scalatest</id>
<mainClass>org.scalatest.tools.Runner</mainClass>
<args>
<arg>-p</arg>
<arg>${project.build.testOutputDirectory}</arg>
</args>
<jvmArgs>
<jvmArg>-Xmx512m</jvmArg>
</jvmArgs>
</launcher>
</launchers>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin-version}</version>
</plugin>
</plugins>
</reporting>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient-version}</version>
<scope>compile</scope>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.9.1</artifactId>
<version>${scala-test-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<jackson-version>2.1.4</jackson-version>
<scala-version>2.9.1-1</scala-version>
<junit-version>4.8.1</junit-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.8.1</junit-version>
<scala-test-version>1.6.1</scala-test-version>
<httpclient-version>4.0</httpclient-version>
<scala-maven-plugin-version>3.1.5</scala-maven-plugin-version>
</properties>
</project>

View File

@ -1,192 +0,0 @@
package com.wordnik.client.api;
import com.wordnik.client.common.ApiException;
import com.wordnik.client.common.ApiInvoker;
import com.wordnik.client.model.User;
import com.wordnik.client.model.WordList;
import com.wordnik.client.model.ApiTokenStatus;
import com.wordnik.client.model.AuthenticationToken;
import java.util.*;
public class AccountApi {
String basePath = "http://api.wordnik.com/v4";
ApiInvoker apiInvoker = ApiInvoker.getInstance();
public void addHeader(String key, String value) {
getInvoker().addDefaultHeader(key, value);
}
public ApiInvoker getInvoker() {
return apiInvoker;
}
public void setBasePath(String basePath) {
this.basePath = basePath;
}
public String getBasePath() {
return basePath;
}
public AuthenticationToken authenticate (String username, String password) throws ApiException {
// verify required params are set
if(username == null || password == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/account.{format}/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(password)))
queryParams.put("password", String.valueOf(password));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (AuthenticationToken) ApiInvoker.deserialize(response, "", AuthenticationToken.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public AuthenticationToken authenticatePost (String username, String body) throws ApiException {
// verify required params are set
if(username == null || body == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/account.{format}/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
if(response != null){
return (AuthenticationToken) ApiInvoker.deserialize(response, "", AuthenticationToken.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<WordList> getWordListsForLoggedInUser (String auth_token, Integer skip, Integer limit) throws ApiException {
// verify required params are set
if(auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/account.{format}/wordLists".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(skip)))
queryParams.put("skip", String.valueOf(skip));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<WordList>) ApiInvoker.deserialize(response, "List", WordList.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public ApiTokenStatus getApiTokenStatus (String api_key) throws ApiException {
// create path and map variables
String path = "/account.{format}/apiTokenStatus".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
headerParams.put("api_key", api_key);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (ApiTokenStatus) ApiInvoker.deserialize(response, "", ApiTokenStatus.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public User getLoggedInUser (String auth_token) throws ApiException {
// verify required params are set
if(auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/account.{format}/user".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (User) ApiInvoker.deserialize(response, "", User.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
}

View File

@ -1,475 +0,0 @@
package com.wordnik.client.api;
import com.wordnik.client.common.ApiException;
import com.wordnik.client.common.ApiInvoker;
import com.wordnik.client.model.FrequencySummary;
import com.wordnik.client.model.Bigram;
import com.wordnik.client.model.WordObject;
import com.wordnik.client.model.ExampleSearchResults;
import com.wordnik.client.model.Example;
import com.wordnik.client.model.ScrabbleScoreResult;
import com.wordnik.client.model.TextPron;
import com.wordnik.client.model.Syllable;
import com.wordnik.client.model.Related;
import com.wordnik.client.model.Definition;
import com.wordnik.client.model.AudioFile;
import java.util.*;
public class WordApi {
String basePath = "http://api.wordnik.com/v4";
ApiInvoker apiInvoker = ApiInvoker.getInstance();
public void addHeader(String key, String value) {
getInvoker().addDefaultHeader(key, value);
}
public ApiInvoker getInvoker() {
return apiInvoker;
}
public void setBasePath(String basePath) {
this.basePath = basePath;
}
public String getBasePath() {
return basePath;
}
public ExampleSearchResults getExamples (String word, String includeDuplicates, String useCanonical, Integer skip, Integer limit) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/examples".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(includeDuplicates)))
queryParams.put("includeDuplicates", String.valueOf(includeDuplicates));
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(skip)))
queryParams.put("skip", String.valueOf(skip));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (ExampleSearchResults) ApiInvoker.deserialize(response, "", ExampleSearchResults.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public WordObject getWord (String word, String useCanonical, String includeSuggestions) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(includeSuggestions)))
queryParams.put("includeSuggestions", String.valueOf(includeSuggestions));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (WordObject) ApiInvoker.deserialize(response, "", WordObject.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<Definition> getDefinitions (String word, String partOfSpeech, String sourceDictionaries, Integer limit, String includeRelated, String useCanonical, String includeTags) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/definitions".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
if(!"null".equals(String.valueOf(partOfSpeech)))
queryParams.put("partOfSpeech", String.valueOf(partOfSpeech));
if(!"null".equals(String.valueOf(includeRelated)))
queryParams.put("includeRelated", String.valueOf(includeRelated));
if(!"null".equals(String.valueOf(sourceDictionaries)))
queryParams.put("sourceDictionaries", String.valueOf(sourceDictionaries));
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(includeTags)))
queryParams.put("includeTags", String.valueOf(includeTags));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<Definition>) ApiInvoker.deserialize(response, "List", Definition.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public Example getTopExample (String word, String useCanonical) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/topExample".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (Example) ApiInvoker.deserialize(response, "", Example.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<Related> getRelatedWords (String word, String relationshipTypes, String useCanonical, Integer limitPerRelationshipType) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/relatedWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(relationshipTypes)))
queryParams.put("relationshipTypes", String.valueOf(relationshipTypes));
if(!"null".equals(String.valueOf(limitPerRelationshipType)))
queryParams.put("limitPerRelationshipType", String.valueOf(limitPerRelationshipType));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<Related>) ApiInvoker.deserialize(response, "List", Related.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<TextPron> getTextPronunciations (String word, String sourceDictionary, String typeFormat, String useCanonical, Integer limit) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/pronunciations".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(sourceDictionary)))
queryParams.put("sourceDictionary", String.valueOf(sourceDictionary));
if(!"null".equals(String.valueOf(typeFormat)))
queryParams.put("typeFormat", String.valueOf(typeFormat));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<TextPron>) ApiInvoker.deserialize(response, "List", TextPron.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<Syllable> getHyphenation (String word, String sourceDictionary, String useCanonical, Integer limit) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/hyphenation".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(sourceDictionary)))
queryParams.put("sourceDictionary", String.valueOf(sourceDictionary));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<Syllable>) ApiInvoker.deserialize(response, "List", Syllable.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public FrequencySummary getWordFrequency (String word, String useCanonical, Integer startYear, Integer endYear) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/frequency".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(startYear)))
queryParams.put("startYear", String.valueOf(startYear));
if(!"null".equals(String.valueOf(endYear)))
queryParams.put("endYear", String.valueOf(endYear));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (FrequencySummary) ApiInvoker.deserialize(response, "", FrequencySummary.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<Bigram> getPhrases (String word, Integer limit, Integer wlmi, String useCanonical) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/phrases".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
if(!"null".equals(String.valueOf(wlmi)))
queryParams.put("wlmi", String.valueOf(wlmi));
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<Bigram>) ApiInvoker.deserialize(response, "List", Bigram.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<String> getEtymologies (String word, String useCanonical) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/etymologies".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<String>) ApiInvoker.deserialize(response, "List", String.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<AudioFile> getAudio (String word, String useCanonical, Integer limit) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/audio".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<AudioFile>) ApiInvoker.deserialize(response, "List", AudioFile.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public ScrabbleScoreResult getScrabbleScore (String word) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/scrabbleScore".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (ScrabbleScoreResult) ApiInvoker.deserialize(response, "", ScrabbleScoreResult.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
}

View File

@ -1,231 +0,0 @@
package com.wordnik.client.api;
import com.wordnik.client.common.ApiException;
import com.wordnik.client.common.ApiInvoker;
import com.wordnik.client.model.WordListWord;
import com.wordnik.client.model.WordList;
import com.wordnik.client.model.StringValue;
import java.util.*;
public class WordListApi {
String basePath = "http://api.wordnik.com/v4";
ApiInvoker apiInvoker = ApiInvoker.getInstance();
public void addHeader(String key, String value) {
getInvoker().addDefaultHeader(key, value);
}
public ApiInvoker getInvoker() {
return apiInvoker;
}
public void setBasePath(String basePath) {
this.basePath = basePath;
}
public String getBasePath() {
return basePath;
}
public void updateWordList (String permalink, WordList body, String auth_token) throws ApiException {
// verify required params are set
if(permalink == null || auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams, contentType);
if(response != null){
return ;
}
else {
return ;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return ;
}
else {
throw ex;
}
}
}
public void deleteWordList (String permalink, String auth_token) throws ApiException {
// verify required params are set
if(permalink == null || auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType);
if(response != null){
return ;
}
else {
return ;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return ;
}
else {
throw ex;
}
}
}
public WordList getWordListByPermalink (String permalink, String auth_token) throws ApiException {
// verify required params are set
if(permalink == null || auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (WordList) ApiInvoker.deserialize(response, "", WordList.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public void addWordsToWordList (String permalink, List<StringValue> body, String auth_token) throws ApiException {
// verify required params are set
if(permalink == null || auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/wordList.{format}/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
if(response != null){
return ;
}
else {
return ;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return ;
}
else {
throw ex;
}
}
}
public List<WordListWord> getWordListWords (String permalink, String auth_token, String sortBy, String sortOrder, Integer skip, Integer limit) throws ApiException {
// verify required params are set
if(permalink == null || auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/wordList.{format}/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(sortBy)))
queryParams.put("sortBy", String.valueOf(sortBy));
if(!"null".equals(String.valueOf(sortOrder)))
queryParams.put("sortOrder", String.valueOf(sortOrder));
if(!"null".equals(String.valueOf(skip)))
queryParams.put("skip", String.valueOf(skip));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<WordListWord>) ApiInvoker.deserialize(response, "List", WordListWord.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public void deleteWordsFromWordList (String permalink, List<StringValue> body, String auth_token) throws ApiException {
// verify required params are set
if(permalink == null || auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/wordList.{format}/{permalink}/deleteWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
if(response != null){
return ;
}
else {
return ;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return ;
}
else {
throw ex;
}
}
}
}

View File

@ -1,61 +0,0 @@
package com.wordnik.client.api;
import com.wordnik.client.common.ApiException;
import com.wordnik.client.common.ApiInvoker;
import com.wordnik.client.model.WordList;
import java.util.*;
public class WordListsApi {
String basePath = "http://api.wordnik.com/v4";
ApiInvoker apiInvoker = ApiInvoker.getInstance();
public void addHeader(String key, String value) {
getInvoker().addDefaultHeader(key, value);
}
public ApiInvoker getInvoker() {
return apiInvoker;
}
public void setBasePath(String basePath) {
this.basePath = basePath;
}
public String getBasePath() {
return basePath;
}
public WordList createWordList (WordList body, String auth_token) throws ApiException {
// verify required params are set
if(auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/wordLists.{format}".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
if(response != null){
return (WordList) ApiInvoker.deserialize(response, "", WordList.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
}

View File

@ -1,273 +0,0 @@
package com.wordnik.client.api;
import com.wordnik.client.common.ApiException;
import com.wordnik.client.common.ApiInvoker;
import com.wordnik.client.model.DefinitionSearchResults;
import com.wordnik.client.model.WordObject;
import com.wordnik.client.model.WordOfTheDay;
import com.wordnik.client.model.WordSearchResults;
import java.util.*;
public class WordsApi {
String basePath = "http://api.wordnik.com/v4";
ApiInvoker apiInvoker = ApiInvoker.getInstance();
public void addHeader(String key, String value) {
getInvoker().addDefaultHeader(key, value);
}
public ApiInvoker getInvoker() {
return apiInvoker;
}
public void setBasePath(String basePath) {
this.basePath = basePath;
}
public String getBasePath() {
return basePath;
}
public WordSearchResults searchWords (String query, String includePartOfSpeech, String excludePartOfSpeech, String caseSensitive, Integer minCorpusCount, Integer maxCorpusCount, Integer minDictionaryCount, Integer maxDictionaryCount, Integer minLength, Integer maxLength, Integer skip, Integer limit) throws ApiException {
// verify required params are set
if(query == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/words.{format}/search/{query}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "query" + "\\}", apiInvoker.escapeString(query.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(caseSensitive)))
queryParams.put("caseSensitive", String.valueOf(caseSensitive));
if(!"null".equals(String.valueOf(includePartOfSpeech)))
queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech));
if(!"null".equals(String.valueOf(excludePartOfSpeech)))
queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech));
if(!"null".equals(String.valueOf(minCorpusCount)))
queryParams.put("minCorpusCount", String.valueOf(minCorpusCount));
if(!"null".equals(String.valueOf(maxCorpusCount)))
queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount));
if(!"null".equals(String.valueOf(minDictionaryCount)))
queryParams.put("minDictionaryCount", String.valueOf(minDictionaryCount));
if(!"null".equals(String.valueOf(maxDictionaryCount)))
queryParams.put("maxDictionaryCount", String.valueOf(maxDictionaryCount));
if(!"null".equals(String.valueOf(minLength)))
queryParams.put("minLength", String.valueOf(minLength));
if(!"null".equals(String.valueOf(maxLength)))
queryParams.put("maxLength", String.valueOf(maxLength));
if(!"null".equals(String.valueOf(skip)))
queryParams.put("skip", String.valueOf(skip));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (WordSearchResults) ApiInvoker.deserialize(response, "", WordSearchResults.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public WordOfTheDay getWordOfTheDay (String date) throws ApiException {
// create path and map variables
String path = "/words.{format}/wordOfTheDay".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(date)))
queryParams.put("date", String.valueOf(date));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (WordOfTheDay) ApiInvoker.deserialize(response, "", WordOfTheDay.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public DefinitionSearchResults reverseDictionary (String query, String findSenseForWord, String includeSourceDictionaries, String excludeSourceDictionaries, String includePartOfSpeech, String excludePartOfSpeech, String expandTerms, String sortBy, String sortOrder, Integer minCorpusCount, Integer maxCorpusCount, Integer minLength, Integer maxLength, String includeTags, String skip, Integer limit) throws ApiException {
// verify required params are set
if(query == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/words.{format}/reverseDictionary".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(query)))
queryParams.put("query", String.valueOf(query));
if(!"null".equals(String.valueOf(findSenseForWord)))
queryParams.put("findSenseForWord", String.valueOf(findSenseForWord));
if(!"null".equals(String.valueOf(includeSourceDictionaries)))
queryParams.put("includeSourceDictionaries", String.valueOf(includeSourceDictionaries));
if(!"null".equals(String.valueOf(excludeSourceDictionaries)))
queryParams.put("excludeSourceDictionaries", String.valueOf(excludeSourceDictionaries));
if(!"null".equals(String.valueOf(includePartOfSpeech)))
queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech));
if(!"null".equals(String.valueOf(excludePartOfSpeech)))
queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech));
if(!"null".equals(String.valueOf(minCorpusCount)))
queryParams.put("minCorpusCount", String.valueOf(minCorpusCount));
if(!"null".equals(String.valueOf(maxCorpusCount)))
queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount));
if(!"null".equals(String.valueOf(minLength)))
queryParams.put("minLength", String.valueOf(minLength));
if(!"null".equals(String.valueOf(maxLength)))
queryParams.put("maxLength", String.valueOf(maxLength));
if(!"null".equals(String.valueOf(expandTerms)))
queryParams.put("expandTerms", String.valueOf(expandTerms));
if(!"null".equals(String.valueOf(includeTags)))
queryParams.put("includeTags", String.valueOf(includeTags));
if(!"null".equals(String.valueOf(sortBy)))
queryParams.put("sortBy", String.valueOf(sortBy));
if(!"null".equals(String.valueOf(sortOrder)))
queryParams.put("sortOrder", String.valueOf(sortOrder));
if(!"null".equals(String.valueOf(skip)))
queryParams.put("skip", String.valueOf(skip));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (DefinitionSearchResults) ApiInvoker.deserialize(response, "", DefinitionSearchResults.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<WordObject> getRandomWords (String includePartOfSpeech, String excludePartOfSpeech, String sortBy, String sortOrder, String hasDictionaryDef, Integer minCorpusCount, Integer maxCorpusCount, Integer minDictionaryCount, Integer maxDictionaryCount, Integer minLength, Integer maxLength, Integer limit) throws ApiException {
// create path and map variables
String path = "/words.{format}/randomWords".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(hasDictionaryDef)))
queryParams.put("hasDictionaryDef", String.valueOf(hasDictionaryDef));
if(!"null".equals(String.valueOf(includePartOfSpeech)))
queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech));
if(!"null".equals(String.valueOf(excludePartOfSpeech)))
queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech));
if(!"null".equals(String.valueOf(minCorpusCount)))
queryParams.put("minCorpusCount", String.valueOf(minCorpusCount));
if(!"null".equals(String.valueOf(maxCorpusCount)))
queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount));
if(!"null".equals(String.valueOf(minDictionaryCount)))
queryParams.put("minDictionaryCount", String.valueOf(minDictionaryCount));
if(!"null".equals(String.valueOf(maxDictionaryCount)))
queryParams.put("maxDictionaryCount", String.valueOf(maxDictionaryCount));
if(!"null".equals(String.valueOf(minLength)))
queryParams.put("minLength", String.valueOf(minLength));
if(!"null".equals(String.valueOf(maxLength)))
queryParams.put("maxLength", String.valueOf(maxLength));
if(!"null".equals(String.valueOf(sortBy)))
queryParams.put("sortBy", String.valueOf(sortBy));
if(!"null".equals(String.valueOf(sortOrder)))
queryParams.put("sortOrder", String.valueOf(sortOrder));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<WordObject>) ApiInvoker.deserialize(response, "List", WordObject.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public WordObject getRandomWord (String includePartOfSpeech, String excludePartOfSpeech, String hasDictionaryDef, Integer minCorpusCount, Integer maxCorpusCount, Integer minDictionaryCount, Integer maxDictionaryCount, Integer minLength, Integer maxLength) throws ApiException {
// create path and map variables
String path = "/words.{format}/randomWord".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(hasDictionaryDef)))
queryParams.put("hasDictionaryDef", String.valueOf(hasDictionaryDef));
if(!"null".equals(String.valueOf(includePartOfSpeech)))
queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech));
if(!"null".equals(String.valueOf(excludePartOfSpeech)))
queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech));
if(!"null".equals(String.valueOf(minCorpusCount)))
queryParams.put("minCorpusCount", String.valueOf(minCorpusCount));
if(!"null".equals(String.valueOf(maxCorpusCount)))
queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount));
if(!"null".equals(String.valueOf(minDictionaryCount)))
queryParams.put("minDictionaryCount", String.valueOf(minDictionaryCount));
if(!"null".equals(String.valueOf(maxDictionaryCount)))
queryParams.put("maxDictionaryCount", String.valueOf(maxDictionaryCount));
if(!"null".equals(String.valueOf(minLength)))
queryParams.put("minLength", String.valueOf(minLength));
if(!"null".equals(String.valueOf(maxLength)))
queryParams.put("maxLength", String.valueOf(maxLength));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (WordObject) ApiInvoker.deserialize(response, "", WordObject.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
}

View File

@ -1,29 +0,0 @@
package com.wordnik.client.common;
public class ApiException extends Exception {
int code = 0;
String message = null;
public ApiException() {}
public ApiException(int code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}

View File

@ -1,272 +0,0 @@
package com.wordnik.client.common;
import com.fasterxml.jackson.core.JsonGenerator.Feature;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.http.*;
import org.apache.http.client.*;
import org.apache.http.client.methods.*;
import org.apache.http.conn.*;
import org.apache.http.conn.scheme.*;
import org.apache.http.conn.ssl.*;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.*;
import org.apache.http.impl.conn.*;
import org.apache.http.params.*;
import org.apache.http.util.EntityUtils;
import java.io.File;
import java.net.Socket;
import java.net.UnknownHostException;
import java.net.URLEncoder;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
public class ApiInvoker {
private static ApiInvoker INSTANCE = new ApiInvoker();
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private HttpClient client = null;
private boolean ignoreSSLCertificates = false;
private ClientConnectionManager ignoreSSLConnectionManager;
public ApiInvoker() {
initConnectionManager();
}
public static ApiInvoker getInstance() {
return INSTANCE;
}
public void ignoreSSLCertificates(boolean ignoreSSLCertificates) {
this.ignoreSSLCertificates = ignoreSSLCertificates;
}
public void addDefaultHeader(String key, String value) {
defaultHeaderMap.put(key, value);
}
public String escapeString(String str) {
return str;
}
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {
try{
if("List".equals(containerType)) {
JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructCollectionType(List.class, cls);
List response = (List<?>) JsonUtil.getJsonMapper().readValue(json, typeInfo);
return response;
}
else if(String.class.equals(cls)) {
if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1)
return json.substring(1, json.length() - 2);
else
return json;
}
else {
return JsonUtil.getJsonMapper().readValue(json, cls);
}
}
catch (IOException e) {
throw new ApiException(500, e.getMessage());
}
}
public static String serialize(Object obj) throws ApiException {
try {
if (obj != null)
return JsonUtil.getJsonMapper().writeValueAsString(obj);
else
return null;
}
catch (Exception e) {
throw new ApiException(500, e.getMessage());
}
}
public String invokeAPI(String host, String path, String method, Map<String, String> queryParams, Object body, Map<String, String> headerParams, String contentType) throws ApiException {
HttpClient client = getClient(host);
StringBuilder b = new StringBuilder();
for(String key : queryParams.keySet()) {
String value = queryParams.get(key);
if (value != null){
if(b.toString().length() == 0)
b.append("?");
else
b.append("&");
b.append(escapeString(key)).append("=").append(escapeString(value));
}
}
String url = host + path + b.toString();
HashMap<String, String> headers = new HashMap<String, String>();
for(String key : headerParams.keySet()) {
headers.put(key, headerParams.get(key));
}
for(String key : defaultHeaderMap.keySet()) {
if(!headerParams.containsKey(key)) {
headers.put(key, defaultHeaderMap.get(key));
}
}
headers.put("Accept", "application/json");
HttpResponse response = null;
try{
if("GET".equals(method)) {
HttpGet get = new HttpGet(url);
get.addHeader("Accept", "application/json");
for(String key : headers.keySet()) {
get.setHeader(key, headers.get(key));
}
response = client.execute(get);
}
else if ("POST".equals(method)) {
HttpPost post = new HttpPost(url);
if (body != null) {
post.setHeader("Content-Type", contentType);
post.setEntity(new StringEntity(serialize(body), "UTF-8"));
}
for(String key : headers.keySet()) {
post.setHeader(key, headers.get(key));
}
response = client.execute(post);
}
else if ("PUT".equals(method)) {
HttpPut put = new HttpPut(url);
if(body != null) {
put.setHeader("Content-Type", contentType);
put.setEntity(new StringEntity(serialize(body), "UTF-8"));
}
for(String key : headers.keySet()) {
put.setHeader(key, headers.get(key));
}
response = client.execute(put);
}
else if ("DELETE".equals(method)) {
HttpDelete delete = new HttpDelete(url);
for(String key : headers.keySet()) {
delete.setHeader(key, headers.get(key));
}
response = client.execute(delete);
}
int code = response.getStatusLine().getStatusCode();
String responseString = null;
if(code == 204)
responseString = "";
else if(code >= 200 && code < 300) {
if(response.getEntity() != null) {
HttpEntity resEntity = response.getEntity();
responseString = EntityUtils.toString(resEntity);
}
}
else {
if(response.getEntity() != null) {
HttpEntity resEntity = response.getEntity();
responseString = EntityUtils.toString(resEntity);
}
else
responseString = "no data";
throw new ApiException(code, responseString);
}
return responseString;
}
catch(IOException e) {
throw new ApiException(500, e.getMessage());
}
}
private HttpClient getClient(String host) {
if (client == null) {
if (ignoreSSLCertificates && ignoreSSLConnectionManager != null) {
// Trust self signed certificates
client = new DefaultHttpClient(ignoreSSLConnectionManager, new BasicHttpParams());
} else {
client = new DefaultHttpClient();
}
}
return client;
}
private void initConnectionManager() {
try {
final SSLContext sslContext = SSLContext.getInstance("SSL");
// set up a TrustManager that trusts everything
TrustManager[] trustManagers = new TrustManager[] {
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {}
public void checkServerTrusted(X509Certificate[] certs, String authType) {}
}};
sslContext.init(null, trustManagers, new SecureRandom());
SSLSocketFactory sf = new SSLSocketFactory((KeyStore)null) {
private javax.net.ssl.SSLSocketFactory sslFactory = sslContext.getSocketFactory();
public Socket createSocket(Socket socket, String host, int port, boolean autoClose)
throws IOException, UnknownHostException {
return sslFactory.createSocket(socket, host, port, autoClose);
}
public Socket createSocket() throws IOException {
return sslFactory.createSocket();
}
};
sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
Scheme httpsScheme = new Scheme("https", sf, 443);
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(httpsScheme);
schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
ignoreSSLConnectionManager = new SingleClientConnManager(new BasicHttpParams(), schemeRegistry);
} catch (NoSuchAlgorithmException e) {
// This will only be thrown if SSL isn't available for some reason.
} catch (KeyManagementException e) {
// This might be thrown when passing a key into init(), but no key is being passed.
} catch (GeneralSecurityException e) {
// This catches anything else that might go wrong.
// If anything goes wrong we default to the standard connection manager.
}
}
}

View File

@ -1,21 +0,0 @@
package com.wordnik.client.common;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.core.JsonGenerator.Feature;
public class JsonUtil {
public static ObjectMapper mapper;
static {
mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
}
public static ObjectMapper getJsonMapper() {
return mapper;
}
}

View File

@ -1,74 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ApiTokenStatus {
@JsonProperty("valid")
private Boolean valid = null;
@JsonProperty("token")
private String token = null;
@JsonProperty("resetsInMillis")
private Long resetsInMillis = null;
@JsonProperty("remainingCalls")
private Long remainingCalls = null;
@JsonProperty("expiresInMillis")
private Long expiresInMillis = null;
@JsonProperty("totalRequests")
private Long totalRequests = null;
public Boolean getValid() {
return valid;
}
public void setValid(Boolean valid) {
this.valid = valid;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public Long getResetsInMillis() {
return resetsInMillis;
}
public void setResetsInMillis(Long resetsInMillis) {
this.resetsInMillis = resetsInMillis;
}
public Long getRemainingCalls() {
return remainingCalls;
}
public void setRemainingCalls(Long remainingCalls) {
this.remainingCalls = remainingCalls;
}
public Long getExpiresInMillis() {
return expiresInMillis;
}
public void setExpiresInMillis(Long expiresInMillis) {
this.expiresInMillis = expiresInMillis;
}
public Long getTotalRequests() {
return totalRequests;
}
public void setTotalRequests(Long totalRequests) {
this.totalRequests = totalRequests;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ApiTokenStatus {\n");
sb.append(" valid: ").append(valid).append("\n");
sb.append(" token: ").append(token).append("\n");
sb.append(" resetsInMillis: ").append(resetsInMillis).append("\n");
sb.append(" remainingCalls: ").append(remainingCalls).append("\n");
sb.append(" expiresInMillis: ").append(expiresInMillis).append("\n");
sb.append(" totalRequests: ").append(totalRequests).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,155 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
public class AudioFile {
@JsonProperty("attributionUrl")
private String attributionUrl = null;
@JsonProperty("commentCount")
private Integer commentCount = null;
@JsonProperty("voteCount")
private Integer voteCount = null;
@JsonProperty("fileUrl")
private String fileUrl = null;
@JsonProperty("audioType")
private String audioType = null;
@JsonProperty("id")
private Long id = null;
@JsonProperty("duration")
private Double duration = null;
@JsonProperty("attributionText")
private String attributionText = null;
@JsonProperty("createdBy")
private String createdBy = null;
@JsonProperty("description")
private String description = null;
@JsonProperty("createdAt")
private Date createdAt = null;
@JsonProperty("voteWeightedAverage")
private Float voteWeightedAverage = null;
@JsonProperty("voteAverage")
private Float voteAverage = null;
@JsonProperty("word")
private String word = null;
public String getAttributionUrl() {
return attributionUrl;
}
public void setAttributionUrl(String attributionUrl) {
this.attributionUrl = attributionUrl;
}
public Integer getCommentCount() {
return commentCount;
}
public void setCommentCount(Integer commentCount) {
this.commentCount = commentCount;
}
public Integer getVoteCount() {
return voteCount;
}
public void setVoteCount(Integer voteCount) {
this.voteCount = voteCount;
}
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
public String getAudioType() {
return audioType;
}
public void setAudioType(String audioType) {
this.audioType = audioType;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Double getDuration() {
return duration;
}
public void setDuration(Double duration) {
this.duration = duration;
}
public String getAttributionText() {
return attributionText;
}
public void setAttributionText(String attributionText) {
this.attributionText = attributionText;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Float getVoteWeightedAverage() {
return voteWeightedAverage;
}
public void setVoteWeightedAverage(Float voteWeightedAverage) {
this.voteWeightedAverage = voteWeightedAverage;
}
public Float getVoteAverage() {
return voteAverage;
}
public void setVoteAverage(Float voteAverage) {
this.voteAverage = voteAverage;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AudioFile {\n");
sb.append(" attributionUrl: ").append(attributionUrl).append("\n");
sb.append(" commentCount: ").append(commentCount).append("\n");
sb.append(" voteCount: ").append(voteCount).append("\n");
sb.append(" fileUrl: ").append(fileUrl).append("\n");
sb.append(" audioType: ").append(audioType).append("\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" duration: ").append(duration).append("\n");
sb.append(" attributionText: ").append(attributionText).append("\n");
sb.append(" createdBy: ").append(createdBy).append("\n");
sb.append(" description: ").append(description).append("\n");
sb.append(" createdAt: ").append(createdAt).append("\n");
sb.append(" voteWeightedAverage: ").append(voteWeightedAverage).append("\n");
sb.append(" voteAverage: ").append(voteAverage).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,44 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class AuthenticationToken {
@JsonProperty("token")
private String token = null;
@JsonProperty("userId")
private Long userId = null;
@JsonProperty("userSignature")
private String userSignature = null;
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUserSignature() {
return userSignature;
}
public void setUserSignature(String userSignature) {
this.userSignature = userSignature;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AuthenticationToken {\n");
sb.append(" token: ").append(token).append("\n");
sb.append(" userId: ").append(userId).append("\n");
sb.append(" userSignature: ").append(userSignature).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,64 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Bigram {
@JsonProperty("count")
private Long count = null;
@JsonProperty("gram2")
private String gram2 = null;
@JsonProperty("gram1")
private String gram1 = null;
@JsonProperty("wlmi")
private Double wlmi = null;
@JsonProperty("mi")
private Double mi = null;
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public String getGram2() {
return gram2;
}
public void setGram2(String gram2) {
this.gram2 = gram2;
}
public String getGram1() {
return gram1;
}
public void setGram1(String gram1) {
this.gram1 = gram1;
}
public Double getWlmi() {
return wlmi;
}
public void setWlmi(Double wlmi) {
this.wlmi = wlmi;
}
public Double getMi() {
return mi;
}
public void setMi(Double mi) {
this.mi = mi;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Bigram {\n");
sb.append(" count: ").append(count).append("\n");
sb.append(" gram2: ").append(gram2).append("\n");
sb.append(" gram1: ").append(gram1).append("\n");
sb.append(" wlmi: ").append(wlmi).append("\n");
sb.append(" mi: ").append(mi).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,34 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Citation {
@JsonProperty("cite")
private String cite = null;
@JsonProperty("source")
private String source = null;
public String getCite() {
return cite;
}
public void setCite(String cite) {
this.cite = cite;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Citation {\n");
sb.append(" cite: ").append(cite).append("\n");
sb.append(" source: ").append(source).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,34 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ContentProvider {
@JsonProperty("id")
private Integer id = null;
@JsonProperty("name")
private String name = null;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ContentProvider {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" name: ").append(name).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,181 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.*;
import com.wordnik.client.model.Label;
import com.wordnik.client.model.ExampleUsage;
import com.wordnik.client.model.TextPron;
import com.wordnik.client.model.Citation;
import com.wordnik.client.model.Related;
import com.wordnik.client.model.Note;
public class Definition {
@JsonProperty("extendedText")
private String extendedText = null;
@JsonProperty("text")
private String text = null;
@JsonProperty("sourceDictionary")
private String sourceDictionary = null;
@JsonProperty("citations")
private List<Citation> citations = new ArrayList<Citation>();
@JsonProperty("labels")
private List<Label> labels = new ArrayList<Label>();
@JsonProperty("score")
private Float score = null;
@JsonProperty("exampleUses")
private List<ExampleUsage> exampleUses = new ArrayList<ExampleUsage>();
@JsonProperty("attributionUrl")
private String attributionUrl = null;
@JsonProperty("seqString")
private String seqString = null;
@JsonProperty("attributionText")
private String attributionText = null;
@JsonProperty("relatedWords")
private List<Related> relatedWords = new ArrayList<Related>();
@JsonProperty("sequence")
private String sequence = null;
@JsonProperty("word")
private String word = null;
@JsonProperty("notes")
private List<Note> notes = new ArrayList<Note>();
@JsonProperty("textProns")
private List<TextPron> textProns = new ArrayList<TextPron>();
@JsonProperty("partOfSpeech")
private String partOfSpeech = null;
public String getExtendedText() {
return extendedText;
}
public void setExtendedText(String extendedText) {
this.extendedText = extendedText;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getSourceDictionary() {
return sourceDictionary;
}
public void setSourceDictionary(String sourceDictionary) {
this.sourceDictionary = sourceDictionary;
}
public List<Citation> getCitations() {
return citations;
}
public void setCitations(List<Citation> citations) {
this.citations = citations;
}
public List<Label> getLabels() {
return labels;
}
public void setLabels(List<Label> labels) {
this.labels = labels;
}
public Float getScore() {
return score;
}
public void setScore(Float score) {
this.score = score;
}
public List<ExampleUsage> getExampleUses() {
return exampleUses;
}
public void setExampleUses(List<ExampleUsage> exampleUses) {
this.exampleUses = exampleUses;
}
public String getAttributionUrl() {
return attributionUrl;
}
public void setAttributionUrl(String attributionUrl) {
this.attributionUrl = attributionUrl;
}
public String getSeqString() {
return seqString;
}
public void setSeqString(String seqString) {
this.seqString = seqString;
}
public String getAttributionText() {
return attributionText;
}
public void setAttributionText(String attributionText) {
this.attributionText = attributionText;
}
public List<Related> getRelatedWords() {
return relatedWords;
}
public void setRelatedWords(List<Related> relatedWords) {
this.relatedWords = relatedWords;
}
public String getSequence() {
return sequence;
}
public void setSequence(String sequence) {
this.sequence = sequence;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public List<Note> getNotes() {
return notes;
}
public void setNotes(List<Note> notes) {
this.notes = notes;
}
public List<TextPron> getTextProns() {
return textProns;
}
public void setTextProns(List<TextPron> textProns) {
this.textProns = textProns;
}
public String getPartOfSpeech() {
return partOfSpeech;
}
public void setPartOfSpeech(String partOfSpeech) {
this.partOfSpeech = partOfSpeech;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Definition {\n");
sb.append(" extendedText: ").append(extendedText).append("\n");
sb.append(" text: ").append(text).append("\n");
sb.append(" sourceDictionary: ").append(sourceDictionary).append("\n");
sb.append(" citations: ").append(citations).append("\n");
sb.append(" labels: ").append(labels).append("\n");
sb.append(" score: ").append(score).append("\n");
sb.append(" exampleUses: ").append(exampleUses).append("\n");
sb.append(" attributionUrl: ").append(attributionUrl).append("\n");
sb.append(" seqString: ").append(seqString).append("\n");
sb.append(" attributionText: ").append(attributionText).append("\n");
sb.append(" relatedWords: ").append(relatedWords).append("\n");
sb.append(" sequence: ").append(sequence).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append(" notes: ").append(notes).append("\n");
sb.append(" textProns: ").append(textProns).append("\n");
sb.append(" partOfSpeech: ").append(partOfSpeech).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,36 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.*;
import com.wordnik.client.model.Definition;
public class DefinitionSearchResults {
@JsonProperty("results")
private List<Definition> results = new ArrayList<Definition>();
@JsonProperty("totalResults")
private Integer totalResults = null;
public List<Definition> getResults() {
return results;
}
public void setResults(List<Definition> results) {
this.results = results;
}
public Integer getTotalResults() {
return totalResults;
}
public void setTotalResults(Integer totalResults) {
this.totalResults = totalResults;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DefinitionSearchResults {\n");
sb.append(" results: ").append(results).append("\n");
sb.append(" totalResults: ").append(totalResults).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,137 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.wordnik.client.model.Sentence;
import com.wordnik.client.model.ContentProvider;
import com.wordnik.client.model.ScoredWord;
public class Example {
@JsonProperty("id")
private Long id = null;
@JsonProperty("exampleId")
private Long exampleId = null;
@JsonProperty("title")
private String title = null;
@JsonProperty("text")
private String text = null;
@JsonProperty("score")
private ScoredWord score = null;
@JsonProperty("sentence")
private Sentence sentence = null;
@JsonProperty("word")
private String word = null;
@JsonProperty("provider")
private ContentProvider provider = null;
@JsonProperty("year")
private Integer year = null;
@JsonProperty("rating")
private Float rating = null;
@JsonProperty("documentId")
private Long documentId = null;
@JsonProperty("url")
private String url = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getExampleId() {
return exampleId;
}
public void setExampleId(Long exampleId) {
this.exampleId = exampleId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public ScoredWord getScore() {
return score;
}
public void setScore(ScoredWord score) {
this.score = score;
}
public Sentence getSentence() {
return sentence;
}
public void setSentence(Sentence sentence) {
this.sentence = sentence;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public ContentProvider getProvider() {
return provider;
}
public void setProvider(ContentProvider provider) {
this.provider = provider;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
public Float getRating() {
return rating;
}
public void setRating(Float rating) {
this.rating = rating;
}
public Long getDocumentId() {
return documentId;
}
public void setDocumentId(Long documentId) {
this.documentId = documentId;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Example {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" exampleId: ").append(exampleId).append("\n");
sb.append(" title: ").append(title).append("\n");
sb.append(" text: ").append(text).append("\n");
sb.append(" score: ").append(score).append("\n");
sb.append(" sentence: ").append(sentence).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append(" provider: ").append(provider).append("\n");
sb.append(" year: ").append(year).append("\n");
sb.append(" rating: ").append(rating).append("\n");
sb.append(" documentId: ").append(documentId).append("\n");
sb.append(" url: ").append(url).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,37 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.*;
import com.wordnik.client.model.Facet;
import com.wordnik.client.model.Example;
public class ExampleSearchResults {
@JsonProperty("facets")
private List<Facet> facets = new ArrayList<Facet>();
@JsonProperty("examples")
private List<Example> examples = new ArrayList<Example>();
public List<Facet> getFacets() {
return facets;
}
public void setFacets(List<Facet> facets) {
this.facets = facets;
}
public List<Example> getExamples() {
return examples;
}
public void setExamples(List<Example> examples) {
this.examples = examples;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ExampleSearchResults {\n");
sb.append(" facets: ").append(facets).append("\n");
sb.append(" examples: ").append(examples).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,24 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ExampleUsage {
@JsonProperty("text")
private String text = null;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ExampleUsage {\n");
sb.append(" text: ").append(text).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,36 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.*;
import com.wordnik.client.model.FacetValue;
public class Facet {
@JsonProperty("facetValues")
private List<FacetValue> facetValues = new ArrayList<FacetValue>();
@JsonProperty("name")
private String name = null;
public List<FacetValue> getFacetValues() {
return facetValues;
}
public void setFacetValues(List<FacetValue> facetValues) {
this.facetValues = facetValues;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Facet {\n");
sb.append(" facetValues: ").append(facetValues).append("\n");
sb.append(" name: ").append(name).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,34 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class FacetValue {
@JsonProperty("count")
private Long count = null;
@JsonProperty("value")
private String value = null;
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FacetValue {\n");
sb.append(" count: ").append(count).append("\n");
sb.append(" value: ").append(value).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,34 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Frequency {
@JsonProperty("count")
private Long count = null;
@JsonProperty("year")
private Integer year = null;
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Frequency {\n");
sb.append(" count: ").append(count).append("\n");
sb.append(" year: ").append(year).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,66 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.*;
import com.wordnik.client.model.Frequency;
public class FrequencySummary {
@JsonProperty("unknownYearCount")
private Integer unknownYearCount = null;
@JsonProperty("totalCount")
private Long totalCount = null;
@JsonProperty("frequencyString")
private String frequencyString = null;
@JsonProperty("word")
private String word = null;
@JsonProperty("frequency")
private List<Frequency> frequency = new ArrayList<Frequency>();
public Integer getUnknownYearCount() {
return unknownYearCount;
}
public void setUnknownYearCount(Integer unknownYearCount) {
this.unknownYearCount = unknownYearCount;
}
public Long getTotalCount() {
return totalCount;
}
public void setTotalCount(Long totalCount) {
this.totalCount = totalCount;
}
public String getFrequencyString() {
return frequencyString;
}
public void setFrequencyString(String frequencyString) {
this.frequencyString = frequencyString;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public List<Frequency> getFrequency() {
return frequency;
}
public void setFrequency(List<Frequency> frequency) {
this.frequency = frequency;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FrequencySummary {\n");
sb.append(" unknownYearCount: ").append(unknownYearCount).append("\n");
sb.append(" totalCount: ").append(totalCount).append("\n");
sb.append(" frequencyString: ").append(frequencyString).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append(" frequency: ").append(frequency).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,34 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Label {
@JsonProperty("text")
private String text = null;
@JsonProperty("type")
private String type = null;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Label {\n");
sb.append(" text: ").append(text).append("\n");
sb.append(" type: ").append(type).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,55 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.*;
public class Note {
@JsonProperty("noteType")
private String noteType = null;
@JsonProperty("appliesTo")
private List<String> appliesTo = new ArrayList<String>();
@JsonProperty("value")
private String value = null;
@JsonProperty("pos")
private Integer pos = null;
public String getNoteType() {
return noteType;
}
public void setNoteType(String noteType) {
this.noteType = noteType;
}
public List<String> getAppliesTo() {
return appliesTo;
}
public void setAppliesTo(List<String> appliesTo) {
this.appliesTo = appliesTo;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Integer getPos() {
return pos;
}
public void setPos(Integer pos) {
this.pos = pos;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Note {\n");
sb.append(" noteType: ").append(noteType).append("\n");
sb.append(" appliesTo: ").append(appliesTo).append("\n");
sb.append(" value: ").append(value).append("\n");
sb.append(" pos: ").append(pos).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,85 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.*;
public class Related {
@JsonProperty("label1")
private String label1 = null;
@JsonProperty("relationshipType")
private String relationshipType = null;
@JsonProperty("label2")
private String label2 = null;
@JsonProperty("label3")
private String label3 = null;
@JsonProperty("words")
private List<String> words = new ArrayList<String>();
@JsonProperty("gram")
private String gram = null;
@JsonProperty("label4")
private String label4 = null;
public String getLabel1() {
return label1;
}
public void setLabel1(String label1) {
this.label1 = label1;
}
public String getRelationshipType() {
return relationshipType;
}
public void setRelationshipType(String relationshipType) {
this.relationshipType = relationshipType;
}
public String getLabel2() {
return label2;
}
public void setLabel2(String label2) {
this.label2 = label2;
}
public String getLabel3() {
return label3;
}
public void setLabel3(String label3) {
this.label3 = label3;
}
public List<String> getWords() {
return words;
}
public void setWords(List<String> words) {
this.words = words;
}
public String getGram() {
return gram;
}
public void setGram(String gram) {
this.gram = gram;
}
public String getLabel4() {
return label4;
}
public void setLabel4(String label4) {
this.label4 = label4;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Related {\n");
sb.append(" label1: ").append(label1).append("\n");
sb.append(" relationshipType: ").append(relationshipType).append("\n");
sb.append(" label2: ").append(label2).append("\n");
sb.append(" label3: ").append(label3).append("\n");
sb.append(" words: ").append(words).append("\n");
sb.append(" gram: ").append(gram).append("\n");
sb.append(" label4: ").append(label4).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,124 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ScoredWord {
@JsonProperty("position")
private Integer position = null;
@JsonProperty("id")
private Long id = null;
@JsonProperty("docTermCount")
private Integer docTermCount = null;
@JsonProperty("lemma")
private String lemma = null;
@JsonProperty("wordType")
private String wordType = null;
@JsonProperty("score")
private Float score = null;
@JsonProperty("sentenceId")
private Long sentenceId = null;
@JsonProperty("word")
private String word = null;
@JsonProperty("stopword")
private Boolean stopword = null;
@JsonProperty("baseWordScore")
private Double baseWordScore = null;
@JsonProperty("partOfSpeech")
private String partOfSpeech = null;
public Integer getPosition() {
return position;
}
public void setPosition(Integer position) {
this.position = position;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getDocTermCount() {
return docTermCount;
}
public void setDocTermCount(Integer docTermCount) {
this.docTermCount = docTermCount;
}
public String getLemma() {
return lemma;
}
public void setLemma(String lemma) {
this.lemma = lemma;
}
public String getWordType() {
return wordType;
}
public void setWordType(String wordType) {
this.wordType = wordType;
}
public Float getScore() {
return score;
}
public void setScore(Float score) {
this.score = score;
}
public Long getSentenceId() {
return sentenceId;
}
public void setSentenceId(Long sentenceId) {
this.sentenceId = sentenceId;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public Boolean getStopword() {
return stopword;
}
public void setStopword(Boolean stopword) {
this.stopword = stopword;
}
public Double getBaseWordScore() {
return baseWordScore;
}
public void setBaseWordScore(Double baseWordScore) {
this.baseWordScore = baseWordScore;
}
public String getPartOfSpeech() {
return partOfSpeech;
}
public void setPartOfSpeech(String partOfSpeech) {
this.partOfSpeech = partOfSpeech;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ScoredWord {\n");
sb.append(" position: ").append(position).append("\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" docTermCount: ").append(docTermCount).append("\n");
sb.append(" lemma: ").append(lemma).append("\n");
sb.append(" wordType: ").append(wordType).append("\n");
sb.append(" score: ").append(score).append("\n");
sb.append(" sentenceId: ").append(sentenceId).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append(" stopword: ").append(stopword).append("\n");
sb.append(" baseWordScore: ").append(baseWordScore).append("\n");
sb.append(" partOfSpeech: ").append(partOfSpeech).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,24 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ScrabbleScoreResult {
@JsonProperty("value")
private Integer value = null;
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ScrabbleScoreResult {\n");
sb.append(" value: ").append(value).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,76 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.*;
import com.wordnik.client.model.ScoredWord;
public class Sentence {
@JsonProperty("hasScoredWords")
private Boolean hasScoredWords = null;
@JsonProperty("id")
private Long id = null;
@JsonProperty("scoredWords")
private List<ScoredWord> scoredWords = new ArrayList<ScoredWord>();
@JsonProperty("display")
private String display = null;
@JsonProperty("rating")
private Integer rating = null;
@JsonProperty("documentMetadataId")
private Long documentMetadataId = null;
public Boolean getHasScoredWords() {
return hasScoredWords;
}
public void setHasScoredWords(Boolean hasScoredWords) {
this.hasScoredWords = hasScoredWords;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public List<ScoredWord> getScoredWords() {
return scoredWords;
}
public void setScoredWords(List<ScoredWord> scoredWords) {
this.scoredWords = scoredWords;
}
public String getDisplay() {
return display;
}
public void setDisplay(String display) {
this.display = display;
}
public Integer getRating() {
return rating;
}
public void setRating(Integer rating) {
this.rating = rating;
}
public Long getDocumentMetadataId() {
return documentMetadataId;
}
public void setDocumentMetadataId(Long documentMetadataId) {
this.documentMetadataId = documentMetadataId;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Sentence {\n");
sb.append(" hasScoredWords: ").append(hasScoredWords).append("\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" scoredWords: ").append(scoredWords).append("\n");
sb.append(" display: ").append(display).append("\n");
sb.append(" rating: ").append(rating).append("\n");
sb.append(" documentMetadataId: ").append(documentMetadataId).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,54 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class SimpleDefinition {
@JsonProperty("text")
private String text = null;
@JsonProperty("source")
private String source = null;
@JsonProperty("note")
private String note = null;
@JsonProperty("partOfSpeech")
private String partOfSpeech = null;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public String getPartOfSpeech() {
return partOfSpeech;
}
public void setPartOfSpeech(String partOfSpeech) {
this.partOfSpeech = partOfSpeech;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SimpleDefinition {\n");
sb.append(" text: ").append(text).append("\n");
sb.append(" source: ").append(source).append("\n");
sb.append(" note: ").append(note).append("\n");
sb.append(" partOfSpeech: ").append(partOfSpeech).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,54 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class SimpleExample {
@JsonProperty("id")
private Long id = null;
@JsonProperty("title")
private String title = null;
@JsonProperty("text")
private String text = null;
@JsonProperty("url")
private String url = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SimpleExample {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" title: ").append(title).append("\n");
sb.append(" text: ").append(text).append("\n");
sb.append(" url: ").append(url).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,24 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class StringValue {
@JsonProperty("word")
private String word = null;
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StringValue {\n");
sb.append(" word: ").append(word).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,44 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Syllable {
@JsonProperty("text")
private String text = null;
@JsonProperty("seq")
private Integer seq = null;
@JsonProperty("type")
private String type = null;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public Integer getSeq() {
return seq;
}
public void setSeq(Integer seq) {
this.seq = seq;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Syllable {\n");
sb.append(" text: ").append(text).append("\n");
sb.append(" seq: ").append(seq).append("\n");
sb.append(" type: ").append(type).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,44 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class TextPron {
@JsonProperty("raw")
private String raw = null;
@JsonProperty("seq")
private Integer seq = null;
@JsonProperty("rawType")
private String rawType = null;
public String getRaw() {
return raw;
}
public void setRaw(String raw) {
this.raw = raw;
}
public Integer getSeq() {
return seq;
}
public void setSeq(Integer seq) {
this.seq = seq;
}
public String getRawType() {
return rawType;
}
public void setRawType(String rawType) {
this.rawType = rawType;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TextPron {\n");
sb.append(" raw: ").append(raw).append("\n");
sb.append(" seq: ").append(seq).append("\n");
sb.append(" rawType: ").append(rawType).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,94 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class User {
@JsonProperty("id")
private Long id = null;
@JsonProperty("username")
private String username = null;
@JsonProperty("email")
private String email = null;
@JsonProperty("status")
private Integer status = null;
@JsonProperty("faceBookId")
private String faceBookId = null;
@JsonProperty("userName")
private String userName = null;
@JsonProperty("displayName")
private String displayName = null;
@JsonProperty("password")
private String password = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getFaceBookId() {
return faceBookId;
}
public void setFaceBookId(String faceBookId) {
this.faceBookId = faceBookId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class User {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" username: ").append(username).append("\n");
sb.append(" email: ").append(email).append("\n");
sb.append(" status: ").append(status).append("\n");
sb.append(" faceBookId: ").append(faceBookId).append("\n");
sb.append(" userName: ").append(userName).append("\n");
sb.append(" displayName: ").append(displayName).append("\n");
sb.append(" password: ").append(password).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,125 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
public class WordList {
@JsonProperty("id")
private Long id = null;
@JsonProperty("permalink")
private String permalink = null;
@JsonProperty("name")
private String name = null;
@JsonProperty("createdAt")
private Date createdAt = null;
@JsonProperty("updatedAt")
private Date updatedAt = null;
@JsonProperty("lastActivityAt")
private Date lastActivityAt = null;
@JsonProperty("username")
private String username = null;
@JsonProperty("userId")
private Long userId = null;
@JsonProperty("description")
private String description = null;
@JsonProperty("numberWordsInList")
private Long numberWordsInList = null;
@JsonProperty("type")
private String type = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getPermalink() {
return permalink;
}
public void setPermalink(String permalink) {
this.permalink = permalink;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public Date getLastActivityAt() {
return lastActivityAt;
}
public void setLastActivityAt(Date lastActivityAt) {
this.lastActivityAt = lastActivityAt;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getNumberWordsInList() {
return numberWordsInList;
}
public void setNumberWordsInList(Long numberWordsInList) {
this.numberWordsInList = numberWordsInList;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class WordList {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" permalink: ").append(permalink).append("\n");
sb.append(" name: ").append(name).append("\n");
sb.append(" createdAt: ").append(createdAt).append("\n");
sb.append(" updatedAt: ").append(updatedAt).append("\n");
sb.append(" lastActivityAt: ").append(lastActivityAt).append("\n");
sb.append(" username: ").append(username).append("\n");
sb.append(" userId: ").append(userId).append("\n");
sb.append(" description: ").append(description).append("\n");
sb.append(" numberWordsInList: ").append(numberWordsInList).append("\n");
sb.append(" type: ").append(type).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,85 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
public class WordListWord {
@JsonProperty("id")
private Long id = null;
@JsonProperty("word")
private String word = null;
@JsonProperty("username")
private String username = null;
@JsonProperty("userId")
private Long userId = null;
@JsonProperty("createdAt")
private Date createdAt = null;
@JsonProperty("numberCommentsOnWord")
private Long numberCommentsOnWord = null;
@JsonProperty("numberLists")
private Long numberLists = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Long getNumberCommentsOnWord() {
return numberCommentsOnWord;
}
public void setNumberCommentsOnWord(Long numberCommentsOnWord) {
this.numberCommentsOnWord = numberCommentsOnWord;
}
public Long getNumberLists() {
return numberLists;
}
public void setNumberLists(Long numberLists) {
this.numberLists = numberLists;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class WordListWord {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append(" username: ").append(username).append("\n");
sb.append(" userId: ").append(userId).append("\n");
sb.append(" createdAt: ").append(createdAt).append("\n");
sb.append(" numberCommentsOnWord: ").append(numberCommentsOnWord).append("\n");
sb.append(" numberLists: ").append(numberLists).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,75 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.*;
public class WordObject {
@JsonProperty("id")
private Long id = null;
@JsonProperty("word")
private String word = null;
@JsonProperty("originalWord")
private String originalWord = null;
@JsonProperty("suggestions")
private List<String> suggestions = new ArrayList<String>();
@JsonProperty("canonicalForm")
private String canonicalForm = null;
@JsonProperty("vulgar")
private String vulgar = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public String getOriginalWord() {
return originalWord;
}
public void setOriginalWord(String originalWord) {
this.originalWord = originalWord;
}
public List<String> getSuggestions() {
return suggestions;
}
public void setSuggestions(List<String> suggestions) {
this.suggestions = suggestions;
}
public String getCanonicalForm() {
return canonicalForm;
}
public void setCanonicalForm(String canonicalForm) {
this.canonicalForm = canonicalForm;
}
public String getVulgar() {
return vulgar;
}
public void setVulgar(String vulgar) {
this.vulgar = vulgar;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class WordObject {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append(" originalWord: ").append(originalWord).append("\n");
sb.append(" suggestions: ").append(suggestions).append("\n");
sb.append(" canonicalForm: ").append(canonicalForm).append("\n");
sb.append(" vulgar: ").append(vulgar).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,139 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
import java.util.*;
import com.wordnik.client.model.SimpleExample;
import com.wordnik.client.model.SimpleDefinition;
import com.wordnik.client.model.ContentProvider;
public class WordOfTheDay {
@JsonProperty("id")
private Long id = null;
@JsonProperty("parentId")
private String parentId = null;
@JsonProperty("category")
private String category = null;
@JsonProperty("createdBy")
private String createdBy = null;
@JsonProperty("createdAt")
private Date createdAt = null;
@JsonProperty("contentProvider")
private ContentProvider contentProvider = null;
@JsonProperty("htmlExtra")
private String htmlExtra = null;
@JsonProperty("word")
private String word = null;
@JsonProperty("definitions")
private List<SimpleDefinition> definitions = new ArrayList<SimpleDefinition>();
@JsonProperty("examples")
private List<SimpleExample> examples = new ArrayList<SimpleExample>();
@JsonProperty("note")
private String note = null;
@JsonProperty("publishDate")
private Date publishDate = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public ContentProvider getContentProvider() {
return contentProvider;
}
public void setContentProvider(ContentProvider contentProvider) {
this.contentProvider = contentProvider;
}
public String getHtmlExtra() {
return htmlExtra;
}
public void setHtmlExtra(String htmlExtra) {
this.htmlExtra = htmlExtra;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public List<SimpleDefinition> getDefinitions() {
return definitions;
}
public void setDefinitions(List<SimpleDefinition> definitions) {
this.definitions = definitions;
}
public List<SimpleExample> getExamples() {
return examples;
}
public void setExamples(List<SimpleExample> examples) {
this.examples = examples;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public Date getPublishDate() {
return publishDate;
}
public void setPublishDate(Date publishDate) {
this.publishDate = publishDate;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class WordOfTheDay {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" parentId: ").append(parentId).append("\n");
sb.append(" category: ").append(category).append("\n");
sb.append(" createdBy: ").append(createdBy).append("\n");
sb.append(" createdAt: ").append(createdAt).append("\n");
sb.append(" contentProvider: ").append(contentProvider).append("\n");
sb.append(" htmlExtra: ").append(htmlExtra).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append(" definitions: ").append(definitions).append("\n");
sb.append(" examples: ").append(examples).append("\n");
sb.append(" note: ").append(note).append("\n");
sb.append(" publishDate: ").append(publishDate).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,44 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
public class WordSearchResult {
@JsonProperty("count")
private Long count = null;
@JsonProperty("lexicality")
private Double lexicality = null;
@JsonProperty("word")
private String word = null;
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public Double getLexicality() {
return lexicality;
}
public void setLexicality(Double lexicality) {
this.lexicality = lexicality;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class WordSearchResult {\n");
sb.append(" count: ").append(count).append("\n");
sb.append(" lexicality: ").append(lexicality).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,36 +0,0 @@
package com.wordnik.client.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.*;
import com.wordnik.client.model.WordSearchResult;
public class WordSearchResults {
@JsonProperty("searchResults")
private List<WordSearchResult> searchResults = new ArrayList<WordSearchResult>();
@JsonProperty("totalResults")
private Integer totalResults = null;
public List<WordSearchResult> getSearchResults() {
return searchResults;
}
public void setSearchResults(List<WordSearchResult> searchResults) {
this.searchResults = searchResults;
}
public Integer getTotalResults() {
return totalResults;
}
public void setTotalResults(Integer totalResults) {
this.totalResults = totalResults;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class WordSearchResults {\n");
sb.append(" searchResults: ").append(searchResults).append("\n");
sb.append(" totalResults: ").append(totalResults).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,51 +0,0 @@
/**
* Copyright 2014 Wordnik, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.wordnik.swagger.codegen.BasicJavaGenerator
object JavaWordnikApiCodegen extends BasicJavaGenerator {
def main(args: Array[String]) = generateClient(args)
// location of templates
override def templateDir = "Java"
def destinationRoot = "samples/client/wordnik-api/java"
// where to write generated code
override def destinationDir = destinationRoot + "/src/main/java"
// package for api invoker, error files
override def invokerPackage = Some("com.wordnik.client.common")
// package for models
override def modelPackage = Some("com.wordnik.client.model")
// package for api classes
override def apiPackage = Some("com.wordnik.client.api")
additionalParams ++= Map(
"artifactId" -> "wordnik-java-client",
"artifactVersion" -> "1.0.0",
"groupId" -> "com.wordnik")
// supporting classes
override def supportingFiles =
List(
("apiInvoker.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "ApiInvoker.java"),
("JsonUtil.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "JsonUtil.java"),
("apiException.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "ApiException.java"),
("pom.mustache", destinationRoot, "pom.xml"))
}

View File

@ -1,72 +0,0 @@
# Wordnik Java client library
## Overview
This is a full client library for the Wordnik API. It requires that you have a valid Wordnik API Key--you
can get one for free at http://developer.wordnik.com.
This library is built using the Wordnik [Swagger](http://swagger.wordnik.com) client library generator. You
can re-generate this library by running ./bin/java-wordnik-api.sh from the swagger-codegen project
## Usage
You can use maven central to add this library to your current project:
```xml
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>wordnik-java-client</artifactId>
<version>1.0.0</version>
</dependency>
```
or you can pull the source and re-generate the client library with Maven:
```
mvn package
```
Add the library to your project and you're ready to go:
```java
import com.wordnik.client.api.*;
import com.wordnik.client.model.*;
import com.wordnik.client.common.ApiException;
import java.util.List;
public class Test {
public static void main(String[] args) {
if(args.length == 0) {
System.out.println("Pass your API key as an argument");
System.exit(0);
}
String key = args[0];
try {
WordApi api = new WordApi();
api.getInvoker().addDefaultHeader("api_key", key);
List<Definition> definitions = api.getDefinitions(
"Cat", // word
"noun", // only get definitions which are "nouns"
"wiktionary", // use wiktionary
3, // fetch only 3 results max
"true", // return related words
"true", // fetch the canonical version of this word (Cat => cat)
"false" // return XML mark-up in response
);
for(Definition def : definitions) {
System.out.print(def);
}
}
catch (ApiException e) {
e.printStackTrace();
}
}
}
```
This project was built with the following minimum requirements:
* Maven 3.0
* Java JDK 6

View File

@ -1,226 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.wordnik</groupId>
<artifactId>wordnik-java-client</artifactId>
<packaging>jar</packaging>
<name>wordnik-java-client</name>
<version>1.0.0</version>
<scm>
<connection>scm:git:git@github.com:wordnik/swagger-mustache.git</connection>
<developerConnection>scm:git:git@github.com:wordnik/swagger-codegen.git</developerConnection>
<url>https://github.com/wordnik/swagger-codegen</url>
</scm>
<prerequisites>
<maven>2.2.0</maven>
</prerequisites>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<systemProperties>
<property>
<name>loggerPath</name>
<value>conf/log4j.properties</value>
</property>
</systemProperties>
<argLine>-Xms512m -Xmx1500m</argLine>
<parallel>methods</parallel>
<forkMode>pertest</forkMode>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- attach test jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add_sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add_test_sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin-version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<configuration>
<recompileMode>incremental</recompileMode>
</configuration>
<jvmArgs>
<jvmArg>-Xmx384m</jvmArg>
</jvmArgs>
<args>
<arg>-target:jvm-1.5</arg>
<arg>-deprecation</arg>
</args>
<launchers>
<launcher>
<id>run-scalatest</id>
<mainClass>org.scalatest.tools.Runner</mainClass>
<args>
<arg>-p</arg>
<arg>${project.build.testOutputDirectory}</arg>
</args>
<jvmArgs>
<jvmArg>-Xmx512m</jvmArg>
</jvmArgs>
</launcher>
</launchers>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin-version}</version>
</plugin>
</plugins>
</reporting>
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>2.1.5</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${jodatime-version}</version>
<scope>compile</scope>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.9.1</artifactId>
<version>${scala-test-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<jersey-version>1.7</jersey-version>
<jackson-version>2.1.4</jackson-version>
<jodatime-version>2.3</jodatime-version>
<scala-version>2.9.1-1</scala-version>
<junit-version>4.8.1</junit-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.8.1</junit-version>
<scala-test-version>1.6.1</scala-test-version>
<scala-maven-plugin-version>3.1.5</scala-maven-plugin-version>
</properties>
</project>

View File

@ -1,210 +0,0 @@
package com.wordnik.client.api;
import com.wordnik.client.common.ApiException;
import com.wordnik.client.common.ApiInvoker;
import com.wordnik.client.model.User;
import com.wordnik.client.model.WordList;
import com.wordnik.client.model.ApiTokenStatus;
import com.wordnik.client.model.AuthenticationToken;
import java.io.File;
import java.util.*;
public class AccountApi {
String basePath = "http://api.wordnik.com/v4";
ApiInvoker apiInvoker = ApiInvoker.getInstance();
public ApiInvoker getInvoker() {
return apiInvoker;
}
public void setBasePath(String basePath) {
this.basePath = basePath;
}
public String getBasePath() {
return basePath;
}
public AuthenticationToken authenticate (String username, String password) throws ApiException {
// verify required params are set
if(username == null || password == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/account.{format}/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(password)))
queryParams.put("password", String.valueOf(password));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (AuthenticationToken) ApiInvoker.deserialize(response, "", AuthenticationToken.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public AuthenticationToken authenticatePost (String username, String body) throws ApiException {
// verify required params are set
if(username == null || body == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/account.{format}/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, formParams, contentType);
if(response != null){
return (AuthenticationToken) ApiInvoker.deserialize(response, "", AuthenticationToken.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<WordList> getWordListsForLoggedInUser (String auth_token, Integer skip, Integer limit) throws ApiException {
// verify required params are set
if(auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/account.{format}/wordLists".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(skip)))
queryParams.put("skip", String.valueOf(skip));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
headerParams.put("auth_token", auth_token);
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (List<WordList>) ApiInvoker.deserialize(response, "List", WordList.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public ApiTokenStatus getApiTokenStatus (String api_key) throws ApiException {
// create path and map variables
String path = "/account.{format}/apiTokenStatus".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
headerParams.put("api_key", api_key);
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (ApiTokenStatus) ApiInvoker.deserialize(response, "", ApiTokenStatus.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public User getLoggedInUser (String auth_token) throws ApiException {
// verify required params are set
if(auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/account.{format}/user".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
headerParams.put("auth_token", auth_token);
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (User) ApiInvoker.deserialize(response, "", User.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
}

View File

@ -1,521 +0,0 @@
package com.wordnik.client.api;
import com.wordnik.client.common.ApiException;
import com.wordnik.client.common.ApiInvoker;
import com.wordnik.client.model.FrequencySummary;
import com.wordnik.client.model.Bigram;
import com.wordnik.client.model.WordObject;
import com.wordnik.client.model.ExampleSearchResults;
import com.wordnik.client.model.Example;
import com.wordnik.client.model.ScrabbleScoreResult;
import com.wordnik.client.model.TextPron;
import com.wordnik.client.model.Syllable;
import com.wordnik.client.model.Related;
import com.wordnik.client.model.Definition;
import com.wordnik.client.model.AudioFile;
import java.io.File;
import java.util.*;
public class WordApi {
String basePath = "http://api.wordnik.com/v4";
ApiInvoker apiInvoker = ApiInvoker.getInstance();
public ApiInvoker getInvoker() {
return apiInvoker;
}
public void setBasePath(String basePath) {
this.basePath = basePath;
}
public String getBasePath() {
return basePath;
}
public ExampleSearchResults getExamples (String word, String includeDuplicates, String useCanonical, Integer skip, Integer limit) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/examples".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(includeDuplicates)))
queryParams.put("includeDuplicates", String.valueOf(includeDuplicates));
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(skip)))
queryParams.put("skip", String.valueOf(skip));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (ExampleSearchResults) ApiInvoker.deserialize(response, "", ExampleSearchResults.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public WordObject getWord (String word, String useCanonical, String includeSuggestions) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(includeSuggestions)))
queryParams.put("includeSuggestions", String.valueOf(includeSuggestions));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (WordObject) ApiInvoker.deserialize(response, "", WordObject.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<Definition> getDefinitions (String word, String partOfSpeech, String sourceDictionaries, Integer limit, String includeRelated, String useCanonical, String includeTags) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/definitions".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
if(!"null".equals(String.valueOf(partOfSpeech)))
queryParams.put("partOfSpeech", String.valueOf(partOfSpeech));
if(!"null".equals(String.valueOf(includeRelated)))
queryParams.put("includeRelated", String.valueOf(includeRelated));
if(!"null".equals(String.valueOf(sourceDictionaries)))
queryParams.put("sourceDictionaries", String.valueOf(sourceDictionaries));
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(includeTags)))
queryParams.put("includeTags", String.valueOf(includeTags));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (List<Definition>) ApiInvoker.deserialize(response, "List", Definition.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public Example getTopExample (String word, String useCanonical) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/topExample".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (Example) ApiInvoker.deserialize(response, "", Example.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<Related> getRelatedWords (String word, String relationshipTypes, String useCanonical, Integer limitPerRelationshipType) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/relatedWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(relationshipTypes)))
queryParams.put("relationshipTypes", String.valueOf(relationshipTypes));
if(!"null".equals(String.valueOf(limitPerRelationshipType)))
queryParams.put("limitPerRelationshipType", String.valueOf(limitPerRelationshipType));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (List<Related>) ApiInvoker.deserialize(response, "List", Related.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<TextPron> getTextPronunciations (String word, String sourceDictionary, String typeFormat, String useCanonical, Integer limit) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/pronunciations".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(sourceDictionary)))
queryParams.put("sourceDictionary", String.valueOf(sourceDictionary));
if(!"null".equals(String.valueOf(typeFormat)))
queryParams.put("typeFormat", String.valueOf(typeFormat));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (List<TextPron>) ApiInvoker.deserialize(response, "List", TextPron.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<Syllable> getHyphenation (String word, String sourceDictionary, String useCanonical, Integer limit) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/hyphenation".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(sourceDictionary)))
queryParams.put("sourceDictionary", String.valueOf(sourceDictionary));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (List<Syllable>) ApiInvoker.deserialize(response, "List", Syllable.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public FrequencySummary getWordFrequency (String word, String useCanonical, Integer startYear, Integer endYear) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/frequency".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(startYear)))
queryParams.put("startYear", String.valueOf(startYear));
if(!"null".equals(String.valueOf(endYear)))
queryParams.put("endYear", String.valueOf(endYear));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (FrequencySummary) ApiInvoker.deserialize(response, "", FrequencySummary.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<Bigram> getPhrases (String word, Integer limit, Integer wlmi, String useCanonical) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/phrases".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
if(!"null".equals(String.valueOf(wlmi)))
queryParams.put("wlmi", String.valueOf(wlmi));
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (List<Bigram>) ApiInvoker.deserialize(response, "List", Bigram.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<String> getEtymologies (String word, String useCanonical) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/etymologies".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (List<String>) ApiInvoker.deserialize(response, "List", String.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<AudioFile> getAudio (String word, String useCanonical, Integer limit) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/audio".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (List<AudioFile>) ApiInvoker.deserialize(response, "List", AudioFile.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public ScrabbleScoreResult getScrabbleScore (String word) throws ApiException {
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/word.{format}/{word}/scrabbleScore".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (ScrabbleScoreResult) ApiInvoker.deserialize(response, "", ScrabbleScoreResult.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
}

View File

@ -1,253 +0,0 @@
package com.wordnik.client.api;
import com.wordnik.client.common.ApiException;
import com.wordnik.client.common.ApiInvoker;
import com.wordnik.client.model.WordListWord;
import com.wordnik.client.model.WordList;
import com.wordnik.client.model.StringValue;
import java.io.File;
import java.util.*;
public class WordListApi {
String basePath = "http://api.wordnik.com/v4";
ApiInvoker apiInvoker = ApiInvoker.getInstance();
public ApiInvoker getInvoker() {
return apiInvoker;
}
public void setBasePath(String basePath) {
this.basePath = basePath;
}
public String getBasePath() {
return basePath;
}
public void updateWordList (String permalink, WordList body, String auth_token) throws ApiException {
// verify required params are set
if(permalink == null || auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
headerParams.put("auth_token", auth_token);
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams, formParams, contentType);
if(response != null){
return ;
}
else {
return ;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return ;
}
else {
throw ex;
}
}
}
public void deleteWordList (String permalink, String auth_token) throws ApiException {
// verify required params are set
if(permalink == null || auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
headerParams.put("auth_token", auth_token);
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return ;
}
else {
return ;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return ;
}
else {
throw ex;
}
}
}
public WordList getWordListByPermalink (String permalink, String auth_token) throws ApiException {
// verify required params are set
if(permalink == null || auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
headerParams.put("auth_token", auth_token);
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (WordList) ApiInvoker.deserialize(response, "", WordList.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public void addWordsToWordList (String permalink, List<StringValue> body, String auth_token) throws ApiException {
// verify required params are set
if(permalink == null || auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/wordList.{format}/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
headerParams.put("auth_token", auth_token);
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, formParams, contentType);
if(response != null){
return ;
}
else {
return ;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return ;
}
else {
throw ex;
}
}
}
public List<WordListWord> getWordListWords (String permalink, String auth_token, String sortBy, String sortOrder, Integer skip, Integer limit) throws ApiException {
// verify required params are set
if(permalink == null || auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/wordList.{format}/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(sortBy)))
queryParams.put("sortBy", String.valueOf(sortBy));
if(!"null".equals(String.valueOf(sortOrder)))
queryParams.put("sortOrder", String.valueOf(sortOrder));
if(!"null".equals(String.valueOf(skip)))
queryParams.put("skip", String.valueOf(skip));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
headerParams.put("auth_token", auth_token);
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (List<WordListWord>) ApiInvoker.deserialize(response, "List", WordListWord.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public void deleteWordsFromWordList (String permalink, List<StringValue> body, String auth_token) throws ApiException {
// verify required params are set
if(permalink == null || auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/wordList.{format}/{permalink}/deleteWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
headerParams.put("auth_token", auth_token);
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, formParams, contentType);
if(response != null){
return ;
}
else {
return ;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return ;
}
else {
throw ex;
}
}
}
}

View File

@ -1,63 +0,0 @@
package com.wordnik.client.api;
import com.wordnik.client.common.ApiException;
import com.wordnik.client.common.ApiInvoker;
import com.wordnik.client.model.WordList;
import java.io.File;
import java.util.*;
public class WordListsApi {
String basePath = "http://api.wordnik.com/v4";
ApiInvoker apiInvoker = ApiInvoker.getInstance();
public ApiInvoker getInvoker() {
return apiInvoker;
}
public void setBasePath(String basePath) {
this.basePath = basePath;
}
public String getBasePath() {
return basePath;
}
public WordList createWordList (WordList body, String auth_token) throws ApiException {
// verify required params are set
if(auth_token == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/wordLists.{format}".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
headerParams.put("auth_token", auth_token);
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, formParams, contentType);
if(response != null){
return (WordList) ApiInvoker.deserialize(response, "", WordList.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
}

View File

@ -1,291 +0,0 @@
package com.wordnik.client.api;
import com.wordnik.client.common.ApiException;
import com.wordnik.client.common.ApiInvoker;
import com.wordnik.client.model.DefinitionSearchResults;
import com.wordnik.client.model.WordObject;
import com.wordnik.client.model.WordOfTheDay;
import com.wordnik.client.model.WordSearchResults;
import java.io.File;
import java.util.*;
public class WordsApi {
String basePath = "http://api.wordnik.com/v4";
ApiInvoker apiInvoker = ApiInvoker.getInstance();
public ApiInvoker getInvoker() {
return apiInvoker;
}
public void setBasePath(String basePath) {
this.basePath = basePath;
}
public String getBasePath() {
return basePath;
}
public WordSearchResults searchWords (String query, String includePartOfSpeech, String excludePartOfSpeech, String caseSensitive, Integer minCorpusCount, Integer maxCorpusCount, Integer minDictionaryCount, Integer maxDictionaryCount, Integer minLength, Integer maxLength, Integer skip, Integer limit) throws ApiException {
// verify required params are set
if(query == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/words.{format}/search/{query}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "query" + "\\}", apiInvoker.escapeString(query.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(caseSensitive)))
queryParams.put("caseSensitive", String.valueOf(caseSensitive));
if(!"null".equals(String.valueOf(includePartOfSpeech)))
queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech));
if(!"null".equals(String.valueOf(excludePartOfSpeech)))
queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech));
if(!"null".equals(String.valueOf(minCorpusCount)))
queryParams.put("minCorpusCount", String.valueOf(minCorpusCount));
if(!"null".equals(String.valueOf(maxCorpusCount)))
queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount));
if(!"null".equals(String.valueOf(minDictionaryCount)))
queryParams.put("minDictionaryCount", String.valueOf(minDictionaryCount));
if(!"null".equals(String.valueOf(maxDictionaryCount)))
queryParams.put("maxDictionaryCount", String.valueOf(maxDictionaryCount));
if(!"null".equals(String.valueOf(minLength)))
queryParams.put("minLength", String.valueOf(minLength));
if(!"null".equals(String.valueOf(maxLength)))
queryParams.put("maxLength", String.valueOf(maxLength));
if(!"null".equals(String.valueOf(skip)))
queryParams.put("skip", String.valueOf(skip));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (WordSearchResults) ApiInvoker.deserialize(response, "", WordSearchResults.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public WordOfTheDay getWordOfTheDay (String date) throws ApiException {
// create path and map variables
String path = "/words.{format}/wordOfTheDay".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(date)))
queryParams.put("date", String.valueOf(date));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (WordOfTheDay) ApiInvoker.deserialize(response, "", WordOfTheDay.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public DefinitionSearchResults reverseDictionary (String query, String findSenseForWord, String includeSourceDictionaries, String excludeSourceDictionaries, String includePartOfSpeech, String excludePartOfSpeech, String expandTerms, String sortBy, String sortOrder, Integer minCorpusCount, Integer maxCorpusCount, Integer minLength, Integer maxLength, String includeTags, String skip, Integer limit) throws ApiException {
// verify required params are set
if(query == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/words.{format}/reverseDictionary".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(query)))
queryParams.put("query", String.valueOf(query));
if(!"null".equals(String.valueOf(findSenseForWord)))
queryParams.put("findSenseForWord", String.valueOf(findSenseForWord));
if(!"null".equals(String.valueOf(includeSourceDictionaries)))
queryParams.put("includeSourceDictionaries", String.valueOf(includeSourceDictionaries));
if(!"null".equals(String.valueOf(excludeSourceDictionaries)))
queryParams.put("excludeSourceDictionaries", String.valueOf(excludeSourceDictionaries));
if(!"null".equals(String.valueOf(includePartOfSpeech)))
queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech));
if(!"null".equals(String.valueOf(excludePartOfSpeech)))
queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech));
if(!"null".equals(String.valueOf(minCorpusCount)))
queryParams.put("minCorpusCount", String.valueOf(minCorpusCount));
if(!"null".equals(String.valueOf(maxCorpusCount)))
queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount));
if(!"null".equals(String.valueOf(minLength)))
queryParams.put("minLength", String.valueOf(minLength));
if(!"null".equals(String.valueOf(maxLength)))
queryParams.put("maxLength", String.valueOf(maxLength));
if(!"null".equals(String.valueOf(expandTerms)))
queryParams.put("expandTerms", String.valueOf(expandTerms));
if(!"null".equals(String.valueOf(includeTags)))
queryParams.put("includeTags", String.valueOf(includeTags));
if(!"null".equals(String.valueOf(sortBy)))
queryParams.put("sortBy", String.valueOf(sortBy));
if(!"null".equals(String.valueOf(sortOrder)))
queryParams.put("sortOrder", String.valueOf(sortOrder));
if(!"null".equals(String.valueOf(skip)))
queryParams.put("skip", String.valueOf(skip));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (DefinitionSearchResults) ApiInvoker.deserialize(response, "", DefinitionSearchResults.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public List<WordObject> getRandomWords (String includePartOfSpeech, String excludePartOfSpeech, String sortBy, String sortOrder, String hasDictionaryDef, Integer minCorpusCount, Integer maxCorpusCount, Integer minDictionaryCount, Integer maxDictionaryCount, Integer minLength, Integer maxLength, Integer limit) throws ApiException {
// create path and map variables
String path = "/words.{format}/randomWords".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(hasDictionaryDef)))
queryParams.put("hasDictionaryDef", String.valueOf(hasDictionaryDef));
if(!"null".equals(String.valueOf(includePartOfSpeech)))
queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech));
if(!"null".equals(String.valueOf(excludePartOfSpeech)))
queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech));
if(!"null".equals(String.valueOf(minCorpusCount)))
queryParams.put("minCorpusCount", String.valueOf(minCorpusCount));
if(!"null".equals(String.valueOf(maxCorpusCount)))
queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount));
if(!"null".equals(String.valueOf(minDictionaryCount)))
queryParams.put("minDictionaryCount", String.valueOf(minDictionaryCount));
if(!"null".equals(String.valueOf(maxDictionaryCount)))
queryParams.put("maxDictionaryCount", String.valueOf(maxDictionaryCount));
if(!"null".equals(String.valueOf(minLength)))
queryParams.put("minLength", String.valueOf(minLength));
if(!"null".equals(String.valueOf(maxLength)))
queryParams.put("maxLength", String.valueOf(maxLength));
if(!"null".equals(String.valueOf(sortBy)))
queryParams.put("sortBy", String.valueOf(sortBy));
if(!"null".equals(String.valueOf(sortOrder)))
queryParams.put("sortOrder", String.valueOf(sortOrder));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (List<WordObject>) ApiInvoker.deserialize(response, "List", WordObject.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public WordObject getRandomWord (String includePartOfSpeech, String excludePartOfSpeech, String hasDictionaryDef, Integer minCorpusCount, Integer maxCorpusCount, Integer minDictionaryCount, Integer maxDictionaryCount, Integer minLength, Integer maxLength) throws ApiException {
// create path and map variables
String path = "/words.{format}/randomWord".replaceAll("\\{format\\}","json");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(!"null".equals(String.valueOf(hasDictionaryDef)))
queryParams.put("hasDictionaryDef", String.valueOf(hasDictionaryDef));
if(!"null".equals(String.valueOf(includePartOfSpeech)))
queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech));
if(!"null".equals(String.valueOf(excludePartOfSpeech)))
queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech));
if(!"null".equals(String.valueOf(minCorpusCount)))
queryParams.put("minCorpusCount", String.valueOf(minCorpusCount));
if(!"null".equals(String.valueOf(maxCorpusCount)))
queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount));
if(!"null".equals(String.valueOf(minDictionaryCount)))
queryParams.put("minDictionaryCount", String.valueOf(minDictionaryCount));
if(!"null".equals(String.valueOf(maxDictionaryCount)))
queryParams.put("maxDictionaryCount", String.valueOf(maxDictionaryCount));
if(!"null".equals(String.valueOf(minLength)))
queryParams.put("minLength", String.valueOf(minLength));
if(!"null".equals(String.valueOf(maxLength)))
queryParams.put("maxLength", String.valueOf(maxLength));
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
if(response != null){
return (WordObject) ApiInvoker.deserialize(response, "", WordObject.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
}

View File

@ -1,29 +0,0 @@
package com.wordnik.client.common;
public class ApiException extends Exception {
int code = 0;
String message = null;
public ApiException() {}
public ApiException(int code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}

View File

@ -1,184 +0,0 @@
package com.wordnik.client.common;
import com.fasterxml.jackson.core.JsonGenerator.Feature;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.client.filter.LoggingFilter;
import com.sun.jersey.api.client.WebResource.Builder;
import javax.ws.rs.core.Response.Status.Family;
import javax.ws.rs.core.MediaType;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.io.IOException;
import java.net.URLEncoder;
import java.io.UnsupportedEncodingException;
public class ApiInvoker {
private static ApiInvoker INSTANCE = new ApiInvoker();
private Map<String, Client> hostMap = new HashMap<String, Client>();
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private boolean isDebug = false;
public void enableDebug() {
isDebug = true;
}
public static ApiInvoker getInstance() {
return INSTANCE;
}
public void addDefaultHeader(String key, String value) {
defaultHeaderMap.put(key, value);
}
public String escapeString(String str) {
try{
return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20");
}
catch(UnsupportedEncodingException e) {
return str;
}
}
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {
try{
if("List".equals(containerType)) {
JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructCollectionType(List.class, cls);
List response = (List<?>) JsonUtil.getJsonMapper().readValue(json, typeInfo);
return response;
}
else if(String.class.equals(cls)) {
if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1)
return json.substring(1, json.length() - 2);
else
return json;
}
else {
return JsonUtil.getJsonMapper().readValue(json, cls);
}
}
catch (IOException e) {
throw new ApiException(500, e.getMessage());
}
}
public static String serialize(Object obj) throws ApiException {
try {
if (obj != null)
return JsonUtil.getJsonMapper().writeValueAsString(obj);
else
return null;
}
catch (Exception e) {
throw new ApiException(500, e.getMessage());
}
}
public String invokeAPI(String host, String path, String method, Map<String, String> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String contentType) throws ApiException {
Client client = getClient(host);
StringBuilder b = new StringBuilder();
for(String key : queryParams.keySet()) {
String value = queryParams.get(key);
if (value != null){
if(b.toString().length() == 0)
b.append("?");
else
b.append("&");
b.append(escapeString(key)).append("=").append(escapeString(value));
}
}
String querystring = b.toString();
Builder builder = client.resource(host + path + querystring).accept("application/json");
for(String key : headerParams.keySet()) {
builder.header(key, headerParams.get(key));
}
for(String key : defaultHeaderMap.keySet()) {
if(!headerParams.containsKey(key)) {
builder.header(key, defaultHeaderMap.get(key));
}
}
ClientResponse response = null;
if("GET".equals(method)) {
response = (ClientResponse) builder.get(ClientResponse.class);
}
else if ("POST".equals(method)) {
if(body == null)
response = builder.post(ClientResponse.class, serialize(body));
else
response = builder.type(contentType).post(ClientResponse.class, serialize(body));
}
else if ("PUT".equals(method)) {
if(body == null)
response = builder.put(ClientResponse.class, serialize(body));
else {
if("application/x-www-form-urlencoded".equals(contentType)) {
StringBuilder formParamBuilder = new StringBuilder();
// encode the form params
for(String key : formParams.keySet()) {
String value = formParams.get(key);
if(value != null && !"".equals(value.trim())) {
if(formParamBuilder.length() > 0) {
formParamBuilder.append("&");
}
try {
formParamBuilder.append(URLEncoder.encode(key, "utf8")).append("=").append(URLEncoder.encode(value, "utf8"));
}
catch (Exception e) {
// move on to next
}
}
}
response = builder.type(contentType).put(ClientResponse.class, formParamBuilder.toString());
}
else
response = builder.type(contentType).put(ClientResponse.class, serialize(body));
}
}
else if ("DELETE".equals(method)) {
if(body == null)
response = builder.delete(ClientResponse.class, serialize(body));
else
response = builder.type(contentType).delete(ClientResponse.class, serialize(body));
}
else {
throw new ApiException(500, "unknown method type " + method);
}
if(response.getClientResponseStatus() == ClientResponse.Status.NO_CONTENT) {
return null;
}
else if(response.getClientResponseStatus().getFamily() == Family.SUCCESSFUL) {
return (String) response.getEntity(String.class);
}
else {
throw new ApiException(
response.getClientResponseStatus().getStatusCode(),
response.getEntity(String.class));
}
}
private Client getClient(String host) {
if(!hostMap.containsKey(host)) {
Client client = Client.create();
if(isDebug)
client.addFilter(new LoggingFilter());
hostMap.put(host, client);
}
return hostMap.get(host);
}
}

View File

@ -1,24 +0,0 @@
package com.wordnik.client.common;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.core.JsonGenerator.Feature;
import com.fasterxml.jackson.datatype.joda.*;
public class JsonUtil {
public static ObjectMapper mapper;
static {
mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
mapper.registerModule(new JodaModule());
}
public static ObjectMapper getJsonMapper() {
return mapper;
}
}

View File

@ -1,66 +0,0 @@
package com.wordnik.client.model;
public class ApiTokenStatus {
private Boolean valid = null;
private String token = null;
private Long resetsInMillis = null;
private Long remainingCalls = null;
private Long expiresInMillis = null;
private Long totalRequests = null;
public Boolean getValid() {
return valid;
}
public void setValid(Boolean valid) {
this.valid = valid;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public Long getResetsInMillis() {
return resetsInMillis;
}
public void setResetsInMillis(Long resetsInMillis) {
this.resetsInMillis = resetsInMillis;
}
public Long getRemainingCalls() {
return remainingCalls;
}
public void setRemainingCalls(Long remainingCalls) {
this.remainingCalls = remainingCalls;
}
public Long getExpiresInMillis() {
return expiresInMillis;
}
public void setExpiresInMillis(Long expiresInMillis) {
this.expiresInMillis = expiresInMillis;
}
public Long getTotalRequests() {
return totalRequests;
}
public void setTotalRequests(Long totalRequests) {
this.totalRequests = totalRequests;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ApiTokenStatus {\n");
sb.append(" valid: ").append(valid).append("\n");
sb.append(" token: ").append(token).append("\n");
sb.append(" resetsInMillis: ").append(resetsInMillis).append("\n");
sb.append(" remainingCalls: ").append(remainingCalls).append("\n");
sb.append(" expiresInMillis: ").append(expiresInMillis).append("\n");
sb.append(" totalRequests: ").append(totalRequests).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,139 +0,0 @@
package com.wordnik.client.model;
import java.util.Date;
public class AudioFile {
private String attributionUrl = null;
private Integer commentCount = null;
private Integer voteCount = null;
private String fileUrl = null;
private String audioType = null;
private Long id = null;
private Double duration = null;
private String attributionText = null;
private String createdBy = null;
private String description = null;
private Date createdAt = null;
private Float voteWeightedAverage = null;
private Float voteAverage = null;
private String word = null;
public String getAttributionUrl() {
return attributionUrl;
}
public void setAttributionUrl(String attributionUrl) {
this.attributionUrl = attributionUrl;
}
public Integer getCommentCount() {
return commentCount;
}
public void setCommentCount(Integer commentCount) {
this.commentCount = commentCount;
}
public Integer getVoteCount() {
return voteCount;
}
public void setVoteCount(Integer voteCount) {
this.voteCount = voteCount;
}
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
public String getAudioType() {
return audioType;
}
public void setAudioType(String audioType) {
this.audioType = audioType;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Double getDuration() {
return duration;
}
public void setDuration(Double duration) {
this.duration = duration;
}
public String getAttributionText() {
return attributionText;
}
public void setAttributionText(String attributionText) {
this.attributionText = attributionText;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Float getVoteWeightedAverage() {
return voteWeightedAverage;
}
public void setVoteWeightedAverage(Float voteWeightedAverage) {
this.voteWeightedAverage = voteWeightedAverage;
}
public Float getVoteAverage() {
return voteAverage;
}
public void setVoteAverage(Float voteAverage) {
this.voteAverage = voteAverage;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AudioFile {\n");
sb.append(" attributionUrl: ").append(attributionUrl).append("\n");
sb.append(" commentCount: ").append(commentCount).append("\n");
sb.append(" voteCount: ").append(voteCount).append("\n");
sb.append(" fileUrl: ").append(fileUrl).append("\n");
sb.append(" audioType: ").append(audioType).append("\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" duration: ").append(duration).append("\n");
sb.append(" attributionText: ").append(attributionText).append("\n");
sb.append(" createdBy: ").append(createdBy).append("\n");
sb.append(" description: ").append(description).append("\n");
sb.append(" createdAt: ").append(createdAt).append("\n");
sb.append(" voteWeightedAverage: ").append(voteWeightedAverage).append("\n");
sb.append(" voteAverage: ").append(voteAverage).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,39 +0,0 @@
package com.wordnik.client.model;
public class AuthenticationToken {
private String token = null;
private Long userId = null;
private String userSignature = null;
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUserSignature() {
return userSignature;
}
public void setUserSignature(String userSignature) {
this.userSignature = userSignature;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AuthenticationToken {\n");
sb.append(" token: ").append(token).append("\n");
sb.append(" userId: ").append(userId).append("\n");
sb.append(" userSignature: ").append(userSignature).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,57 +0,0 @@
package com.wordnik.client.model;
public class Bigram {
private Long count = null;
private String gram2 = null;
private String gram1 = null;
private Double wlmi = null;
private Double mi = null;
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public String getGram2() {
return gram2;
}
public void setGram2(String gram2) {
this.gram2 = gram2;
}
public String getGram1() {
return gram1;
}
public void setGram1(String gram1) {
this.gram1 = gram1;
}
public Double getWlmi() {
return wlmi;
}
public void setWlmi(Double wlmi) {
this.wlmi = wlmi;
}
public Double getMi() {
return mi;
}
public void setMi(Double mi) {
this.mi = mi;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Bigram {\n");
sb.append(" count: ").append(count).append("\n");
sb.append(" gram2: ").append(gram2).append("\n");
sb.append(" gram1: ").append(gram1).append("\n");
sb.append(" wlmi: ").append(wlmi).append("\n");
sb.append(" mi: ").append(mi).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,30 +0,0 @@
package com.wordnik.client.model;
public class Citation {
private String cite = null;
private String source = null;
public String getCite() {
return cite;
}
public void setCite(String cite) {
this.cite = cite;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Citation {\n");
sb.append(" cite: ").append(cite).append("\n");
sb.append(" source: ").append(source).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,30 +0,0 @@
package com.wordnik.client.model;
public class ContentProvider {
private Integer id = null;
private String name = null;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ContentProvider {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" name: ").append(name).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,163 +0,0 @@
package com.wordnik.client.model;
import java.util.*;
import com.wordnik.client.model.Label;
import com.wordnik.client.model.ExampleUsage;
import com.wordnik.client.model.TextPron;
import com.wordnik.client.model.Citation;
import com.wordnik.client.model.Related;
import com.wordnik.client.model.Note;
public class Definition {
private String extendedText = null;
private String text = null;
private String sourceDictionary = null;
private List<Citation> citations = new ArrayList<Citation>();
private List<Label> labels = new ArrayList<Label>();
private Float score = null;
private List<ExampleUsage> exampleUses = new ArrayList<ExampleUsage>();
private String attributionUrl = null;
private String seqString = null;
private String attributionText = null;
private List<Related> relatedWords = new ArrayList<Related>();
private String sequence = null;
private String word = null;
private List<Note> notes = new ArrayList<Note>();
private List<TextPron> textProns = new ArrayList<TextPron>();
private String partOfSpeech = null;
public String getExtendedText() {
return extendedText;
}
public void setExtendedText(String extendedText) {
this.extendedText = extendedText;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getSourceDictionary() {
return sourceDictionary;
}
public void setSourceDictionary(String sourceDictionary) {
this.sourceDictionary = sourceDictionary;
}
public List<Citation> getCitations() {
return citations;
}
public void setCitations(List<Citation> citations) {
this.citations = citations;
}
public List<Label> getLabels() {
return labels;
}
public void setLabels(List<Label> labels) {
this.labels = labels;
}
public Float getScore() {
return score;
}
public void setScore(Float score) {
this.score = score;
}
public List<ExampleUsage> getExampleUses() {
return exampleUses;
}
public void setExampleUses(List<ExampleUsage> exampleUses) {
this.exampleUses = exampleUses;
}
public String getAttributionUrl() {
return attributionUrl;
}
public void setAttributionUrl(String attributionUrl) {
this.attributionUrl = attributionUrl;
}
public String getSeqString() {
return seqString;
}
public void setSeqString(String seqString) {
this.seqString = seqString;
}
public String getAttributionText() {
return attributionText;
}
public void setAttributionText(String attributionText) {
this.attributionText = attributionText;
}
public List<Related> getRelatedWords() {
return relatedWords;
}
public void setRelatedWords(List<Related> relatedWords) {
this.relatedWords = relatedWords;
}
public String getSequence() {
return sequence;
}
public void setSequence(String sequence) {
this.sequence = sequence;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public List<Note> getNotes() {
return notes;
}
public void setNotes(List<Note> notes) {
this.notes = notes;
}
public List<TextPron> getTextProns() {
return textProns;
}
public void setTextProns(List<TextPron> textProns) {
this.textProns = textProns;
}
public String getPartOfSpeech() {
return partOfSpeech;
}
public void setPartOfSpeech(String partOfSpeech) {
this.partOfSpeech = partOfSpeech;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Definition {\n");
sb.append(" extendedText: ").append(extendedText).append("\n");
sb.append(" text: ").append(text).append("\n");
sb.append(" sourceDictionary: ").append(sourceDictionary).append("\n");
sb.append(" citations: ").append(citations).append("\n");
sb.append(" labels: ").append(labels).append("\n");
sb.append(" score: ").append(score).append("\n");
sb.append(" exampleUses: ").append(exampleUses).append("\n");
sb.append(" attributionUrl: ").append(attributionUrl).append("\n");
sb.append(" seqString: ").append(seqString).append("\n");
sb.append(" attributionText: ").append(attributionText).append("\n");
sb.append(" relatedWords: ").append(relatedWords).append("\n");
sb.append(" sequence: ").append(sequence).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append(" notes: ").append(notes).append("\n");
sb.append(" textProns: ").append(textProns).append("\n");
sb.append(" partOfSpeech: ").append(partOfSpeech).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,32 +0,0 @@
package com.wordnik.client.model;
import java.util.*;
import com.wordnik.client.model.Definition;
public class DefinitionSearchResults {
private List<Definition> results = new ArrayList<Definition>();
private Integer totalResults = null;
public List<Definition> getResults() {
return results;
}
public void setResults(List<Definition> results) {
this.results = results;
}
public Integer getTotalResults() {
return totalResults;
}
public void setTotalResults(Integer totalResults) {
this.totalResults = totalResults;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DefinitionSearchResults {\n");
sb.append(" results: ").append(results).append("\n");
sb.append(" totalResults: ").append(totalResults).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,123 +0,0 @@
package com.wordnik.client.model;
import com.wordnik.client.model.Sentence;
import com.wordnik.client.model.ContentProvider;
import com.wordnik.client.model.ScoredWord;
public class Example {
private Long id = null;
private Long exampleId = null;
private String title = null;
private String text = null;
private ScoredWord score = null;
private Sentence sentence = null;
private String word = null;
private ContentProvider provider = null;
private Integer year = null;
private Float rating = null;
private Long documentId = null;
private String url = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getExampleId() {
return exampleId;
}
public void setExampleId(Long exampleId) {
this.exampleId = exampleId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public ScoredWord getScore() {
return score;
}
public void setScore(ScoredWord score) {
this.score = score;
}
public Sentence getSentence() {
return sentence;
}
public void setSentence(Sentence sentence) {
this.sentence = sentence;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public ContentProvider getProvider() {
return provider;
}
public void setProvider(ContentProvider provider) {
this.provider = provider;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
public Float getRating() {
return rating;
}
public void setRating(Float rating) {
this.rating = rating;
}
public Long getDocumentId() {
return documentId;
}
public void setDocumentId(Long documentId) {
this.documentId = documentId;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Example {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" exampleId: ").append(exampleId).append("\n");
sb.append(" title: ").append(title).append("\n");
sb.append(" text: ").append(text).append("\n");
sb.append(" score: ").append(score).append("\n");
sb.append(" sentence: ").append(sentence).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append(" provider: ").append(provider).append("\n");
sb.append(" year: ").append(year).append("\n");
sb.append(" rating: ").append(rating).append("\n");
sb.append(" documentId: ").append(documentId).append("\n");
sb.append(" url: ").append(url).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,33 +0,0 @@
package com.wordnik.client.model;
import java.util.*;
import com.wordnik.client.model.Facet;
import com.wordnik.client.model.Example;
public class ExampleSearchResults {
private List<Facet> facets = new ArrayList<Facet>();
private List<Example> examples = new ArrayList<Example>();
public List<Facet> getFacets() {
return facets;
}
public void setFacets(List<Facet> facets) {
this.facets = facets;
}
public List<Example> getExamples() {
return examples;
}
public void setExamples(List<Example> examples) {
this.examples = examples;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ExampleSearchResults {\n");
sb.append(" facets: ").append(facets).append("\n");
sb.append(" examples: ").append(examples).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,21 +0,0 @@
package com.wordnik.client.model;
public class ExampleUsage {
private String text = null;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ExampleUsage {\n");
sb.append(" text: ").append(text).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,32 +0,0 @@
package com.wordnik.client.model;
import java.util.*;
import com.wordnik.client.model.FacetValue;
public class Facet {
private List<FacetValue> facetValues = new ArrayList<FacetValue>();
private String name = null;
public List<FacetValue> getFacetValues() {
return facetValues;
}
public void setFacetValues(List<FacetValue> facetValues) {
this.facetValues = facetValues;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Facet {\n");
sb.append(" facetValues: ").append(facetValues).append("\n");
sb.append(" name: ").append(name).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,30 +0,0 @@
package com.wordnik.client.model;
public class FacetValue {
private Long count = null;
private String value = null;
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FacetValue {\n");
sb.append(" count: ").append(count).append("\n");
sb.append(" value: ").append(value).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,30 +0,0 @@
package com.wordnik.client.model;
public class Frequency {
private Long count = null;
private Integer year = null;
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Frequency {\n");
sb.append(" count: ").append(count).append("\n");
sb.append(" year: ").append(year).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,59 +0,0 @@
package com.wordnik.client.model;
import java.util.*;
import com.wordnik.client.model.Frequency;
public class FrequencySummary {
private Integer unknownYearCount = null;
private Long totalCount = null;
private String frequencyString = null;
private String word = null;
private List<Frequency> frequency = new ArrayList<Frequency>();
public Integer getUnknownYearCount() {
return unknownYearCount;
}
public void setUnknownYearCount(Integer unknownYearCount) {
this.unknownYearCount = unknownYearCount;
}
public Long getTotalCount() {
return totalCount;
}
public void setTotalCount(Long totalCount) {
this.totalCount = totalCount;
}
public String getFrequencyString() {
return frequencyString;
}
public void setFrequencyString(String frequencyString) {
this.frequencyString = frequencyString;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public List<Frequency> getFrequency() {
return frequency;
}
public void setFrequency(List<Frequency> frequency) {
this.frequency = frequency;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FrequencySummary {\n");
sb.append(" unknownYearCount: ").append(unknownYearCount).append("\n");
sb.append(" totalCount: ").append(totalCount).append("\n");
sb.append(" frequencyString: ").append(frequencyString).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append(" frequency: ").append(frequency).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,30 +0,0 @@
package com.wordnik.client.model;
public class Label {
private String text = null;
private String type = null;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Label {\n");
sb.append(" text: ").append(text).append("\n");
sb.append(" type: ").append(type).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,49 +0,0 @@
package com.wordnik.client.model;
import java.util.*;
public class Note {
private String noteType = null;
private List<String> appliesTo = new ArrayList<String>();
private String value = null;
private Integer pos = null;
public String getNoteType() {
return noteType;
}
public void setNoteType(String noteType) {
this.noteType = noteType;
}
public List<String> getAppliesTo() {
return appliesTo;
}
public void setAppliesTo(List<String> appliesTo) {
this.appliesTo = appliesTo;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Integer getPos() {
return pos;
}
public void setPos(Integer pos) {
this.pos = pos;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Note {\n");
sb.append(" noteType: ").append(noteType).append("\n");
sb.append(" appliesTo: ").append(appliesTo).append("\n");
sb.append(" value: ").append(value).append("\n");
sb.append(" pos: ").append(pos).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,76 +0,0 @@
package com.wordnik.client.model;
import java.util.*;
public class Related {
private String label1 = null;
private String relationshipType = null;
private String label2 = null;
private String label3 = null;
private List<String> words = new ArrayList<String>();
private String gram = null;
private String label4 = null;
public String getLabel1() {
return label1;
}
public void setLabel1(String label1) {
this.label1 = label1;
}
public String getRelationshipType() {
return relationshipType;
}
public void setRelationshipType(String relationshipType) {
this.relationshipType = relationshipType;
}
public String getLabel2() {
return label2;
}
public void setLabel2(String label2) {
this.label2 = label2;
}
public String getLabel3() {
return label3;
}
public void setLabel3(String label3) {
this.label3 = label3;
}
public List<String> getWords() {
return words;
}
public void setWords(List<String> words) {
this.words = words;
}
public String getGram() {
return gram;
}
public void setGram(String gram) {
this.gram = gram;
}
public String getLabel4() {
return label4;
}
public void setLabel4(String label4) {
this.label4 = label4;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Related {\n");
sb.append(" label1: ").append(label1).append("\n");
sb.append(" relationshipType: ").append(relationshipType).append("\n");
sb.append(" label2: ").append(label2).append("\n");
sb.append(" label3: ").append(label3).append("\n");
sb.append(" words: ").append(words).append("\n");
sb.append(" gram: ").append(gram).append("\n");
sb.append(" label4: ").append(label4).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,111 +0,0 @@
package com.wordnik.client.model;
public class ScoredWord {
private Integer position = null;
private Long id = null;
private Integer docTermCount = null;
private String lemma = null;
private String wordType = null;
private Float score = null;
private Long sentenceId = null;
private String word = null;
private Boolean stopword = null;
private Double baseWordScore = null;
private String partOfSpeech = null;
public Integer getPosition() {
return position;
}
public void setPosition(Integer position) {
this.position = position;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getDocTermCount() {
return docTermCount;
}
public void setDocTermCount(Integer docTermCount) {
this.docTermCount = docTermCount;
}
public String getLemma() {
return lemma;
}
public void setLemma(String lemma) {
this.lemma = lemma;
}
public String getWordType() {
return wordType;
}
public void setWordType(String wordType) {
this.wordType = wordType;
}
public Float getScore() {
return score;
}
public void setScore(Float score) {
this.score = score;
}
public Long getSentenceId() {
return sentenceId;
}
public void setSentenceId(Long sentenceId) {
this.sentenceId = sentenceId;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public Boolean getStopword() {
return stopword;
}
public void setStopword(Boolean stopword) {
this.stopword = stopword;
}
public Double getBaseWordScore() {
return baseWordScore;
}
public void setBaseWordScore(Double baseWordScore) {
this.baseWordScore = baseWordScore;
}
public String getPartOfSpeech() {
return partOfSpeech;
}
public void setPartOfSpeech(String partOfSpeech) {
this.partOfSpeech = partOfSpeech;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ScoredWord {\n");
sb.append(" position: ").append(position).append("\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" docTermCount: ").append(docTermCount).append("\n");
sb.append(" lemma: ").append(lemma).append("\n");
sb.append(" wordType: ").append(wordType).append("\n");
sb.append(" score: ").append(score).append("\n");
sb.append(" sentenceId: ").append(sentenceId).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append(" stopword: ").append(stopword).append("\n");
sb.append(" baseWordScore: ").append(baseWordScore).append("\n");
sb.append(" partOfSpeech: ").append(partOfSpeech).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,21 +0,0 @@
package com.wordnik.client.model;
public class ScrabbleScoreResult {
private Integer value = null;
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ScrabbleScoreResult {\n");
sb.append(" value: ").append(value).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,68 +0,0 @@
package com.wordnik.client.model;
import java.util.*;
import com.wordnik.client.model.ScoredWord;
public class Sentence {
private Boolean hasScoredWords = null;
private Long id = null;
private List<ScoredWord> scoredWords = new ArrayList<ScoredWord>();
private String display = null;
private Integer rating = null;
private Long documentMetadataId = null;
public Boolean getHasScoredWords() {
return hasScoredWords;
}
public void setHasScoredWords(Boolean hasScoredWords) {
this.hasScoredWords = hasScoredWords;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public List<ScoredWord> getScoredWords() {
return scoredWords;
}
public void setScoredWords(List<ScoredWord> scoredWords) {
this.scoredWords = scoredWords;
}
public String getDisplay() {
return display;
}
public void setDisplay(String display) {
this.display = display;
}
public Integer getRating() {
return rating;
}
public void setRating(Integer rating) {
this.rating = rating;
}
public Long getDocumentMetadataId() {
return documentMetadataId;
}
public void setDocumentMetadataId(Long documentMetadataId) {
this.documentMetadataId = documentMetadataId;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Sentence {\n");
sb.append(" hasScoredWords: ").append(hasScoredWords).append("\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" scoredWords: ").append(scoredWords).append("\n");
sb.append(" display: ").append(display).append("\n");
sb.append(" rating: ").append(rating).append("\n");
sb.append(" documentMetadataId: ").append(documentMetadataId).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,48 +0,0 @@
package com.wordnik.client.model;
public class SimpleDefinition {
private String text = null;
private String source = null;
private String note = null;
private String partOfSpeech = null;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public String getPartOfSpeech() {
return partOfSpeech;
}
public void setPartOfSpeech(String partOfSpeech) {
this.partOfSpeech = partOfSpeech;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SimpleDefinition {\n");
sb.append(" text: ").append(text).append("\n");
sb.append(" source: ").append(source).append("\n");
sb.append(" note: ").append(note).append("\n");
sb.append(" partOfSpeech: ").append(partOfSpeech).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,48 +0,0 @@
package com.wordnik.client.model;
public class SimpleExample {
private Long id = null;
private String title = null;
private String text = null;
private String url = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SimpleExample {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" title: ").append(title).append("\n");
sb.append(" text: ").append(text).append("\n");
sb.append(" url: ").append(url).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,21 +0,0 @@
package com.wordnik.client.model;
public class StringValue {
private String word = null;
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StringValue {\n");
sb.append(" word: ").append(word).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,39 +0,0 @@
package com.wordnik.client.model;
public class Syllable {
private String text = null;
private Integer seq = null;
private String type = null;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public Integer getSeq() {
return seq;
}
public void setSeq(Integer seq) {
this.seq = seq;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Syllable {\n");
sb.append(" text: ").append(text).append("\n");
sb.append(" seq: ").append(seq).append("\n");
sb.append(" type: ").append(type).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,39 +0,0 @@
package com.wordnik.client.model;
public class TextPron {
private String raw = null;
private Integer seq = null;
private String rawType = null;
public String getRaw() {
return raw;
}
public void setRaw(String raw) {
this.raw = raw;
}
public Integer getSeq() {
return seq;
}
public void setSeq(Integer seq) {
this.seq = seq;
}
public String getRawType() {
return rawType;
}
public void setRawType(String rawType) {
this.rawType = rawType;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TextPron {\n");
sb.append(" raw: ").append(raw).append("\n");
sb.append(" seq: ").append(seq).append("\n");
sb.append(" rawType: ").append(rawType).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,84 +0,0 @@
package com.wordnik.client.model;
public class User {
private Long id = null;
private String username = null;
private String email = null;
private Integer status = null;
private String faceBookId = null;
private String userName = null;
private String displayName = null;
private String password = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getFaceBookId() {
return faceBookId;
}
public void setFaceBookId(String faceBookId) {
this.faceBookId = faceBookId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class User {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" username: ").append(username).append("\n");
sb.append(" email: ").append(email).append("\n");
sb.append(" status: ").append(status).append("\n");
sb.append(" faceBookId: ").append(faceBookId).append("\n");
sb.append(" userName: ").append(userName).append("\n");
sb.append(" displayName: ").append(displayName).append("\n");
sb.append(" password: ").append(password).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,112 +0,0 @@
package com.wordnik.client.model;
import java.util.Date;
public class WordList {
private Long id = null;
private String permalink = null;
private String name = null;
private Date createdAt = null;
private Date updatedAt = null;
private Date lastActivityAt = null;
private String username = null;
private Long userId = null;
private String description = null;
private Long numberWordsInList = null;
private String type = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getPermalink() {
return permalink;
}
public void setPermalink(String permalink) {
this.permalink = permalink;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public Date getLastActivityAt() {
return lastActivityAt;
}
public void setLastActivityAt(Date lastActivityAt) {
this.lastActivityAt = lastActivityAt;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getNumberWordsInList() {
return numberWordsInList;
}
public void setNumberWordsInList(Long numberWordsInList) {
this.numberWordsInList = numberWordsInList;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class WordList {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" permalink: ").append(permalink).append("\n");
sb.append(" name: ").append(name).append("\n");
sb.append(" createdAt: ").append(createdAt).append("\n");
sb.append(" updatedAt: ").append(updatedAt).append("\n");
sb.append(" lastActivityAt: ").append(lastActivityAt).append("\n");
sb.append(" username: ").append(username).append("\n");
sb.append(" userId: ").append(userId).append("\n");
sb.append(" description: ").append(description).append("\n");
sb.append(" numberWordsInList: ").append(numberWordsInList).append("\n");
sb.append(" type: ").append(type).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,76 +0,0 @@
package com.wordnik.client.model;
import java.util.Date;
public class WordListWord {
private Long id = null;
private String word = null;
private String username = null;
private Long userId = null;
private Date createdAt = null;
private Long numberCommentsOnWord = null;
private Long numberLists = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Long getNumberCommentsOnWord() {
return numberCommentsOnWord;
}
public void setNumberCommentsOnWord(Long numberCommentsOnWord) {
this.numberCommentsOnWord = numberCommentsOnWord;
}
public Long getNumberLists() {
return numberLists;
}
public void setNumberLists(Long numberLists) {
this.numberLists = numberLists;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class WordListWord {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append(" username: ").append(username).append("\n");
sb.append(" userId: ").append(userId).append("\n");
sb.append(" createdAt: ").append(createdAt).append("\n");
sb.append(" numberCommentsOnWord: ").append(numberCommentsOnWord).append("\n");
sb.append(" numberLists: ").append(numberLists).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,67 +0,0 @@
package com.wordnik.client.model;
import java.util.*;
public class WordObject {
private Long id = null;
private String word = null;
private String originalWord = null;
private List<String> suggestions = new ArrayList<String>();
private String canonicalForm = null;
private String vulgar = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public String getOriginalWord() {
return originalWord;
}
public void setOriginalWord(String originalWord) {
this.originalWord = originalWord;
}
public List<String> getSuggestions() {
return suggestions;
}
public void setSuggestions(List<String> suggestions) {
this.suggestions = suggestions;
}
public String getCanonicalForm() {
return canonicalForm;
}
public void setCanonicalForm(String canonicalForm) {
this.canonicalForm = canonicalForm;
}
public String getVulgar() {
return vulgar;
}
public void setVulgar(String vulgar) {
this.vulgar = vulgar;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class WordObject {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append(" originalWord: ").append(originalWord).append("\n");
sb.append(" suggestions: ").append(suggestions).append("\n");
sb.append(" canonicalForm: ").append(canonicalForm).append("\n");
sb.append(" vulgar: ").append(vulgar).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,125 +0,0 @@
package com.wordnik.client.model;
import java.util.Date;
import java.util.*;
import com.wordnik.client.model.SimpleExample;
import com.wordnik.client.model.SimpleDefinition;
import com.wordnik.client.model.ContentProvider;
public class WordOfTheDay {
private Long id = null;
private String parentId = null;
private String category = null;
private String createdBy = null;
private Date createdAt = null;
private ContentProvider contentProvider = null;
private String htmlExtra = null;
private String word = null;
private List<SimpleDefinition> definitions = new ArrayList<SimpleDefinition>();
private List<SimpleExample> examples = new ArrayList<SimpleExample>();
private String note = null;
private Date publishDate = null;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public ContentProvider getContentProvider() {
return contentProvider;
}
public void setContentProvider(ContentProvider contentProvider) {
this.contentProvider = contentProvider;
}
public String getHtmlExtra() {
return htmlExtra;
}
public void setHtmlExtra(String htmlExtra) {
this.htmlExtra = htmlExtra;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public List<SimpleDefinition> getDefinitions() {
return definitions;
}
public void setDefinitions(List<SimpleDefinition> definitions) {
this.definitions = definitions;
}
public List<SimpleExample> getExamples() {
return examples;
}
public void setExamples(List<SimpleExample> examples) {
this.examples = examples;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public Date getPublishDate() {
return publishDate;
}
public void setPublishDate(Date publishDate) {
this.publishDate = publishDate;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class WordOfTheDay {\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" parentId: ").append(parentId).append("\n");
sb.append(" category: ").append(category).append("\n");
sb.append(" createdBy: ").append(createdBy).append("\n");
sb.append(" createdAt: ").append(createdAt).append("\n");
sb.append(" contentProvider: ").append(contentProvider).append("\n");
sb.append(" htmlExtra: ").append(htmlExtra).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append(" definitions: ").append(definitions).append("\n");
sb.append(" examples: ").append(examples).append("\n");
sb.append(" note: ").append(note).append("\n");
sb.append(" publishDate: ").append(publishDate).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,39 +0,0 @@
package com.wordnik.client.model;
public class WordSearchResult {
private Long count = null;
private Double lexicality = null;
private String word = null;
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public Double getLexicality() {
return lexicality;
}
public void setLexicality(Double lexicality) {
this.lexicality = lexicality;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class WordSearchResult {\n");
sb.append(" count: ").append(count).append("\n");
sb.append(" lexicality: ").append(lexicality).append("\n");
sb.append(" word: ").append(word).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,32 +0,0 @@
package com.wordnik.client.model;
import java.util.*;
import com.wordnik.client.model.WordSearchResult;
public class WordSearchResults {
private List<WordSearchResult> searchResults = new ArrayList<WordSearchResult>();
private Integer totalResults = null;
public List<WordSearchResult> getSearchResults() {
return searchResults;
}
public void setSearchResults(List<WordSearchResult> searchResults) {
this.searchResults = searchResults;
}
public Integer getTotalResults() {
return totalResults;
}
public void setTotalResults(Integer totalResults) {
this.totalResults = totalResults;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class WordSearchResults {\n");
sb.append(" searchResults: ").append(searchResults).append("\n");
sb.append(" totalResults: ").append(totalResults).append("\n");
sb.append("}\n");
return sb.toString();
}
}

View File

@ -1,29 +0,0 @@
/**
* Copyright 2014 Wordnik, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.wordnik.swagger.codegen.BasicPHPGenerator
import java.io.File
object PHPWordnikApiCodegen extends BasicPHPGenerator {
def main(args: Array[String]) = generateClient(args)
override def destinationDir = "samples/client/wordnik-api/php/wordnik"
override def supportingFiles = List(
("Swagger.mustache", destinationDir + File.separator + apiPackage.get, "Swagger.php")
)
}

View File

@ -1,47 +0,0 @@
# PHP client for Wordnik.com API
## Overview
This is a PHP client for the Wordnik.com v4 API. For more information, see http://developer.wordnik.com/ .
## Generation
This client was generated using the provided script:
```
/bin/php-wordnik-api.sh
```
## Testing
These tests require PHPUnit. If you require PHPUnit to be installed, first get PEAR:
```sh
wget http://pear.php.net/go-pear.phar
php -d detect_unicode=0 go-pear.phar
```
Then install PHPUnit:
```sh
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit
```
The tests require you to set three environment varibales:
```sh
export API_KEY=your api key
export USER_NAME=some wordnik.com username
export PASSWORD=the user's password
```
The tests can be run as follows:
```sh
phpunit tests/AccountApiTest.php
phpunit tests/WordApiTest.php
phpunit tests/WordsApiTest.php
phpunit tests/WordListApiTest.php
phpunit tests/WordListsApiTest.php
```

View File

@ -1,51 +0,0 @@
<?php
require_once 'BaseApiTest.php';
class AccountApiTest extends BaseApiTest {
public function setUp() {
parent::setUp();
$this->authToken = $this->accountApi->authenticate($this->username,
$this->password)->token;
date_default_timezone_set('America/Los_Angeles');
}
public function testAuthenticate() {
$res = $this->accountApi->authenticate($this->username,
$this->password);
$this->assertObjectHasAttribute('token', $res);
$this->assertNotEquals(0, $res->userId);
$this->assertObjectHasAttribute('userSignature', $res);
}
public function testAuthenticatePost() {
$res = $this->accountApi->authenticatePost($this->username,
$this->password);
$this->assertObjectHasAttribute('token', $res);
$this->assertNotEquals(0, $res->userId);
$this->assertObjectHasAttribute('userSignature', $res);
}
public function testGetWordListsForLoggedInUser() {
$res = $this->accountApi->getWordListsForLoggedInUser($this->authToken);
$this->assertNotEquals(0, count($res));
}
public function testGetApiTokenStatus() {
$res = $this->accountApi->getApiTokenStatus();
$this->assertObjectHasAttribute('valid', $res);
$this->assertNotEquals(0, count($res->remainingCalls));
}
public function testGetLoggedInUser() {
$res = $this->accountApi->getLoggedInUser($this->authToken);
$this->assertNotEquals(0, $res->id);
$this->assertEquals($this->username, $res->username);
$this->assertEquals(0, $res->status);
$this->assertNotEquals(null, $res->email);
}
}
?>

View File

@ -1,56 +0,0 @@
<?php
// Unit tests for PHP Wordnik API client.
//
// Requires you to set three environment varibales:
// API_KEY your API key
// USER_NAME the username of a user
// PASSWORD the user's password
// Run all tests:
//
// phpunit tests/AccountApiTest.php
// phpunit tests/WordApiTest.php
// phpunit tests/WordsApiTest.php
// phpunit tests/WordListApiTest.php
// phpunit tests/WordListsApiTest.php
// If you require PHPUnit to be installed, first get PEAR:
//
// $ wget http://pear.php.net/go-pear.phar
// $ php -d detect_unicode=0 go-pear.phar
//
// Then install PHPUnit:
//
// $ pear config-set auto_discover
// $ pear install pear.phpunit.de/PHPUnit
require_once 'wordnik/Swagger.php';
// This used to be required, but now gives an error:
// Cannot redeclare phpunit_autoload()
// require_once '/usr/lib/php/PHPUnit/Autoload.php';
class BaseApiTest extends PHPUnit_Framework_TestCase {
public function setUp() {
$this->apiUrl = 'https://api.wordnik.com/v4';
$this->apiKey = getenv('API_KEY');
$this->username = getenv('USER_NAME');
$this->password = getenv('PASSWORD');
$this->client = new APIClient($this->apiKey, $this->apiUrl);
$this->accountApi = new AccountApi($this->client);
$this->wordApi = new WordApi($this->client);
$this->wordListApi = new WordListApi($this->client);
$this->wordListsApi = new WordListsApi($this->client);
$this->wordsApi = new WordsApi($this->client);
}
public function tearDown() {
unset($this->client);
}
}
?>

View File

@ -1,95 +0,0 @@
<?php
require_once 'BaseApiTest.php';
date_default_timezone_set('America/Los_Angeles');
class WordApiTest extends BaseApiTest {
public function testWordApis() {
$ch = curl_init("http://api.wordnik.com/v4/word.json");
if (! $ch) {
die("No php curl handle");
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
$doc = json_decode($data);
$this->assertEquals(12, count($doc->apis));
}
public function testGetWord() {
$res = $this->wordApi->getWord('cat');
$this->assertEquals('cat', $res->word);
}
public function testGetWordWithSuggestions() {
$res = $this->wordApi->getWord('cAt', $includeSuggestions=true);
$this->assertEquals('cAt', $res->word);
}
public function testGetWordWithCanonicalForm() {
$res = $this->wordApi->getWord('cAt', $useCanonical='true');
$this->assertEquals('cat', $res->word);
}
public function testGetDefinitions() {
$res = $this->wordApi->getDefinitions('cat');
$this->assertEquals(15, count($res));
}
public function testGetDefinitionsWithSpacesInWord() {
$res = $this->wordApi->getDefinitions('bon vivant');
$this->assertEquals(1, count($res));
}
public function testGetExamples() {
$res = $this->wordApi->getExamples('cat', $limit=5);
$this->assertEquals(5, count($res->examples));
}
public function testGetTopExample() {
$res = $this->wordApi->getTopExample('cat', $limit=5);
$this->assertEquals('cat', $res->word);
}
public function testGetHyphenation() {
$res = $this->wordApi->getHyphenation('catalog', $useCanonical=null, $sourceDictionary=null, $limit=1);
$this->assertEquals(1, count($res));
}
public function testGetWordFrequency() {
$res = $this->wordApi->getWordFrequency('catalog');
$this->assertFalse($res->totalCount == 0);
}
public function testGetPhrases() {
$res = $this->wordApi->getPhrases('money');
$this->assertFalse(count($res) == 0);
}
public function testGetRelatedWords() {
$res = $this->wordApi->getRelatedWords('cat');
foreach ($res as $related) {
$this->assertLessThan(11, count($related->words));
}
}
public function testGetAudio() {
$res = $this->wordApi->getAudio('cat', $useCanonical=True, $limit=2);
$this->assertEquals(2, count($res));
}
public function testGetScrabbleScore() {
$res = $this->wordApi->getScrabbleScore('quixotry');
$this->assertEquals(27, $res->value);
}
public function testGetEtymologies() {
$res = $this->wordApi->getEtymologies('butter');
$this->assertFalse(strpos($res[0], 'of Scythian origin') === false);
}
}
?>

View File

@ -1,115 +0,0 @@
<?php
require_once 'BaseApiTest.php';
date_default_timezone_set('America/Los_Angeles');
class WordListApiTest extends BaseApiTest {
public function setUp() {
parent::setUp();
$this->authToken = $this->accountApi->authenticate($this->username,
$this->password)->token;
$lists = $this->accountApi->getWordListsForLoggedInUser($this->authToken, $skip=null, $limit=1);
$this->existingList = $lists[0];
$this->wordList = new WordList();
$this->wordList->name = "my test list";
$this->wordList->type = "PUBLIC";
$this->wordList->description = "some words I want to play with";
}
public function testGetWordListByPermalink() {
$res = $this->wordListApi->getWordListByPermalink($this->existingList->permalink,
$this->authToken);
$this->assertNotEquals(null, $res);
}
public function testUpdateWordList() {
$description = 'list updated at ' . time();
$this->existingList->description = $description;
$this->wordListApi->updateWordList($this->existingList->permalink,
$body=$this->existingList,
$this->authToken);
$res = $this->wordListApi->getWordListByPermalink($this->existingList->permalink, $this->authToken);
$this->assertEquals($description, $res->description);
}
public function testAddWordsToWordList() {
$wordsToAdd = array();
$word1 = new StringValue();
$word1->word = "delicious";
$wordsToAdd[] = $word1;
$word2 = new StringValue();
$word2->word = "tasty";
$wordsToAdd[] = $word2;
$word3 = new StringValue();
$word3->word = "scrumptious";
$wordsToAdd[] = $word3;
$word4 = new StringValue();
$word4->word = "not to be deleted";
$wordsToAdd[] = $word4;
$this->wordListApi->addWordsToWordList($this->existingList->permalink,
$body=$wordsToAdd,
$this->authToken);
$res = $this->wordListApi->getWordListWords($this->existingList->permalink, $this->authToken, $sortBy=null, $sortOrder=null, $skip=null, $limit=null);
$returnedWords = array();
foreach ($res as $wordListWord) {
$returnedWords[] = $wordListWord->word;
}
$intersection = array();
foreach ($wordsToAdd as $addedWord) {
if (in_array($addedWord->word, $returnedWords)) {
$intersection[] = $addedWord->word;
}
}
$this->assertEquals(4, count($intersection));
}
public function testDeleteWordsFromList() {
$wordsToRemove = array();
$word1 = new StringValue();
$word1->word = "delicious";
$wordsToRemove[] = $word1;
$word2 = new StringValue();
$word2->word = "tasty";
$wordsToRemove[] = $word2;
$word3 = new StringValue();
$word3->word = "scrumptious";
$wordsToRemove[] = $word3;
$res = $this->wordListApi->getWordListWords($this->existingList->permalink, $this->authToken, $sortBy=null, $sortOrder=null, $skip=null, $limit=null);
$this->wordListApi->deleteWordsFromWordList($this->existingList->permalink,
$body=$wordsToRemove,
$this->authToken);
$res = $this->wordListApi->getWordListWords($this->existingList->permalink, $this->authToken, $sortBy=null, $sortOrder=null, $skip=null, $limit=null);
$returnedWords = array();
foreach ($res as $wordListWord) {
$returnedWords[] = $wordListWord->word;
}
$intersection = array();
foreach ($wordsToRemove as $removedWord) {
if (in_array($removedWord->word, $returnedWords)) {
$intersection[] = $removedWord->word;
}
}
$this->assertEquals(0, count($intersection));
}
}
?>

View File

@ -1,40 +0,0 @@
<?php
require_once 'BaseApiTest.php';
date_default_timezone_set('America/Los_Angeles');
class WordListsApiTest extends BaseApiTest {
public function setUp() {
parent::setUp();
$this->authToken = $this->accountApi->authenticate($this->username,
$this->password)->token;
}
public function testCreateWordList() {
$wordList = new WordList();
$wordList->name = "my test list";
$wordList->type = "PUBLIC";
$wordList->description = "some words I want to play with";
$res = $this->wordListsApi->createWordList($body=$wordList,
$this->authToken);
$this->assertEquals($wordList->description, $res->description);
$wordsToAdd = array();
$word1 = new StringValue();
$word1->word = "foo";
$wordsToAdd[] = $word1;
$this->wordListApi->addWordsToWordList($res->permalink,
$body=$wordsToAdd,
$this->authToken);
}
}
?>

View File

@ -1,37 +0,0 @@
<?php
require_once 'BaseApiTest.php';
date_default_timezone_set('America/Los_Angeles');
class WordsApiTest extends BaseApiTest {
public function testSearchWords() {
$res = $this->wordsApi->searchWords('tree');
$this->assertEquals('tree', $res->searchResults[0]->word);
$this->assertNotEquals(0, $res->totalResults);
}
public function testGetWordOfTheDay() {
$res = $this->wordsApi->getWordOfTheDay();
$this->assertNotEquals(null, $res);
}
public function testReverseDictionary() {
$res = $this->wordsApi->reverseDictionary('hairy');
$this->assertNotEquals(0, $res->totalResults);
$this->assertNotEquals(0, count($res->results));
}
public function testGetRandomWords() {
$res = $this->wordsApi->getRandomWords();
$this->assertEquals(10, count($res));
}
public function testGetRandomWord() {
$res = $this->wordsApi->getRandomWord();
$this->assertNotEquals(null, $res);
}
}
?>

View File

@ -1,250 +0,0 @@
<?php
/**
* Copyright 2014 Reverb Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
*/
class AccountApi {
function __construct($apiClient) {
$this->apiClient = $apiClient;
}
/**
* authenticate
* Authenticates a User
* username, string: A confirmed Wordnik username (required)
* password, string: The user's password (required)
* @return AuthenticationToken
*/
public function authenticate($username, $password) {
//parse inputs
$resourcePath = "/account.{format}/authenticate/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($password != null) {
$queryParams['password'] = $this->apiClient->toQueryValue($password);
}
if($username != null) {
$resourcePath = str_replace("{" . "username" . "}",
$this->apiClient->toPathValue($username), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'AuthenticationToken');
return $responseObject;
}
/**
* authenticatePost
* Authenticates a user
* username, string: A confirmed Wordnik username (required)
* body, string: The user's password (required)
* @return AuthenticationToken
*/
public function authenticatePost($username, $body) {
//parse inputs
$resourcePath = "/account.{format}/authenticate/{username}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($username != null) {
$resourcePath = str_replace("{" . "username" . "}",
$this->apiClient->toPathValue($username), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'AuthenticationToken');
return $responseObject;
}
/**
* getWordListsForLoggedInUser
* Fetches WordList objects for the logged-in user.
* auth_token, string: auth_token of logged-in user (required)
* skip, int: Results to skip (optional)
* limit, int: Maximum number of results to return (optional)
* @return array[WordList]
*/
public function getWordListsForLoggedInUser($auth_token, $skip=null, $limit=null) {
//parse inputs
$resourcePath = "/account.{format}/wordLists";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($skip != null) {
$queryParams['skip'] = $this->apiClient->toQueryValue($skip);
}
if($limit != null) {
$queryParams['limit'] = $this->apiClient->toQueryValue($limit);
}
if($auth_token != null) {
$headerParams['auth_token'] = $this->apiClient->toHeaderValue($auth_token);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'array[WordList]');
return $responseObject;
}
/**
* getApiTokenStatus
* Returns usage statistics for the API account.
* api_key, string: Wordnik authentication token (optional)
* @return ApiTokenStatus
*/
public function getApiTokenStatus($api_key=null) {
//parse inputs
$resourcePath = "/account.{format}/apiTokenStatus";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($api_key != null) {
$headerParams['api_key'] = $this->apiClient->toHeaderValue($api_key);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'ApiTokenStatus');
return $responseObject;
}
/**
* getLoggedInUser
* Returns the logged-in User
* auth_token, string: The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) (required)
* @return User
*/
public function getLoggedInUser($auth_token) {
//parse inputs
$resourcePath = "/account.{format}/user";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($auth_token != null) {
$headerParams['auth_token'] = $this->apiClient->toHeaderValue($auth_token);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'User');
return $responseObject;
}
}

View File

@ -1,225 +0,0 @@
<?php
/**
* APIClient.php
*/
/* Autoload the model definition files */
/**
*
*
* @param string $className the class to attempt to load
*/
function swagger_autoloader($className) {
$currentDir = dirname(__FILE__);
if (file_exists($currentDir . '/' . $className . '.php')) {
include $currentDir . '/' . $className . '.php';
} elseif (file_exists($currentDir . '/models/' . $className . '.php')) {
include $currentDir . '/models/' . $className . '.php';
}
}
spl_autoload_register('swagger_autoloader');
class APIClient {
public static $POST = "POST";
public static $GET = "GET";
public static $PUT = "PUT";
public static $DELETE = "DELETE";
/**
* @param string $apiKey your API key
* @param string $apiServer the address of the API server
*/
function __construct($apiKey, $apiServer) {
$this->apiKey = $apiKey;
$this->apiServer = $apiServer;
}
/**
* @param string $resourcePath path to method endpoint
* @param string $method method to call
* @param array $queryParams parameters to be place in query URL
* @param array $postData parameters to be placed in POST body
* @param array $headerParams parameters to be place in request header
* @return mixed
*/
public function callAPI($resourcePath, $method, $queryParams, $postData,
$headerParams) {
$headers = array();
# Allow API key from $headerParams to override default
$added_api_key = False;
if ($headerParams != null) {
foreach ($headerParams as $key => $val) {
$headers[] = "$key: $val";
if ($key == 'api_key') {
$added_api_key = True;
}
}
}
if (! $added_api_key) {
$headers[] = "api_key: " . $this->apiKey;
}
if (is_object($postData) or is_array($postData)) {
$postData = json_encode($this->sanitizeForSerialization($postData));
}
$url = $this->apiServer . $resourcePath;
$curl = curl_init();
curl_setopt($curl, CURLOPT_TIMEOUT, 5);
// return the result on success, rather than just TRUE
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
if (! empty($queryParams)) {
$url = ($url . '?' . http_build_query($queryParams));
}
if ($method == self::$POST) {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} else if ($method == self::$PUT) {
$json_data = json_encode($postData);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} else if ($method == self::$DELETE) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} else if ($method != self::$GET) {
throw new Exception('Method ' . $method . ' is not recognized.');
}
curl_setopt($curl, CURLOPT_URL, $url);
// Make the request
$response = curl_exec($curl);
$response_info = curl_getinfo($curl);
// Handle the response
if ($response_info['http_code'] == 0) {
throw new Exception("TIMEOUT: api call to " . $url .
" took more than 5s to return" );
} else if ($response_info['http_code'] == 200) {
$data = json_decode($response);
} else if ($response_info['http_code'] == 401) {
throw new Exception("Unauthorized API request to " . $url .
": ".json_decode($response)->message );
} else if ($response_info['http_code'] == 404) {
$data = null;
} else {
throw new Exception("Can't connect to the api: " . $url .
" response code: " .
$response_info['http_code']);
}
return $data;
}
/**
* Build a JSON POST object
*/
protected function sanitizeForSerialization($data)
{
if (is_scalar($data) || null === $data) {
$sanitized = $data;
} else if ($data instanceof \DateTime) {
$sanitized = $data->format(\DateTime::ISO8601);
} else if (is_array($data)) {
foreach ($data as $property => $value) {
$data[$property] = $this->sanitizeForSerialization($value);
}
$sanitized = $data;
} else if (is_object($data)) {
$values = array();
foreach (array_keys($data::$swaggerTypes) as $property) {
$values[$property] = $this->sanitizeForSerialization($data->$property);
}
$sanitized = $values;
} else {
$sanitized = (string)$data;
}
return $sanitized;
}
/**
* Take value and turn it into a string suitable for inclusion in
* the path, by url-encoding.
* @param string $value a string which will be part of the path
* @return string the serialized object
*/
public static function toPathValue($value) {
return rawurlencode($value);
}
/**
* Take value and turn it into a string suitable for inclusion in
* the query, by imploding comma-separated if it's an object.
* If it's a string, pass through unchanged. It will be url-encoded
* later.
* @param object $object an object to be serialized to a string
* @return string the serialized object
*/
public static function toQueryValue($object) {
if (is_array($object)) {
return implode(',', $object);
} else {
return $object;
}
}
/**
* Just pass through the header value for now. Placeholder in case we
* find out we need to do something with header values.
* @param string $value a string which will be part of the header
* @return string the header string
*/
public static function toHeaderValue($value) {
return $value;
}
/**
* Deserialize a JSON string into an object
*
* @param object $object object or primitive to be deserialized
* @param string $class class name is passed as a string
* @return object an instance of $class
*/
public static function deserialize($data, $class)
{
if (null === $data) {
$deserialized = null;
} else if (substr($class, 0, 6) == 'array[') {
$subClass = substr($class, 6, -1);
$values = array();
foreach ($data as $value) {
$values[] = self::deserialize($value, $subClass);
}
$deserialized = $values;
} elseif ($class == 'DateTime') {
$deserialized = new \DateTime($data);
} elseif (in_array($class, array('string', 'int', 'float', 'bool'))) {
settype($data, $class);
$deserialized = $data;
} else {
$instance = new $class();
foreach ($instance::$swaggerTypes as $property => $type) {
if (isset($data->$property)) {
$instance->$property = self::deserialize($data->$property, $type);
}
}
$deserialized = $instance;
}
return $deserialized;
}
}

View File

@ -1,683 +0,0 @@
<?php
/**
* Copyright 2014 Reverb Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
*/
class WordApi {
function __construct($apiClient) {
$this->apiClient = $apiClient;
}
/**
* getExamples
* Returns examples for a word
* word, string: Word to return examples for (required)
* includeDuplicates, string: Show duplicate examples from different sources (optional)
* useCanonical, string: If true will try to return the correct word root ('cats' -&gt; 'cat'). If false returns exactly what was requested. (optional)
* skip, int: Results to skip (optional)
* limit, int: Maximum number of results to return (optional)
* @return ExampleSearchResults
*/
public function getExamples($word, $includeDuplicates=null, $useCanonical=null, $skip=null, $limit=null) {
//parse inputs
$resourcePath = "/word.{format}/{word}/examples";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($includeDuplicates != null) {
$queryParams['includeDuplicates'] = $this->apiClient->toQueryValue($includeDuplicates);
}
if($useCanonical != null) {
$queryParams['useCanonical'] = $this->apiClient->toQueryValue($useCanonical);
}
if($skip != null) {
$queryParams['skip'] = $this->apiClient->toQueryValue($skip);
}
if($limit != null) {
$queryParams['limit'] = $this->apiClient->toQueryValue($limit);
}
if($word != null) {
$resourcePath = str_replace("{" . "word" . "}",
$this->apiClient->toPathValue($word), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'ExampleSearchResults');
return $responseObject;
}
/**
* getWord
* Given a word as a string, returns the WordObject that represents it
* word, string: String value of WordObject to return (required)
* useCanonical, string: If true will try to return the correct word root ('cats' -&gt; 'cat'). If false returns exactly what was requested. (optional)
* includeSuggestions, string: Return suggestions (for correct spelling, case variants, etc.) (optional)
* @return WordObject
*/
public function getWord($word, $useCanonical=null, $includeSuggestions=null) {
//parse inputs
$resourcePath = "/word.{format}/{word}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($useCanonical != null) {
$queryParams['useCanonical'] = $this->apiClient->toQueryValue($useCanonical);
}
if($includeSuggestions != null) {
$queryParams['includeSuggestions'] = $this->apiClient->toQueryValue($includeSuggestions);
}
if($word != null) {
$resourcePath = str_replace("{" . "word" . "}",
$this->apiClient->toPathValue($word), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'WordObject');
return $responseObject;
}
/**
* getDefinitions
* Return definitions for a word
* word, string: Word to return definitions for (required)
* partOfSpeech, string: CSV list of part-of-speech types (optional)
* sourceDictionaries, string: Source dictionary to return definitions from. If 'all' is received, results are returned from all sources. If multiple values are received (e.g. 'century,wiktionary'), results are returned from the first specified dictionary that has definitions. If left blank, results are returned from the first dictionary that has definitions. By default, dictionaries are searched in this order: ahd, wiktionary, webster, century, wordnet (optional)
* limit, int: Maximum number of results to return (optional)
* includeRelated, string: Return related words with definitions (optional)
* useCanonical, string: If true will try to return the correct word root ('cats' -&gt; 'cat'). If false returns exactly what was requested. (optional)
* includeTags, string: Return a closed set of XML tags in response (optional)
* @return array[Definition]
*/
public function getDefinitions($word, $partOfSpeech=null, $sourceDictionaries=null, $limit=null, $includeRelated=null, $useCanonical=null, $includeTags=null) {
//parse inputs
$resourcePath = "/word.{format}/{word}/definitions";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($limit != null) {
$queryParams['limit'] = $this->apiClient->toQueryValue($limit);
}
if($partOfSpeech != null) {
$queryParams['partOfSpeech'] = $this->apiClient->toQueryValue($partOfSpeech);
}
if($includeRelated != null) {
$queryParams['includeRelated'] = $this->apiClient->toQueryValue($includeRelated);
}
if($sourceDictionaries != null) {
$queryParams['sourceDictionaries'] = $this->apiClient->toQueryValue($sourceDictionaries);
}
if($useCanonical != null) {
$queryParams['useCanonical'] = $this->apiClient->toQueryValue($useCanonical);
}
if($includeTags != null) {
$queryParams['includeTags'] = $this->apiClient->toQueryValue($includeTags);
}
if($word != null) {
$resourcePath = str_replace("{" . "word" . "}",
$this->apiClient->toPathValue($word), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'array[Definition]');
return $responseObject;
}
/**
* getTopExample
* Returns a top example for a word
* word, string: Word to fetch examples for (required)
* useCanonical, string: If true will try to return the correct word root ('cats' -&gt; 'cat'). If false returns exactly what was requested. (optional)
* @return Example
*/
public function getTopExample($word, $useCanonical=null) {
//parse inputs
$resourcePath = "/word.{format}/{word}/topExample";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($useCanonical != null) {
$queryParams['useCanonical'] = $this->apiClient->toQueryValue($useCanonical);
}
if($word != null) {
$resourcePath = str_replace("{" . "word" . "}",
$this->apiClient->toPathValue($word), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'Example');
return $responseObject;
}
/**
* getRelatedWords
* Given a word as a string, returns relationships from the Word Graph
* word, string: Word to fetch relationships for (required)
* relationshipTypes, string: Limits the total results per type of relationship type (optional)
* useCanonical, string: If true will try to return the correct word root ('cats' -&gt; 'cat'). If false returns exactly what was requested. (optional)
* limitPerRelationshipType, int: Restrict to the supplied relatinship types (optional)
* @return array[Related]
*/
public function getRelatedWords($word, $relationshipTypes=null, $useCanonical=null, $limitPerRelationshipType=null) {
//parse inputs
$resourcePath = "/word.{format}/{word}/relatedWords";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($useCanonical != null) {
$queryParams['useCanonical'] = $this->apiClient->toQueryValue($useCanonical);
}
if($relationshipTypes != null) {
$queryParams['relationshipTypes'] = $this->apiClient->toQueryValue($relationshipTypes);
}
if($limitPerRelationshipType != null) {
$queryParams['limitPerRelationshipType'] = $this->apiClient->toQueryValue($limitPerRelationshipType);
}
if($word != null) {
$resourcePath = str_replace("{" . "word" . "}",
$this->apiClient->toPathValue($word), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'array[Related]');
return $responseObject;
}
/**
* getTextPronunciations
* Returns text pronunciations for a given word
* word, string: Word to get pronunciations for (required)
* sourceDictionary, string: Get from a single dictionary (optional)
* typeFormat, string: Text pronunciation type (optional)
* useCanonical, string: If true will try to return a correct word root ('cats' -&gt; 'cat'). If false returns exactly what was requested. (optional)
* limit, int: Maximum number of results to return (optional)
* @return array[TextPron]
*/
public function getTextPronunciations($word, $sourceDictionary=null, $typeFormat=null, $useCanonical=null, $limit=null) {
//parse inputs
$resourcePath = "/word.{format}/{word}/pronunciations";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($useCanonical != null) {
$queryParams['useCanonical'] = $this->apiClient->toQueryValue($useCanonical);
}
if($sourceDictionary != null) {
$queryParams['sourceDictionary'] = $this->apiClient->toQueryValue($sourceDictionary);
}
if($typeFormat != null) {
$queryParams['typeFormat'] = $this->apiClient->toQueryValue($typeFormat);
}
if($limit != null) {
$queryParams['limit'] = $this->apiClient->toQueryValue($limit);
}
if($word != null) {
$resourcePath = str_replace("{" . "word" . "}",
$this->apiClient->toPathValue($word), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'array[TextPron]');
return $responseObject;
}
/**
* getHyphenation
* Returns syllable information for a word
* word, string: Word to get syllables for (required)
* sourceDictionary, string: Get from a single dictionary. Valid options: ahd, century, wiktionary, webster, and wordnet. (optional)
* useCanonical, string: If true will try to return a correct word root ('cats' -&gt; 'cat'). If false returns exactly what was requested. (optional)
* limit, int: Maximum number of results to return (optional)
* @return array[Syllable]
*/
public function getHyphenation($word, $sourceDictionary=null, $useCanonical=null, $limit=null) {
//parse inputs
$resourcePath = "/word.{format}/{word}/hyphenation";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($useCanonical != null) {
$queryParams['useCanonical'] = $this->apiClient->toQueryValue($useCanonical);
}
if($sourceDictionary != null) {
$queryParams['sourceDictionary'] = $this->apiClient->toQueryValue($sourceDictionary);
}
if($limit != null) {
$queryParams['limit'] = $this->apiClient->toQueryValue($limit);
}
if($word != null) {
$resourcePath = str_replace("{" . "word" . "}",
$this->apiClient->toPathValue($word), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'array[Syllable]');
return $responseObject;
}
/**
* getWordFrequency
* Returns word usage over time
* word, string: Word to return (required)
* useCanonical, string: If true will try to return the correct word root ('cats' -&gt; 'cat'). If false returns exactly what was requested. (optional)
* startYear, int: Starting Year (optional)
* endYear, int: Ending Year (optional)
* @return FrequencySummary
*/
public function getWordFrequency($word, $useCanonical=null, $startYear=null, $endYear=null) {
//parse inputs
$resourcePath = "/word.{format}/{word}/frequency";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($useCanonical != null) {
$queryParams['useCanonical'] = $this->apiClient->toQueryValue($useCanonical);
}
if($startYear != null) {
$queryParams['startYear'] = $this->apiClient->toQueryValue($startYear);
}
if($endYear != null) {
$queryParams['endYear'] = $this->apiClient->toQueryValue($endYear);
}
if($word != null) {
$resourcePath = str_replace("{" . "word" . "}",
$this->apiClient->toPathValue($word), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'FrequencySummary');
return $responseObject;
}
/**
* getPhrases
* Fetches bi-gram phrases for a word
* word, string: Word to fetch phrases for (required)
* limit, int: Maximum number of results to return (optional)
* wlmi, int: Minimum WLMI for the phrase (optional)
* useCanonical, string: If true will try to return the correct word root ('cats' -&gt; 'cat'). If false returns exactly what was requested. (optional)
* @return array[Bigram]
*/
public function getPhrases($word, $limit=null, $wlmi=null, $useCanonical=null) {
//parse inputs
$resourcePath = "/word.{format}/{word}/phrases";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($limit != null) {
$queryParams['limit'] = $this->apiClient->toQueryValue($limit);
}
if($wlmi != null) {
$queryParams['wlmi'] = $this->apiClient->toQueryValue($wlmi);
}
if($useCanonical != null) {
$queryParams['useCanonical'] = $this->apiClient->toQueryValue($useCanonical);
}
if($word != null) {
$resourcePath = str_replace("{" . "word" . "}",
$this->apiClient->toPathValue($word), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'array[Bigram]');
return $responseObject;
}
/**
* getEtymologies
* Fetches etymology data
* word, string: Word to return (required)
* useCanonical, string: If true will try to return the correct word root ('cats' -&gt; 'cat'). If false returns exactly what was requested. (optional)
* @return array[string]
*/
public function getEtymologies($word, $useCanonical=null) {
//parse inputs
$resourcePath = "/word.{format}/{word}/etymologies";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($useCanonical != null) {
$queryParams['useCanonical'] = $this->apiClient->toQueryValue($useCanonical);
}
if($word != null) {
$resourcePath = str_replace("{" . "word" . "}",
$this->apiClient->toPathValue($word), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'array[string]');
return $responseObject;
}
/**
* getAudio
* Fetches audio metadata for a word.
* word, string: Word to get audio for. (required)
* useCanonical, string: Use the canonical form of the word (optional)
* limit, int: Maximum number of results to return (optional)
* @return array[AudioFile]
*/
public function getAudio($word, $useCanonical=null, $limit=null) {
//parse inputs
$resourcePath = "/word.{format}/{word}/audio";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($useCanonical != null) {
$queryParams['useCanonical'] = $this->apiClient->toQueryValue($useCanonical);
}
if($limit != null) {
$queryParams['limit'] = $this->apiClient->toQueryValue($limit);
}
if($word != null) {
$resourcePath = str_replace("{" . "word" . "}",
$this->apiClient->toPathValue($word), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'array[AudioFile]');
return $responseObject;
}
/**
* getScrabbleScore
* Returns the Scrabble score for a word
* word, string: Word to get scrabble score for. (required)
* @return ScrabbleScoreResult
*/
public function getScrabbleScore($word) {
//parse inputs
$resourcePath = "/word.{format}/{word}/scrabbleScore";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($word != null) {
$resourcePath = str_replace("{" . "word" . "}",
$this->apiClient->toPathValue($word), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'ScrabbleScoreResult');
return $responseObject;
}
}

View File

@ -1,301 +0,0 @@
<?php
/**
* Copyright 2014 Reverb Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
*/
class WordListApi {
function __construct($apiClient) {
$this->apiClient = $apiClient;
}
/**
* updateWordList
* Updates an existing WordList
* permalink, string: permalink of WordList to update (required)
* body, WordList: Updated WordList (optional)
* auth_token, string: The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) (required)
* @return
*/
public function updateWordList($permalink, $body=null, $auth_token) {
//parse inputs
$resourcePath = "/wordList.{format}/{permalink}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "PUT";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($auth_token != null) {
$headerParams['auth_token'] = $this->apiClient->toHeaderValue($auth_token);
}
if($permalink != null) {
$resourcePath = str_replace("{" . "permalink" . "}",
$this->apiClient->toPathValue($permalink), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
/**
* deleteWordList
* Deletes an existing WordList
* permalink, string: ID of WordList to delete (required)
* auth_token, string: The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) (required)
* @return
*/
public function deleteWordList($permalink, $auth_token) {
//parse inputs
$resourcePath = "/wordList.{format}/{permalink}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "DELETE";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($auth_token != null) {
$headerParams['auth_token'] = $this->apiClient->toHeaderValue($auth_token);
}
if($permalink != null) {
$resourcePath = str_replace("{" . "permalink" . "}",
$this->apiClient->toPathValue($permalink), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
/**
* getWordListByPermalink
* Fetches a WordList by ID
* permalink, string: permalink of WordList to fetch (required)
* auth_token, string: The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) (required)
* @return WordList
*/
public function getWordListByPermalink($permalink, $auth_token) {
//parse inputs
$resourcePath = "/wordList.{format}/{permalink}";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($auth_token != null) {
$headerParams['auth_token'] = $this->apiClient->toHeaderValue($auth_token);
}
if($permalink != null) {
$resourcePath = str_replace("{" . "permalink" . "}",
$this->apiClient->toPathValue($permalink), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'WordList');
return $responseObject;
}
/**
* addWordsToWordList
* Adds words to a WordList
* permalink, string: permalink of WordList to user (required)
* body, array[StringValue]: Array of words to add to WordList (optional)
* auth_token, string: The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) (required)
* @return
*/
public function addWordsToWordList($permalink, $body=null, $auth_token) {
//parse inputs
$resourcePath = "/wordList.{format}/{permalink}/words";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($auth_token != null) {
$headerParams['auth_token'] = $this->apiClient->toHeaderValue($auth_token);
}
if($permalink != null) {
$resourcePath = str_replace("{" . "permalink" . "}",
$this->apiClient->toPathValue($permalink), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
/**
* getWordListWords
* Fetches words in a WordList
* permalink, string: ID of WordList to use (required)
* auth_token, string: The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) (required)
* sortBy, string: Field to sort by (optional)
* sortOrder, string: Direction to sort (optional)
* skip, int: Results to skip (optional)
* limit, int: Maximum number of results to return (optional)
* @return array[WordListWord]
*/
public function getWordListWords($permalink, $auth_token, $sortBy=null, $sortOrder=null, $skip=null, $limit=null) {
//parse inputs
$resourcePath = "/wordList.{format}/{permalink}/words";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "GET";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($sortBy != null) {
$queryParams['sortBy'] = $this->apiClient->toQueryValue($sortBy);
}
if($sortOrder != null) {
$queryParams['sortOrder'] = $this->apiClient->toQueryValue($sortOrder);
}
if($skip != null) {
$queryParams['skip'] = $this->apiClient->toQueryValue($skip);
}
if($limit != null) {
$queryParams['limit'] = $this->apiClient->toQueryValue($limit);
}
if($auth_token != null) {
$headerParams['auth_token'] = $this->apiClient->toHeaderValue($auth_token);
}
if($permalink != null) {
$resourcePath = str_replace("{" . "permalink" . "}",
$this->apiClient->toPathValue($permalink), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
if(! $response){
return null;
}
$responseObject = $this->apiClient->deserialize($response,
'array[WordListWord]');
return $responseObject;
}
/**
* deleteWordsFromWordList
* Removes words from a WordList
* permalink, string: permalink of WordList to use (required)
* body, array[StringValue]: Words to remove from WordList (optional)
* auth_token, string: The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above) (required)
* @return
*/
public function deleteWordsFromWordList($permalink, $body=null, $auth_token) {
//parse inputs
$resourcePath = "/wordList.{format}/{permalink}/deleteWords";
$resourcePath = str_replace("{format}", "json", $resourcePath);
$method = "POST";
$queryParams = array();
$headerParams = array();
$headerParams['Accept'] = 'application/json';
$headerParams['Content-Type'] = 'application/json';
if($auth_token != null) {
$headerParams['auth_token'] = $this->apiClient->toHeaderValue($auth_token);
}
if($permalink != null) {
$resourcePath = str_replace("{" . "permalink" . "}",
$this->apiClient->toPathValue($permalink), $resourcePath);
}
//make the API Call
if (! isset($body)) {
$body = null;
}
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $body,
$headerParams);
}
}

Some files were not shown because too many files have changed in this diff Show More