forked from loafle/openapi-generator-original
first commit
This commit is contained in:
commit
d8c0f69ad4
28
.gitignore
vendored
Normal file
28
.gitignore
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
java/wordnik*.zip
|
||||
java/*.ipr
|
||||
java/*.iml
|
||||
java/*.iws
|
||||
java/dist/
|
||||
java/build/
|
||||
java/lib/*.jar
|
||||
java/META-INF/
|
||||
java/web/
|
||||
java/index
|
||||
java/reports/
|
||||
java/lib/*.zip
|
||||
java/logs
|
||||
java/src/main/java/com/wordnik/env/Version.scala
|
||||
java/lib/*.pom
|
||||
java/version.properties
|
||||
java/out
|
||||
android/codegen/build/
|
||||
*.iml
|
||||
out/
|
||||
*.ipr
|
||||
*.iws
|
||||
version.properties
|
||||
android/codegen/lib/
|
||||
android/driver/lib/
|
||||
android/driver/build/
|
||||
android/driver-test/build/
|
||||
android/driver-test/lib/*.jar
|
0
android/codegen/README
Normal file
0
android/codegen/README
Normal file
35
android/codegen/build.xml
Normal file
35
android/codegen/build.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="android-driver-codegen" xmlns:ivy="antlib:org.apache.ivy.ant" default="generate" basedir=".">
|
||||
<property environment="env" />
|
||||
<property name="version.identifier" value="4.04" />
|
||||
|
||||
<property name="application.description" value="Android driver code generation"/>
|
||||
<property name="application.name" value="android-driver-codegen"/>
|
||||
<condition property="build.common.dir" value="${env.BUILD_COMMON}">
|
||||
<isset property="env.BUILD_COMMON" />
|
||||
</condition>
|
||||
<echo message="using build common dir: ${build.common.dir}"/>
|
||||
|
||||
<!-- generates the driver classes -->
|
||||
<target name="generate" description="generates API and model classes">
|
||||
|
||||
<delete>
|
||||
<fileset dir="../driver/src/main/java/com/wordnik/api" includes="*.java"/>
|
||||
<fileset dir="../driver/src/main/java/com/wordnik/model" includes="*.java"/>
|
||||
</delete>
|
||||
<antcall target="compile"/>
|
||||
<java classname="com.wordnik.codegen.DriverCodeGenerator">
|
||||
<arg value="-r" />
|
||||
<classpath>
|
||||
<pathelement location="build/main/java" />
|
||||
<fileset dir="lib">
|
||||
<include name="**/*.jar"/>
|
||||
</fileset>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<import file="${build.common.dir}/ant/ant-common.xml" />
|
||||
<import file="${build.common.dir}/ant/ant-test.xml" />
|
||||
|
||||
</project>
|
38
android/codegen/conf/templates/ModelObject.st
Normal file
38
android/codegen/conf/templates/ModelObject.st
Normal file
@ -0,0 +1,38 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
$imports:{ import |
|
||||
import $import$;
|
||||
}$
|
||||
|
||||
/**
|
||||
* $model.description$
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class $className$ extends WordnikObject {
|
||||
|
||||
$fields:{ field |
|
||||
//$field.description$
|
||||
private $field.attributeDefinition.returnType$ $field.attributeDefinition.name$ $field.attributeDefinition.initialization$;
|
||||
}$
|
||||
|
||||
$fields:{ field |
|
||||
//$field.description$
|
||||
$if(field.required)$
|
||||
@Required $endif$
|
||||
$if(field.allowableValues)$
|
||||
@AllowableValues(value="$field.allowableValues$")$endif$
|
||||
public $field.attributeDefinition.returnType$ get$field.attributeDefinition.NameForMethod$() {
|
||||
return $field.attributeDefinition.name$;
|
||||
}
|
||||
|
||||
public void set$field.attributeDefinition.NameForMethod$($field.attributeDefinition.returnType$ $field.attributeDefinition.name$) {
|
||||
this.$field.attributeDefinition.name$ = $field.attributeDefinition.name$;
|
||||
}
|
||||
}$
|
||||
}
|
74
android/codegen/conf/templates/ModelObjectNew.st
Normal file
74
android/codegen/conf/templates/ModelObjectNew.st
Normal file
@ -0,0 +1,74 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import org.json.JSONObject
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONException
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
$imports:{ import |
|
||||
import $import$;
|
||||
}$
|
||||
|
||||
/**
|
||||
* $model.description$
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class $className$ extends WordnikObject {
|
||||
|
||||
$fields:{ field |
|
||||
//$field.description$
|
||||
private $field.attributeDefinition.returnType$ $field.attributeDefinition.name$ $field.attributeDefinition.initialization$;
|
||||
}$
|
||||
|
||||
$fields:{ field |
|
||||
//$field.description$
|
||||
$if(field.required)$
|
||||
@Required $endif$
|
||||
$if(field.allowableValues)$
|
||||
@AllowableValues(value="$field.allowableValues$")$endif$
|
||||
public $field.attributeDefinition.returnType$ get$field.attributeDefinition.NameForMethod$() {
|
||||
return $field.attributeDefinition.name$;
|
||||
}
|
||||
|
||||
public void set$field.attributeDefinition.NameForMethod$($field.attributeDefinition.returnType$ $field.attributeDefinition.name$) {
|
||||
this.$field.attributeDefinition.name$ = $field.attributeDefinition.name$;
|
||||
}
|
||||
}$
|
||||
|
||||
public $className$ fromJSON(String json) {
|
||||
JSONObject jso;
|
||||
try {
|
||||
jso = new JSONObject(json);
|
||||
} catch(Exception e) {
|
||||
// ignore for now
|
||||
}
|
||||
|
||||
try {
|
||||
$fields:{ field |
|
||||
if($field.attributeDefinition.returnType$.equals("Int")) {
|
||||
jso.getInt("$field.attributeDefinition.name$");
|
||||
} else if($field.attributeDefinition.returnType$.equals("Long")) {
|
||||
jso.getLong("$field.attributeDefinition.name$");
|
||||
} else if($field.attributeDefinition.returnType$.equals("Double")) {
|
||||
jso.getDouble("$field.attributeDefinition.name$");
|
||||
} else if($field.attributeDefinition.returnType$.equals("String")) {
|
||||
jso.getString("$field.attributeDefinition.name$");
|
||||
} else if($field.attributeDefinition.returnType$.equals("Boolean")) {
|
||||
jso.getBoolean("$field.attributeDefinition.name$");
|
||||
} else if($field.attributeDefinition.returnType$.startsWith("List[")) {
|
||||
// JSONArray
|
||||
} else if($field.attributeDefinition.returnType$.startsWith("Map[")) {
|
||||
// JSONArray
|
||||
} else {
|
||||
// JSONObject
|
||||
}
|
||||
}$
|
||||
} catch (JSONException e) {
|
||||
// ignore for now
|
||||
}
|
||||
}
|
||||
}
|
121
android/codegen/conf/templates/ResourceObject.st
Normal file
121
android/codegen/conf/templates/ResourceObject.st
Normal file
@ -0,0 +1,121 @@
|
||||
package com.wordnik.api;
|
||||
|
||||
|
||||
import com.wordnik.common.*;
|
||||
import com.wordnik.common.ext.*;
|
||||
import com.wordnik.exception.WordnikExceptionCodes;
|
||||
import com.wordnik.exception.WordnikAPIException;
|
||||
import com.wordnik.model.*;
|
||||
import java.util.*;
|
||||
import com.wordnik.annotations.MethodArgumentNames;
|
||||
import org.codehaus.jackson.map.DeserializationConfig.Feature;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class $resource$ extends $extends$ {
|
||||
|
||||
$methods:{ method |
|
||||
/**
|
||||
* $method.description$
|
||||
$method.arguments:{ argument |
|
||||
* @param $argument.name$ $argument.description$
|
||||
$if(argument.allowedValues)$
|
||||
* Allowed values are - $argument.allowedValues$
|
||||
$endif$
|
||||
}$
|
||||
*
|
||||
* @return $method.returnValue$ {@link $method.returnClassName$}
|
||||
* @throws WordnikAPIException $method.exceptionDescription$
|
||||
*/
|
||||
$if(method.hasArguments)$
|
||||
@MethodArgumentNames(value="$method.argumentNames; separator=", "$")
|
||||
$endif$
|
||||
|
||||
public static $method.returnValue$ $method.name$($method.argumentDefinitions; separator=", "$) throws WordnikAPIException {
|
||||
|
||||
$if(method.authToken)$
|
||||
if(authToken == null || authToken.length() == 0) {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
|
||||
}
|
||||
$endif$
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "$method.resourcePath$";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "$method.methodType$";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
$if(!method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if( $argument.name$ != null) {
|
||||
queryParams.put("$argument.name$", $argument.name$);
|
||||
}
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if( $argument.name$ != null) {
|
||||
resourcePath = resourcePath.replace("{$argument.name$}", $argument.name$);
|
||||
}
|
||||
}$
|
||||
$endif$
|
||||
$if(method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if( $argument.inputModelClassArgument$ != null && $argument.methodNameFromModelClass$ != null) {
|
||||
queryParams.put("$argument.name$", $argument.methodNameFromModelClass$);
|
||||
}
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if( $argument.inputModelClassArgument$ != null && $argument.methodNameFromModelClass$ != null) {
|
||||
resourcePath = resourcePath.replace("{$argument.name$}", $argument.methodNameFromModelClass$);
|
||||
}
|
||||
}$
|
||||
$endif$
|
||||
//make the API Call
|
||||
$if(method.postObject)$
|
||||
$if(method.authToken)$
|
||||
String response = invokeAPI(authToken, resourcePath, method, queryParams, postObject);
|
||||
$endif$
|
||||
$if(!method.authToken)$
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, postObject);
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
$if(!method.postObject)$
|
||||
$if(method.authToken)$
|
||||
String response = invokeAPI(authToken, resourcePath, method, queryParams, null);
|
||||
$endif$
|
||||
$if(!method.authToken)$
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
//create output objects if the response has more than one object
|
||||
$if(!method.responseVoid)$
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
$if(!method.returnValueList)$
|
||||
$method.returnValue$ responseObject = ($method.returnValue$)deserialize(response, $method.returnClassName$.class);
|
||||
return responseObject;
|
||||
$endif$
|
||||
$if(method.returnValueList)$
|
||||
TypeReference<ArrayList<$method.returnClassName$>> typeRef = new TypeReference<ArrayList<$method.returnClassName$>>() {
|
||||
};
|
||||
try {
|
||||
List<$method.returnClassName$> responseObject = (List<$method.returnClassName$>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
$endif$
|
||||
$endif$
|
||||
}
|
||||
|
||||
|
||||
}$
|
||||
}
|
18
android/codegen/conf/templates/VersionChecker.st
Normal file
18
android/codegen/conf/templates/VersionChecker.st
Normal file
@ -0,0 +1,18 @@
|
||||
package com.wordnik.api;
|
||||
|
||||
/**
|
||||
* Maintains the compatible server version against which the drive is written
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class VersionChecker {
|
||||
|
||||
private String compatibleVersion = "$apiVersion$";
|
||||
|
||||
/**
|
||||
* Gets the version against which the driver code was written
|
||||
*/
|
||||
public String getCompatibleVersion() {
|
||||
return compatibleVersion;
|
||||
}
|
||||
}
|
32
android/codegen/ivy.xml
Normal file
32
android/codegen/ivy.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<ivy-module version="2.0">
|
||||
<info organisation="wordnik" module="wordnik-android"/>
|
||||
<configurations>
|
||||
<conf name="build" description="build wordnik-android"/>
|
||||
<conf name="test" visibility="public"/>
|
||||
<conf name="source" visibility="public"/>
|
||||
</configurations>
|
||||
|
||||
<publications>
|
||||
<artifact name="wordnik-android" type="jar" conf="build" ext="jar"/>
|
||||
<artifact name="wordnik-android" type="distribution" conf="build" ext="zip"/>
|
||||
<artifact name="wordnik-android" type="source" conf="source" ext="zip"/>
|
||||
<artifact name="wordnik-android-test" type="jar" conf="test" ext="jar"/>
|
||||
</publications>
|
||||
|
||||
<dependencies>
|
||||
<!-- jersey dependencies -->
|
||||
<dependency org="javax.ws.rs" name="jsr311-api" rev="1.1.1" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-json" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-client" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-server" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-core" rev="1.4" conf="build->default"/>
|
||||
<dependency org="asm" name="asm-parent" rev="3.1" conf="build->default"/>
|
||||
<dependency org="commons-beanutils" name="commons-beanutils" rev="1.8.0" conf="build->default"/>
|
||||
<dependency org="org.antlr" name="stringtemplate" rev="3.2" conf="build->default"/>
|
||||
|
||||
<dependency org="net.sourceforge.cobertura" name="cobertura" rev="1.9.2" conf="test->default">
|
||||
<exclude org="asm" name="asm-tree"/>
|
||||
<exclude org="asm" name="asm"/>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</ivy-module>
|
@ -0,0 +1,367 @@
|
||||
package com.wordnik.codegen;
|
||||
|
||||
import com.sun.jersey.api.client.Client;
|
||||
import com.sun.jersey.api.client.ClientResponse;
|
||||
import com.sun.jersey.api.client.WebResource;
|
||||
import com.wordnik.exception.CodeGenerationException;
|
||||
|
||||
import org.antlr.stringtemplate.StringTemplate;
|
||||
import org.antlr.stringtemplate.StringTemplateGroup;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.map.DeserializationConfig.Feature;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: ramesh
|
||||
* Date: 3/30/11
|
||||
* Time: 6:59 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class DriverCodeGenerator {
|
||||
|
||||
private static String HEADER_NAME_API_VERSION = "Wordnik-Api-Version";
|
||||
private static String VERSION_OBJECT_TEMPLATE = "VersionChecker";
|
||||
private static String MODEL_OBJECT_TEMPLATE = "ModelObject";
|
||||
private static String API_OBJECT_TEMPLATE = "ResourceObject";
|
||||
|
||||
public static void main(String[] args) {
|
||||
DriverCodeGenerator codeGenerator = new DriverCodeGenerator();
|
||||
codeGenerator.generateCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate classes needed for the model and API invocation
|
||||
*/
|
||||
public void generateCode() {
|
||||
//read resources and get their documentation
|
||||
List<Resource> resources = this.readResourceDocumentation(
|
||||
"http://beta.wordnik.com/v4/", "word.json,words.json,wordList.json,wordLists.json,account.json");
|
||||
StringTemplateGroup aTemplateGroup = new StringTemplateGroup("templates","conf/templates");
|
||||
if(resources.size() > 0) {
|
||||
generateVersionHelper(resources.get(0).getVersion(), aTemplateGroup);
|
||||
}
|
||||
generateModelClasses(resources, aTemplateGroup);
|
||||
generateAssemblerClassesForOutput(resources, aTemplateGroup);
|
||||
generateModelClassesForInput(resources, aTemplateGroup);
|
||||
generateAPIClasses(resources, aTemplateGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the documentation of the resources and constructs the resource object that can be used
|
||||
* for generating the driver related classes. The resource list string should be "," separated
|
||||
*/
|
||||
private List<Resource> readResourceDocumentation(String baseUrl, String resourceList) {
|
||||
|
||||
List<Resource> resourceDocs = new ArrayList<Resource>();
|
||||
|
||||
//valid for input
|
||||
if (baseUrl == null || resourceList == null ||
|
||||
baseUrl.trim().length() == 0 ||
|
||||
resourceList.trim().length() == 0) {
|
||||
throw new CodeGenerationException("Base URL or Resource list input is null");
|
||||
}
|
||||
|
||||
|
||||
//create list of resource URL
|
||||
String[] resources = resourceList.split(",");
|
||||
List<String> resourceURLs = new ArrayList<String>();
|
||||
for (String resource : resources) {
|
||||
resourceURLs.add(baseUrl + resource);
|
||||
}
|
||||
|
||||
//make connection to resource and get the documentation
|
||||
for (String resourceURL : resourceURLs) {
|
||||
Client apiClient = Client.create();
|
||||
WebResource aResource = apiClient.resource(resourceURL);
|
||||
ClientResponse clientResponse = aResource.get(ClientResponse.class);
|
||||
String version = clientResponse.getHeaders().get(HEADER_NAME_API_VERSION).get(0);
|
||||
String response = clientResponse.getEntity(String.class);
|
||||
try {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.getDeserializationConfig().set(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
Resource aResourceDoc = (Resource) mapper.readValue(response, Resource.class);
|
||||
aResourceDoc.setVersion(version);
|
||||
resourceDocs.add(aResourceDoc);
|
||||
} catch (IOException ioe) {
|
||||
throw new CodeGenerationException("Erro in coversting response json value to java object");
|
||||
}
|
||||
}
|
||||
return resourceDocs;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates version file based on the version number received from the doc calls. This version file is used
|
||||
* while making the API calls to make sure Client and back end are compatible.
|
||||
* @param version
|
||||
*/
|
||||
private void generateVersionHelper(String version, StringTemplateGroup templateGroup) {
|
||||
StringTemplate template = templateGroup.getInstanceOf(VERSION_OBJECT_TEMPLATE);
|
||||
template.setAttribute("apiVersion", version);
|
||||
File aFile = new File("../driver/src/main/java/com/wordnik/api/VersionChecker.java");
|
||||
try{
|
||||
FileWriter aWriter = new FileWriter(aFile);
|
||||
BufferedWriter bufWriter = new BufferedWriter(aWriter);
|
||||
bufWriter.write(template.toString());
|
||||
bufWriter.close();
|
||||
}catch(IOException ioe){
|
||||
throw new CodeGenerationException("Error generating the versioned file: " + ioe.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates model classes. If the class is already generated then ignores the same.
|
||||
*/
|
||||
private void generateModelClasses(List<Resource> resources, StringTemplateGroup templateGroup) {
|
||||
List<String> generatedClassNames = new ArrayList();
|
||||
|
||||
for(Resource resource: resources) {
|
||||
for(Model model : resource.getModels()){
|
||||
if(!generatedClassNames.contains(model.getName())){
|
||||
List<String> imports = new ArrayList<String>();
|
||||
imports.add("com.wordnik.common.WordListType");
|
||||
for(Parameter param : model.getFields()){
|
||||
for(String importDef : param.getAttributeDefinition().getImportDefinitions()){
|
||||
if(!imports.contains(importDef)){
|
||||
imports.add(importDef);
|
||||
}
|
||||
}
|
||||
}
|
||||
StringTemplate template = templateGroup.getInstanceOf(MODEL_OBJECT_TEMPLATE);
|
||||
template.setAttribute("fields", model.getFields());
|
||||
template.setAttribute("imports", imports);
|
||||
template.setAttribute("className", model.getGenratedClassName());
|
||||
File aFile = new File("../driver/src/main/java/com/wordnik/model/"+model.getGenratedClassName()+".java");
|
||||
try{
|
||||
FileWriter aWriter = new FileWriter(aFile);
|
||||
BufferedWriter bufWriter = new BufferedWriter(aWriter);
|
||||
bufWriter.write(template.toString());
|
||||
bufWriter.close();
|
||||
}catch(IOException ioe){
|
||||
throw new CodeGenerationException("Error generating the model classes : " + ioe.getMessage());
|
||||
}
|
||||
generatedClassNames.add(model.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
generateWrapperClassForTestData(generatedClassNames, templateGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates assembler classes if the API returns more than one objects.
|
||||
* @param resources
|
||||
* @param templateGroup
|
||||
*/
|
||||
private void generateAssemblerClassesForOutput(List<Resource> resources, StringTemplateGroup templateGroup) {
|
||||
List<String> generatedClasses = new ArrayList<String>();
|
||||
for(Resource resource : resources) {
|
||||
if(resource.getEndPoints() != null) {
|
||||
for(Endpoint endpoint : resource.getEndPoints()){
|
||||
if(endpoint.getOperations() != null) {
|
||||
for(EndpointOperation operation : endpoint.getOperations()){
|
||||
Model model = operation.getModelObjectForAggregateObject(endpoint);
|
||||
if(model != null){
|
||||
if(!generatedClasses.contains(model.getName())) {
|
||||
List<String> imports = new ArrayList<String>();
|
||||
imports.add("com.wordnik.common.WordListType");
|
||||
for(Parameter param : model.getFields()){
|
||||
for(String importDef : param.getAttributeDefinition().getImportDefinitions()){
|
||||
if(!imports.contains(importDef)){
|
||||
imports.add(importDef);
|
||||
}
|
||||
}
|
||||
}
|
||||
StringTemplate template = templateGroup.getInstanceOf(MODEL_OBJECT_TEMPLATE);
|
||||
template.setAttribute("fields", model.getFields());
|
||||
template.setAttribute("imports", imports);
|
||||
template.setAttribute("className", model.getGenratedClassName());
|
||||
File aFile = new File("../driver/src/main/java/com/wordnik/model/"+model.getGenratedClassName()+".java");
|
||||
try{
|
||||
FileWriter aWriter = new FileWriter(aFile);
|
||||
BufferedWriter bufWriter = new BufferedWriter(aWriter);
|
||||
bufWriter.write(template.toString());
|
||||
bufWriter.close();
|
||||
}catch(IOException ioe){
|
||||
throw new CodeGenerationException("Error generating the assemble classes : " + ioe.getMessage());
|
||||
}
|
||||
generatedClasses.add(model.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates assembler classes if the API returns more than one objects.
|
||||
* @param resources
|
||||
* @param templateGroup
|
||||
*/
|
||||
private void generateModelClassesForInput(List<Resource> resources, StringTemplateGroup templateGroup) {
|
||||
List<String> generatedClasses = new ArrayList<String>();
|
||||
for(Resource resource : resources) {
|
||||
if(resource.getEndPoints() != null) {
|
||||
for(Endpoint endpoint : resource.getEndPoints()){
|
||||
if(endpoint.getOperations() != null) {
|
||||
for(EndpointOperation operation : endpoint.getOperations()){
|
||||
Method method = operation.generateMethod(endpoint, resource);;
|
||||
if(method.getInputModel() != null) {
|
||||
Model model = method.getInputModel();
|
||||
if(model != null){
|
||||
if(!generatedClasses.contains(model.getName())) {
|
||||
List<String> imports = new ArrayList<String>();
|
||||
imports.add("com.wordnik.common.WordListType");
|
||||
for(Parameter param : model.getFields()){
|
||||
for(String importDef : param.getAttributeDefinition().getImportDefinitions()){
|
||||
if(!imports.contains(importDef)){
|
||||
imports.add(importDef);
|
||||
}
|
||||
}
|
||||
}
|
||||
StringTemplate template = templateGroup.getInstanceOf(MODEL_OBJECT_TEMPLATE);
|
||||
|
||||
template.setAttribute("fields", model.getFields());
|
||||
template.setAttribute("imports", imports);
|
||||
template.setAttribute("className", model.getGenratedClassName());
|
||||
File aFile = new File("../driver/src/main/java/com/wordnik/model/"+model.getGenratedClassName()+".java");
|
||||
try{
|
||||
FileWriter aWriter = new FileWriter(aFile);
|
||||
BufferedWriter bufWriter = new BufferedWriter(aWriter);
|
||||
bufWriter.write(template.toString());
|
||||
bufWriter.close();
|
||||
}catch(IOException ioe){
|
||||
throw new CodeGenerationException("Error generating the input model classes " + ioe.getMessage());
|
||||
}
|
||||
generatedClasses.add(model.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates one API class for each resource and each end point in the resource is translated as method.
|
||||
* @param resources
|
||||
* @param templateGroup
|
||||
*/
|
||||
private void generateAPIClasses(List<Resource> resources, StringTemplateGroup templateGroup) {
|
||||
|
||||
for(Resource resource : resources) {
|
||||
List<Method> methods = new ArrayList<Method>();
|
||||
methods = resource.generateMethods(resource);
|
||||
StringTemplate template = templateGroup.getInstanceOf(API_OBJECT_TEMPLATE);
|
||||
String className = resource.generateClassName();
|
||||
List<Method> filteredMethods = new ArrayList<Method>();
|
||||
for(Method method:methods){
|
||||
if(!CodeGenOverridingRules.isMethodIgnored(className, method.getName())){
|
||||
filteredMethods.add(method);
|
||||
}
|
||||
}
|
||||
template.setAttribute("resource", className);
|
||||
template.setAttribute("methods", filteredMethods);
|
||||
template.setAttribute("extends", CodeGenOverridingRules.getServiceExtendingClass(className));
|
||||
|
||||
File aFile = new File("../driver/src/main/java/com/wordnik/api/"+ resource.generateClassName() +".java");
|
||||
try{
|
||||
FileWriter aWriter = new FileWriter(aFile);
|
||||
BufferedWriter bufWriter = new BufferedWriter(aWriter);
|
||||
bufWriter.write(template.toString());
|
||||
bufWriter.close();
|
||||
}catch(IOException ioe){
|
||||
throw new CodeGenerationException("Error generating the API classes : " + ioe.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a wrapper model class that contains all model classes as list of objects.
|
||||
* This class is used for storing test data
|
||||
*/
|
||||
private void generateWrapperClassForTestData(List<String> generatedClassNames, StringTemplateGroup templateGroup) {
|
||||
Model model = new Model();
|
||||
model.setName("TestData");
|
||||
model.setDescription("CLass used to store all the test data. Thsi should not be used for any development");
|
||||
List<Parameter> parameters = new ArrayList<Parameter>();
|
||||
model.setFields(parameters);
|
||||
for(String className : generatedClassNames){
|
||||
Parameter aParam = new Parameter();
|
||||
aParam.setName(convertFirstCharToSmall(className)+"List");
|
||||
aParam.setParamType("List["+className+"]");
|
||||
parameters.add(aParam);
|
||||
}
|
||||
|
||||
//add missing class from models
|
||||
Parameter aParam = new Parameter();
|
||||
aParam.setName("StringValueList");
|
||||
aParam.setParamType("List[StringValue]");
|
||||
parameters.add(aParam);
|
||||
|
||||
List<String> imports = new ArrayList<String>();
|
||||
imports.add("com.wordnik.common.WordListType");
|
||||
imports.add("com.wordnik.common.StringValue");
|
||||
|
||||
for(Parameter param : model.getFields()){
|
||||
for(String importDef : param.getAttributeDefinition().getImportDefinitions()){
|
||||
if(!imports.contains(importDef)){
|
||||
imports.add(importDef);
|
||||
}
|
||||
}
|
||||
}
|
||||
StringTemplate template = templateGroup.getInstanceOf(MODEL_OBJECT_TEMPLATE);
|
||||
template.setAttribute("fields", model.getFields());
|
||||
template.setAttribute("imports", imports);
|
||||
template.setAttribute("className", model.getGenratedClassName());
|
||||
File aFile = new File("../driver/src/main/java/com/wordnik/model/"+model.getGenratedClassName()+".java");
|
||||
try{
|
||||
FileWriter aWriter = new FileWriter(aFile);
|
||||
BufferedWriter bufWriter = new BufferedWriter(aWriter);
|
||||
bufWriter.write(template.toString());
|
||||
bufWriter.close();
|
||||
}catch(IOException ioe){
|
||||
throw new CodeGenerationException("Error generating the wrapper classes for test data file : " + ioe.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the first character of the input into string.
|
||||
* Example: If the input is word, the return value will be Word
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static String convertFirstCharToCaps(String input) {
|
||||
if(input != null && input.length() > 0) {
|
||||
return input.substring(0,1).toUpperCase() + input.substring(1);
|
||||
}else{
|
||||
throw new CodeGenerationException("Error converting input to first letter caps becuase of null input");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the first character of the input into string.
|
||||
* Example: If the input is word, the return value will be Word
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static String convertFirstCharToSmall(String input) {
|
||||
if(input != null && input.length() > 0) {
|
||||
return input.substring(0,1).toLowerCase() + input.substring(1);
|
||||
}else{
|
||||
throw new CodeGenerationException("Error converting input to first letter to lower because of null input");
|
||||
}
|
||||
}
|
||||
}
|
17
android/driver-test/bin/runandroid.sh
Executable file
17
android/driver-test/bin/runandroid.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
echo "" > classpath.txt
|
||||
for file in `ls lib`;
|
||||
do echo -n 'lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls build`;
|
||||
do echo -n 'build/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
|
||||
export CLASSPATH=$(cat classpath.txt)
|
||||
export JAVA_OPTS="${JAVA_OPTS} -DrulePath=data -Dproperty=Xmx2g -DloggerPath=$BUILD_COMMON/test-config/log4j.properties"
|
||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH "$@"
|
||||
|
35
android/driver-test/build.xml
Normal file
35
android/driver-test/build.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="android-driver-test" xmlns:ivy="antlib:org.apache.ivy.ant" default="fastdist" basedir=".">
|
||||
|
||||
<property environment="env" />
|
||||
<property name="version.identifier" value="4.04" />
|
||||
|
||||
<property name="application.description" value="Wordnik Android Driver test"/>
|
||||
<property name="application.name" value="android-driver-test"/>
|
||||
<condition property="build.common.dir" value="${env.BUILD_COMMON}">
|
||||
<isset property="env.BUILD_COMMON" />
|
||||
</condition>
|
||||
<echo message="using build common dir: ${build.common.dir}"/>
|
||||
|
||||
<!-- production api server smoke test -->
|
||||
<target name="test.production" depends="test.compile" description="tests against beta server">
|
||||
<junit printsummary="yes" fork="true">
|
||||
<formatter type="xml" />
|
||||
<classpath refid="classpath.test" />
|
||||
<jvmarg value="-DconfigFile=${build.common.dir}/test-config/config.xml"/>
|
||||
<jvmarg value="-DloggerPath=${build.common.dir}/test-config/log4j.properties"/>
|
||||
<jvmarg value="-Xmx800m" />
|
||||
<sysproperty key="rulePath"
|
||||
file="dist/data" />
|
||||
<batchtest todir="${reports.tests}">
|
||||
<fileset dir="build/test/java"
|
||||
includes="**/test/production/**/*Test.class"
|
||||
/>
|
||||
</batchtest>
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<import file="${build.common.dir}/ant/ant-common.xml" />
|
||||
<import file="${build.common.dir}/ant/ant-test.xml" />
|
||||
|
||||
</project>
|
22
android/driver-test/ivy.xml
Normal file
22
android/driver-test/ivy.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<ivy-module version="2.0">
|
||||
<info organisation="wordnik" module="wordnik-android"/>
|
||||
<configurations>
|
||||
<conf name="build" description="build wordnik-android"/>
|
||||
<conf name="test" visibility="public"/>
|
||||
<conf name="source" visibility="public"/>
|
||||
</configurations>
|
||||
|
||||
<publications>
|
||||
<artifact name="wordnik-android" type="jar" conf="build" ext="jar"/>
|
||||
<artifact name="wordnik-android" type="distribution" conf="build" ext="zip"/>
|
||||
<artifact name="wordnik-android" type="source" conf="source" ext="zip"/>
|
||||
<artifact name="wordnik-android-test" type="jar" conf="test" ext="jar"/>
|
||||
</publications>
|
||||
|
||||
<dependencies>
|
||||
<dependency org="org.codehaus.jackson" name="jackson-mapper-asl" rev="1.7.1" conf="build->default"/>
|
||||
<dependency org="commons-beanutils" name="commons-beanutils" rev="1.8.0" conf="build->default"/>
|
||||
<dependency org="org.apache.httpcomponents" name="httpclient" rev="4.0-alpha1"/>
|
||||
</dependencies>
|
||||
|
||||
</ivy-module>
|
BIN
android/driver-test/lib/ext/wordnik-java-driver-4.04.0.jar
Normal file
BIN
android/driver-test/lib/ext/wordnik-java-driver-4.04.0.jar
Normal file
Binary file not shown.
@ -0,0 +1,275 @@
|
||||
package com.wordnik.test;
|
||||
|
||||
import com.wordnik.annotations.MethodArgumentNames;
|
||||
import com.wordnik.api.WordAPI;
|
||||
import com.wordnik.common.WordnikAPI;
|
||||
import com.wordnik.exception.WordnikAPIException;
|
||||
import com.wordnik.exception.WordnikExceptionCodes;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.map.type.TypeFactory;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Instance of this class runs single test case
|
||||
* User: ramesh
|
||||
* Date: 4/22/11
|
||||
* Time: 7:32 AM
|
||||
*/
|
||||
public class TestCaseExecutor {
|
||||
|
||||
private static ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
/**
|
||||
* Follow the following argument pattern
|
||||
* First argument is api <apiKey>
|
||||
* Second argument is auth token <auth token>
|
||||
* Third argument will be name of resource
|
||||
* Fourth argument will be HTTP method name
|
||||
* Fifth argument will be suggested methdo name
|
||||
* 6th argument is for query and path parameters, if not available then gets empty string
|
||||
* 7th argument is for post data, if not available get empty string
|
||||
*
|
||||
* @param args
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
WordAPI.initialize("c23b746d074135dc9500c0a61300a3cb7647e53ec2b9b658e", "http://beta.wordnik.com/v4/", false);
|
||||
TestCaseExecutor runner = new TestCaseExecutor();
|
||||
String apiKey = args[0];
|
||||
String authToken = args[1];
|
||||
String resource = args[2];
|
||||
String method = args[3];
|
||||
String suggestedMethodName = args[4];
|
||||
Map<String, String> queryAndPathParameters = new HashMap<String, String>();
|
||||
String postData = null;
|
||||
if(args.length > 5 && args[5].length() > 0){
|
||||
String[] qpTuple = args[5].split("~");
|
||||
for(String tuple: qpTuple){
|
||||
String[] nameValue = tuple.split("=");
|
||||
queryAndPathParameters.put(nameValue[0], nameValue[1]);
|
||||
}
|
||||
}
|
||||
if(args.length > 6 ){
|
||||
postData = args[6];
|
||||
}
|
||||
queryAndPathParameters.put("authToken", authToken);
|
||||
runner.executeTestCase(resource, method, suggestedMethodName, apiKey, authToken, queryAndPathParameters,
|
||||
postData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void executeTestCase(String resourceName, String httpMethod, String suggestedName, String apiKey,
|
||||
String authToken, Map<String, String> queryAndPathParameters, String postData) {
|
||||
|
||||
String className = getAPIClassName(resourceName);
|
||||
String methodName = suggestedName;
|
||||
|
||||
//3
|
||||
try {
|
||||
Class apiClass = Class.forName("com.wordnik.api." + className);
|
||||
Method[] methods = apiClass.getMethods();
|
||||
Method methodToExecute = null;
|
||||
for(Method method : methods){
|
||||
if(method.getName().equals(methodName)){
|
||||
methodToExecute = method;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(methodToExecute != null) {
|
||||
//4
|
||||
Object[] arguments = populateArgumentsForTestCaseExecution(methodToExecute, queryAndPathParameters,
|
||||
postData);
|
||||
Object output = null;
|
||||
if(arguments != null && arguments.length > 0){
|
||||
//5
|
||||
output = methodToExecute.invoke(null, arguments);
|
||||
}else{
|
||||
//5
|
||||
output = methodToExecute.invoke(null);
|
||||
}
|
||||
//6
|
||||
System.out.println("SUCCESS");
|
||||
System.out.println(convertObjectToJSONString(output));
|
||||
|
||||
}
|
||||
}catch(WordnikAPIException e){
|
||||
System.out.println("ERROR");
|
||||
try{
|
||||
System.out.println(convertObjectToJSONString(e));
|
||||
}catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
} catch(Exception e){
|
||||
System.out.println("ERROR");
|
||||
try{
|
||||
WordnikAPIException apiException = new WordnikAPIException(WordnikExceptionCodes.SYSTEM_EXCEPTION,
|
||||
e.getMessage());
|
||||
System.out.println(convertObjectToJSONString(apiException));
|
||||
}catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of input query and path parameters and post data vlues and covenrt them to arguments that
|
||||
* can be used for calling the method. This logic will be different in each driver language depends on how method
|
||||
* input arguments are created.
|
||||
*/
|
||||
private Object[] populateArgumentsForTestCaseExecution(Method methodToExecute, Map<String, String> queryAndPathParameters,
|
||||
String postData) throws Exception {
|
||||
MethodArgumentNames argNames = methodToExecute.getAnnotation(MethodArgumentNames.class);
|
||||
String[] argNamesArray = null;
|
||||
if(argNames != null && argNames.value().length() > 0) {
|
||||
argNamesArray = argNames.value().split(",");
|
||||
}
|
||||
Class[] argTypesArray = methodToExecute.getParameterTypes();
|
||||
Object output = null;
|
||||
|
||||
if(argNamesArray != null && argNamesArray.length > 0){
|
||||
Object[] arguments = new Object[argNamesArray.length];
|
||||
|
||||
for(int i=0; i < argNamesArray.length; i++){
|
||||
Object argument = null;
|
||||
String canonicalName = argTypesArray[i].getCanonicalName();
|
||||
Class superclass = (Class)argTypesArray[i].getGenericSuperclass();
|
||||
//if the input argument is of type wordnik object then it is posisble that the object could be either
|
||||
// post data or input wrapper object created by code generator. If it is wrpper object then use the
|
||||
// individual query and path parameters to create the wrapper object. If it is post data directly
|
||||
// convert input JSON string to post data object
|
||||
if(superclass != null && superclass.getSimpleName().equalsIgnoreCase("WordnikObject")){
|
||||
if(argNamesArray[i].trim().equals("postData")){
|
||||
argument = convertJSONStringToObject(postData, argTypesArray[i]);
|
||||
}else{
|
||||
argument = populateWordnikInputModelObject(argTypesArray[i], queryAndPathParameters);
|
||||
}
|
||||
}else{
|
||||
//the aruments can be primitive types for query and path data and for post data it could be either
|
||||
//a object or collection of objects. Hence we need to identify the input is single or colection
|
||||
//based on that un-marshal the string
|
||||
if(argNamesArray[i].trim().equals("postData")){
|
||||
argument = convertJSONStringToObject(postData, argTypesArray[i]);
|
||||
}else{
|
||||
argument = queryAndPathParameters.get(argNamesArray[i].trim());
|
||||
}
|
||||
}
|
||||
arguments[i] = argument;
|
||||
}
|
||||
return arguments;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the wordnik inout object.
|
||||
* The definitions for the input will refer the attribute name directly as the input object is more of java driver concept
|
||||
* hence the test script can not create the input with reference to input object. Test scirpt will only use attribute name.
|
||||
* Example: If we are looking for a attribute called limit inside an WordExampleInput the input definitions in test script
|
||||
* will have an entry as "input":10 (please note that there is no reference to input object)
|
||||
* @param inputDefinitions
|
||||
* @return
|
||||
*/
|
||||
private Object populateWordnikInputModelObject(Class wordnikClass, Map<String, String> inputDefinitions) throws Exception {
|
||||
Object object = wordnikClass.getConstructor().newInstance();
|
||||
Method[] methods = wordnikClass.getMethods();
|
||||
for(Method method : methods){
|
||||
if(method.getName().startsWith("get")){
|
||||
String methodName = method.getName();
|
||||
String fieldName = methodName.substring(3);
|
||||
fieldName = convertFirstCharToSmall(fieldName);
|
||||
Object value = inputDefinitions.get(fieldName);
|
||||
BeanUtils.setProperty(object, fieldName, value);
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the first character of the input into string.
|
||||
* Example: If the input is word, the return value will be Word
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static String convertFirstCharToCaps(String input) {
|
||||
if(input != null && input.length() > 0) {
|
||||
return input.substring(0,1).toUpperCase() + input.substring(1);
|
||||
} else {
|
||||
throw new RuntimeException("Error converting input to first letter caps becuase of null input");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the first character of the input into string.
|
||||
* Example: If the input is word, the return value will be Word
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static String convertFirstCharToSmall(String input) {
|
||||
if(input != null && input.length() > 0) {
|
||||
return input.substring(0,1).toLowerCase() + input.substring(1);
|
||||
}else{
|
||||
throw new RuntimeException("Error converting input to first letter to lower because of null input");
|
||||
}
|
||||
}
|
||||
|
||||
public static String getAPIClassName(String resourcePath) {
|
||||
String className = null;
|
||||
int index = resourcePath.indexOf(".");
|
||||
if(index >= 0) {
|
||||
String resourceName = resourcePath.substring(1,index);
|
||||
className = convertFirstCharToCaps(resourceName)+"API";
|
||||
}else{
|
||||
String[] paths = resourcePath.split("/");
|
||||
for(String path : paths) {
|
||||
if(path != null && path.length() > 0) {
|
||||
className = convertFirstCharToCaps(path)+"API";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return className;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts JSON string to object.
|
||||
*/
|
||||
public Object convertJSONStringToObject(String inputJSON, Class objectType) throws Exception {
|
||||
boolean isArray = false;
|
||||
boolean isList = false;
|
||||
Class className = objectType;
|
||||
String ObjectTypeName = objectType.getName();
|
||||
|
||||
//identify if the input is a array
|
||||
if(ObjectTypeName.startsWith("[")){
|
||||
isArray = true;
|
||||
className = objectType.getComponentType();
|
||||
}
|
||||
|
||||
//identify if the input is a list
|
||||
if(List.class.isAssignableFrom(objectType)){
|
||||
isList = true;
|
||||
}
|
||||
|
||||
if(isArray || isList){
|
||||
Object responseObject = mapper.readValue(inputJSON, TypeFactory.type(objectType));
|
||||
return responseObject;
|
||||
}else{
|
||||
return WordnikAPI.deserialize(inputJSON, className);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts JSON string to object.
|
||||
*/
|
||||
public static String convertObjectToJSONString(Object input) throws Exception {
|
||||
return WordnikAPI.serialize(input);
|
||||
}
|
||||
|
||||
}
|
95
android/driver/build.xml
Normal file
95
android/driver/build.xml
Normal file
@ -0,0 +1,95 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="java-driver" xmlns:ivy="antlib:org.apache.ivy.ant" default="fastdist" basedir=".">
|
||||
|
||||
<property environment="env" />
|
||||
<property name="version.identifier" value="4.04" />
|
||||
|
||||
<property name="application.description" value="Wordnik Android Driver"/>
|
||||
<property name="application.name" value="android-driver"/>
|
||||
<condition property="build.common.dir" value="${env.BUILD_COMMON}">
|
||||
<isset property="env.BUILD_COMMON" />
|
||||
</condition>
|
||||
<echo message="using build common dir: ${build.common.dir}"/>
|
||||
|
||||
<!-- cleans up the dist -->
|
||||
<target name="dist.clean">
|
||||
<delete quiet="true" dir="dist"/>
|
||||
<delete quiet="true" file="dist.zip"/>
|
||||
</target>
|
||||
|
||||
<!-- creates a distribution of the api server -->
|
||||
<target name="dist" depends="compile">
|
||||
<!-- make dist -->
|
||||
<delete dir="dist"/>
|
||||
|
||||
<mkdir dir="dist"/>
|
||||
<mkdir dir="dist/lib"/>
|
||||
<mkdir dir="dist/logs"/>
|
||||
|
||||
<!-- copy all jars -->
|
||||
<copy todir="dist/lib">
|
||||
<fileset dir="lib">
|
||||
<include name="*.jar"/>
|
||||
<!-- skip the test jars -->
|
||||
<exclude name="*-test-*.jar"/>
|
||||
</fileset>
|
||||
<fileset dir="build">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<copy todir="dist/lib">
|
||||
<fileset dir="lib/ext"/>
|
||||
</copy>
|
||||
|
||||
<!-- unzip the text-data -->
|
||||
<unzip dest="dist">
|
||||
<fileset dir="lib">
|
||||
<include name="wordnik-*.zip"/>
|
||||
</fileset>
|
||||
</unzip>
|
||||
|
||||
<mkdir dir="dist/conf"/>
|
||||
|
||||
<!-- clean up old dists -->
|
||||
<delete quiet="true">
|
||||
<fileset dir=".">
|
||||
<include name="wordnik-java-*.zip"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
<zip destfile="${organization}-${release.module}-${release.version}.zip">
|
||||
<zipfileset dir="dist" prefix="${release.module}-${release.version}" includes="**/*"/>
|
||||
</zip>
|
||||
<copy todir="build">
|
||||
<fileset dir=".">
|
||||
<include name="wordnik-*.zip"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="jar" depends="compile">
|
||||
<delete dir="build/main/java/lib"/>
|
||||
<mkdir dir="build/main/java/lib"/>
|
||||
|
||||
<copy todir="build/main/java/lib">
|
||||
<fileset dir="lib/ext"/>
|
||||
</copy>
|
||||
<copy todir="build/main/java/lib">
|
||||
<fileset dir="lib">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
<fileset dir="build">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<jar basedir="build/main/java" file="import-logs.jar"/>
|
||||
|
||||
<delete dir="build/main/java/lib"/>
|
||||
</target>
|
||||
|
||||
<import file="${build.common.dir}/ant/ant-common.xml" />
|
||||
<import file="${build.common.dir}/ant/ant-test.xml" />
|
||||
|
||||
</project>
|
20
android/driver/ivy.xml
Normal file
20
android/driver/ivy.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<ivy-module version="2.0">
|
||||
<info organisation="wordnik" module="wordnik-android"/>
|
||||
<configurations>
|
||||
<conf name="build" description="build wordnik-android"/>
|
||||
<conf name="test" visibility="public"/>
|
||||
<conf name="source" visibility="public"/>
|
||||
</configurations>
|
||||
|
||||
<publications>
|
||||
<artifact name="wordnik-android" type="jar" conf="build" ext="jar"/>
|
||||
<artifact name="wordnik-android" type="distribution" conf="build" ext="zip"/>
|
||||
<artifact name="wordnik-android" type="source" conf="source" ext="zip"/>
|
||||
<artifact name="wordnik-android-test" type="jar" conf="test" ext="jar"/>
|
||||
</publications>
|
||||
|
||||
<dependencies>
|
||||
<dependency org="org.codehaus.jackson" name="jackson-mapper-asl" rev="1.7.1" conf="build->default"/>
|
||||
</dependencies>
|
||||
|
||||
</ivy-module>
|
290
android/driver/src/main/java/com/wordnik/api/AccountAPI.java
Normal file
290
android/driver/src/main/java/com/wordnik/api/AccountAPI.java
Normal file
@ -0,0 +1,290 @@
|
||||
package com.wordnik.api;
|
||||
|
||||
|
||||
import com.wordnik.common.*;
|
||||
import com.wordnik.common.ext.*;
|
||||
import com.wordnik.exception.WordnikExceptionCodes;
|
||||
import com.wordnik.exception.WordnikAPIException;
|
||||
import com.wordnik.model.*;
|
||||
import java.util.*;
|
||||
import com.wordnik.annotations.MethodArgumentNames;
|
||||
import org.codehaus.jackson.map.DeserializationConfig.Feature;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class AccountAPI extends WordnikAPI {
|
||||
|
||||
/**
|
||||
* Authenticates a User
|
||||
|
||||
* @param username A confirmed Wordnik username
|
||||
|
||||
* @param password The user's password
|
||||
|
||||
|
||||
*
|
||||
* @return AuthenticationToken {@link AuthenticationToken}
|
||||
* @throws WordnikAPIException 403 - Account not available. 404 - User not found.
|
||||
*/
|
||||
@MethodArgumentNames(value="username, password")
|
||||
public static AuthenticationToken authenticate(String username, String password) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/account.{format}/authenticate/{username}";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( password != null) {
|
||||
queryParams.put("password", password);
|
||||
}
|
||||
|
||||
if( username != null) {
|
||||
resourcePath = resourcePath.replace("{username}", username);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
AuthenticationToken responseObject = (AuthenticationToken)deserialize(response, AuthenticationToken.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns usage statistics for the API account.
|
||||
|
||||
*
|
||||
* @return ApiTokenStatus {@link ApiTokenStatus}
|
||||
* @throws WordnikAPIException 400 - No token supplied. 404 - No API account with supplied token.
|
||||
*/
|
||||
public static ApiTokenStatus getApiTokenStatus() throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/account.{format}/apiTokenStatus";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
ApiTokenStatus responseObject = (ApiTokenStatus)deserialize(response, ApiTokenStatus.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an ApiResponse indicating whether or not a username is available
|
||||
|
||||
* @param username Username
|
||||
|
||||
|
||||
*
|
||||
* @return ApiResponse {@link ApiResponse}
|
||||
* @throws WordnikAPIException 400 - Invalid username supplied. 404 - No activation code available.
|
||||
*/
|
||||
@MethodArgumentNames(value="username")
|
||||
public static ApiResponse getUsernameAvailable(String username) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/account.{format}/usernameAvailable/{username}";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( username != null) {
|
||||
resourcePath = resourcePath.replace("{username}", username);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
ApiResponse responseObject = (ApiResponse)deserialize(response, ApiResponse.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Regenerates an API Token. Currently not supported or tested.
|
||||
|
||||
*
|
||||
* @return void {@link Void}
|
||||
* @throws WordnikAPIException 400 - Invalid token supplied.
|
||||
*/
|
||||
public static void createApiAccount() throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/account.{format}/regenerateApiToken";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Authenticates a user
|
||||
|
||||
* @param username A confirmed Wordnik username
|
||||
|
||||
* @param postObject The user's password
|
||||
|
||||
|
||||
*
|
||||
* @return AuthenticationToken {@link AuthenticationToken}
|
||||
* @throws WordnikAPIException 403 - Account not available. 404 - User not found.
|
||||
*/
|
||||
@MethodArgumentNames(value="username, postObject")
|
||||
public static AuthenticationToken authenticatePost(String username, String postObject) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/account.{format}/authenticate/{username}";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "POST";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( username != null) {
|
||||
resourcePath = resourcePath.replace("{username}", username);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
|
||||
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, postObject);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
AuthenticationToken responseObject = (AuthenticationToken)deserialize(response, AuthenticationToken.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the logged-in User
|
||||
Requires a valid auth_token to be set.
|
||||
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
|
||||
|
||||
|
||||
*
|
||||
* @return User {@link User}
|
||||
* @throws WordnikAPIException 403 - Not logged in. 404 - User not found.
|
||||
*/
|
||||
@MethodArgumentNames(value="authToken")
|
||||
public static User getLoggedInUser(String authToken) throws WordnikAPIException {
|
||||
|
||||
if(authToken == null || authToken.length() == 0) {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
|
||||
}
|
||||
//parse inputs
|
||||
String resourcePath = "/account.{format}/user";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(authToken, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
User responseObject = (User)deserialize(response, User.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches WordList objects for the logged-in user.
|
||||
|
||||
* @param authToken auth_token of logged-in user
|
||||
|
||||
* @param skip Results to skip
|
||||
|
||||
* @param limit Maximum number of results to return
|
||||
|
||||
|
||||
*
|
||||
* @return List<WordList> {@link WordList}
|
||||
* @throws WordnikAPIException 403 - Not authenticated. 404 - User account not found.
|
||||
*/
|
||||
@MethodArgumentNames(value="authToken, skip, limit")
|
||||
public static List<WordList> getWordListsForCurrentUser(String authToken, String skip, String limit) throws WordnikAPIException {
|
||||
|
||||
if(authToken == null || authToken.length() == 0) {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
|
||||
}
|
||||
//parse inputs
|
||||
String resourcePath = "/account.{format}/wordLists";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( skip != null) {
|
||||
queryParams.put("skip", skip);
|
||||
}
|
||||
if( limit != null) {
|
||||
queryParams.put("limit", limit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(authToken, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeReference<ArrayList<WordList>> typeRef = new TypeReference<ArrayList<WordList>>() {
|
||||
};
|
||||
try {
|
||||
List<WordList> responseObject = (List<WordList>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.wordnik.api;
|
||||
|
||||
/**
|
||||
* Maintains the compatible server version against which the drive is written
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class VersionChecker {
|
||||
|
||||
private String compatibleVersion = "4.05.30";
|
||||
|
||||
/**
|
||||
* Gets the version against which the driver code was written
|
||||
*/
|
||||
public String getCompatibleVersion() {
|
||||
return compatibleVersion;
|
||||
}
|
||||
}
|
635
android/driver/src/main/java/com/wordnik/api/WordAPI.java
Normal file
635
android/driver/src/main/java/com/wordnik/api/WordAPI.java
Normal file
@ -0,0 +1,635 @@
|
||||
package com.wordnik.api;
|
||||
|
||||
|
||||
import com.wordnik.common.*;
|
||||
import com.wordnik.common.ext.*;
|
||||
import com.wordnik.exception.WordnikExceptionCodes;
|
||||
import com.wordnik.exception.WordnikAPIException;
|
||||
import com.wordnik.model.*;
|
||||
import java.util.*;
|
||||
import com.wordnik.annotations.MethodArgumentNames;
|
||||
import org.codehaus.jackson.map.DeserializationConfig.Feature;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordAPI extends AbstractWordAPI {
|
||||
|
||||
/**
|
||||
* Given a word as a string, returns the WordObject that represents it
|
||||
|
||||
* @param word String value of WordObject to return
|
||||
|
||||
* @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
||||
|
||||
* @param includeSuggestions Return suggestions (for correct spelling, case variants, etc.)
|
||||
|
||||
|
||||
*
|
||||
* @return WordObject {@link WordObject}
|
||||
* @throws WordnikAPIException 400 - Invalid word supplied.
|
||||
*/
|
||||
@MethodArgumentNames(value="word, useCanonical, includeSuggestions")
|
||||
public static WordObject getWord(String word, String useCanonical, String includeSuggestions) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/word.{format}/{word}";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( useCanonical != null) {
|
||||
queryParams.put("useCanonical", useCanonical);
|
||||
}
|
||||
if( includeSuggestions != null) {
|
||||
queryParams.put("includeSuggestions", includeSuggestions);
|
||||
}
|
||||
|
||||
if( word != null) {
|
||||
resourcePath = resourcePath.replace("{word}", word);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
WordObject responseObject = (WordObject)deserialize(response, WordObject.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns examples for a word
|
||||
|
||||
* @param wordExamplesInput
|
||||
|
||||
|
||||
*
|
||||
* @return ExampleSearchResults {@link ExampleSearchResults}
|
||||
* @throws WordnikAPIException 400 - Invalid word supplied.
|
||||
*/
|
||||
@MethodArgumentNames(value="wordExamplesInput")
|
||||
public static ExampleSearchResults getExamples(WordExamplesInput wordExamplesInput) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/word.{format}/{word}/examples";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
if( wordExamplesInput != null && wordExamplesInput.getLimit() != null) {
|
||||
queryParams.put("limit", wordExamplesInput.getLimit());
|
||||
}
|
||||
if( wordExamplesInput != null && wordExamplesInput.getIncludeDuplicates() != null) {
|
||||
queryParams.put("includeDuplicates", wordExamplesInput.getIncludeDuplicates());
|
||||
}
|
||||
if( wordExamplesInput != null && wordExamplesInput.getContentProvider() != null) {
|
||||
queryParams.put("contentProvider", wordExamplesInput.getContentProvider());
|
||||
}
|
||||
if( wordExamplesInput != null && wordExamplesInput.getUseCanonical() != null) {
|
||||
queryParams.put("useCanonical", wordExamplesInput.getUseCanonical());
|
||||
}
|
||||
if( wordExamplesInput != null && wordExamplesInput.getSkip() != null) {
|
||||
queryParams.put("skip", wordExamplesInput.getSkip());
|
||||
}
|
||||
|
||||
if( wordExamplesInput != null && wordExamplesInput.getWord() != null) {
|
||||
resourcePath = resourcePath.replace("{word}", wordExamplesInput.getWord());
|
||||
}
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
ExampleSearchResults responseObject = (ExampleSearchResults)deserialize(response, ExampleSearchResults.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return definitions for a word
|
||||
|
||||
* @param wordDefinitionsInput
|
||||
|
||||
|
||||
*
|
||||
* @return List<Definition> {@link Definition}
|
||||
* @throws WordnikAPIException 400 - Invalid word supplied. 404 - No definitions found.
|
||||
*/
|
||||
@MethodArgumentNames(value="wordDefinitionsInput")
|
||||
public static List<Definition> getDefinitions(WordDefinitionsInput wordDefinitionsInput) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/word.{format}/{word}/definitions";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
if( wordDefinitionsInput != null && wordDefinitionsInput.getLimit() != null) {
|
||||
queryParams.put("limit", wordDefinitionsInput.getLimit());
|
||||
}
|
||||
if( wordDefinitionsInput != null && wordDefinitionsInput.getPartOfSpeech() != null) {
|
||||
queryParams.put("partOfSpeech", wordDefinitionsInput.getPartOfSpeech());
|
||||
}
|
||||
if( wordDefinitionsInput != null && wordDefinitionsInput.getIncludeRelated() != null) {
|
||||
queryParams.put("includeRelated", wordDefinitionsInput.getIncludeRelated());
|
||||
}
|
||||
if( wordDefinitionsInput != null && wordDefinitionsInput.getSourceDictionaries() != null) {
|
||||
queryParams.put("sourceDictionaries", wordDefinitionsInput.getSourceDictionaries());
|
||||
}
|
||||
if( wordDefinitionsInput != null && wordDefinitionsInput.getUseCanonical() != null) {
|
||||
queryParams.put("useCanonical", wordDefinitionsInput.getUseCanonical());
|
||||
}
|
||||
if( wordDefinitionsInput != null && wordDefinitionsInput.getIncludeTags() != null) {
|
||||
queryParams.put("includeTags", wordDefinitionsInput.getIncludeTags());
|
||||
}
|
||||
|
||||
if( wordDefinitionsInput != null && wordDefinitionsInput.getWord() != null) {
|
||||
resourcePath = resourcePath.replace("{word}", wordDefinitionsInput.getWord());
|
||||
}
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeReference<ArrayList<Definition>> typeRef = new TypeReference<ArrayList<Definition>>() {
|
||||
};
|
||||
try {
|
||||
List<Definition> responseObject = (List<Definition>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a top example for a word
|
||||
|
||||
* @param word Word to fetch examples for
|
||||
|
||||
* @param contentProvider Return results from a specific ContentProvider
|
||||
|
||||
* @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
||||
|
||||
|
||||
*
|
||||
* @return Example {@link Example}
|
||||
* @throws WordnikAPIException 400 - Invalid word supplied.
|
||||
*/
|
||||
@MethodArgumentNames(value="word, contentProvider, useCanonical")
|
||||
public static Example getTopExample(String word, String contentProvider, String useCanonical) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/word.{format}/{word}/topExample";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( contentProvider != null) {
|
||||
queryParams.put("contentProvider", contentProvider);
|
||||
}
|
||||
if( useCanonical != null) {
|
||||
queryParams.put("useCanonical", useCanonical);
|
||||
}
|
||||
|
||||
if( word != null) {
|
||||
resourcePath = resourcePath.replace("{word}", word);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
Example responseObject = (Example)deserialize(response, Example.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return related words (thesaurus data) for a word
|
||||
|
||||
* @param wordRelatedInput
|
||||
|
||||
|
||||
*
|
||||
* @return List<Related> {@link Related}
|
||||
* @throws WordnikAPIException 400 - Invalid word supplied. 404 - No definitions found.
|
||||
*/
|
||||
@MethodArgumentNames(value="wordRelatedInput")
|
||||
public static List<Related> getRelatedWords(WordRelatedInput wordRelatedInput) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/word.{format}/{word}/related";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
if( wordRelatedInput != null && wordRelatedInput.getPartOfSpeech() != null) {
|
||||
queryParams.put("partOfSpeech", wordRelatedInput.getPartOfSpeech());
|
||||
}
|
||||
if( wordRelatedInput != null && wordRelatedInput.getSourceDictionary() != null) {
|
||||
queryParams.put("sourceDictionary", wordRelatedInput.getSourceDictionary());
|
||||
}
|
||||
if( wordRelatedInput != null && wordRelatedInput.getLimit() != null) {
|
||||
queryParams.put("limit", wordRelatedInput.getLimit());
|
||||
}
|
||||
if( wordRelatedInput != null && wordRelatedInput.getUseCanonical() != null) {
|
||||
queryParams.put("useCanonical", wordRelatedInput.getUseCanonical());
|
||||
}
|
||||
if( wordRelatedInput != null && wordRelatedInput.getType() != null) {
|
||||
queryParams.put("type", wordRelatedInput.getType());
|
||||
}
|
||||
|
||||
if( wordRelatedInput != null && wordRelatedInput.getWord() != null) {
|
||||
resourcePath = resourcePath.replace("{word}", wordRelatedInput.getWord());
|
||||
}
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeReference<ArrayList<Related>> typeRef = new TypeReference<ArrayList<Related>>() {
|
||||
};
|
||||
try {
|
||||
List<Related> responseObject = (List<Related>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches bi-gram phrases for a word
|
||||
|
||||
* @param word Word to fetch phrases for
|
||||
|
||||
* @param limit Maximum number of results to return
|
||||
|
||||
* @param wlmi Minimum WLMI for the phrase
|
||||
|
||||
* @param useCanonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
||||
|
||||
|
||||
*
|
||||
* @return List<Bigram> {@link Bigram}
|
||||
* @throws WordnikAPIException 400 - Invalid word supplied.
|
||||
*/
|
||||
@MethodArgumentNames(value="word, limit, wlmi, useCanonical")
|
||||
public static List<Bigram> getPhrases(String word, String limit, String wlmi, String useCanonical) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/word.{format}/{word}/phrases";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( limit != null) {
|
||||
queryParams.put("limit", limit);
|
||||
}
|
||||
if( wlmi != null) {
|
||||
queryParams.put("wlmi", wlmi);
|
||||
}
|
||||
if( useCanonical != null) {
|
||||
queryParams.put("useCanonical", useCanonical);
|
||||
}
|
||||
|
||||
if( word != null) {
|
||||
resourcePath = resourcePath.replace("{word}", word);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeReference<ArrayList<Bigram>> typeRef = new TypeReference<ArrayList<Bigram>>() {
|
||||
};
|
||||
try {
|
||||
List<Bigram> responseObject = (List<Bigram>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns syllable information for a word
|
||||
|
||||
* @param word Word to get syllables for
|
||||
|
||||
* @param useCanonical If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
||||
|
||||
* @param sourceDictionary Get from a single dictionary. Valid options: ahd, century, wiktionary, webster, and wordnet.
|
||||
|
||||
* @param limit Maximum number of results to return
|
||||
|
||||
|
||||
*
|
||||
* @return List<Syllable> {@link Syllable}
|
||||
* @throws WordnikAPIException 400 - Invalid word supplied.
|
||||
*/
|
||||
@MethodArgumentNames(value="word, useCanonical, sourceDictionary, limit")
|
||||
public static List<Syllable> getHyphenation(String word, String useCanonical, String sourceDictionary, String limit) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/word.{format}/{word}/hyphenation";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( useCanonical != null) {
|
||||
queryParams.put("useCanonical", useCanonical);
|
||||
}
|
||||
if( sourceDictionary != null) {
|
||||
queryParams.put("sourceDictionary", sourceDictionary);
|
||||
}
|
||||
if( limit != null) {
|
||||
queryParams.put("limit", limit);
|
||||
}
|
||||
|
||||
if( word != null) {
|
||||
resourcePath = resourcePath.replace("{word}", word);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeReference<ArrayList<Syllable>> typeRef = new TypeReference<ArrayList<Syllable>>() {
|
||||
};
|
||||
try {
|
||||
List<Syllable> responseObject = (List<Syllable>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns text pronunciations for a given word
|
||||
|
||||
* @param wordPronunciationsInput
|
||||
|
||||
|
||||
*
|
||||
* @return List<TextPron> {@link TextPron}
|
||||
* @throws WordnikAPIException 400 - Invalid word supplied.
|
||||
*/
|
||||
@MethodArgumentNames(value="wordPronunciationsInput")
|
||||
public static List<TextPron> getTextPronunciations(WordPronunciationsInput wordPronunciationsInput) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/word.{format}/{word}/pronunciations";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
if( wordPronunciationsInput != null && wordPronunciationsInput.getUseCanonical() != null) {
|
||||
queryParams.put("useCanonical", wordPronunciationsInput.getUseCanonical());
|
||||
}
|
||||
if( wordPronunciationsInput != null && wordPronunciationsInput.getSourceDictionary() != null) {
|
||||
queryParams.put("sourceDictionary", wordPronunciationsInput.getSourceDictionary());
|
||||
}
|
||||
if( wordPronunciationsInput != null && wordPronunciationsInput.getTypeFormat() != null) {
|
||||
queryParams.put("typeFormat", wordPronunciationsInput.getTypeFormat());
|
||||
}
|
||||
if( wordPronunciationsInput != null && wordPronunciationsInput.getLimit() != null) {
|
||||
queryParams.put("limit", wordPronunciationsInput.getLimit());
|
||||
}
|
||||
|
||||
if( wordPronunciationsInput != null && wordPronunciationsInput.getWord() != null) {
|
||||
resourcePath = resourcePath.replace("{word}", wordPronunciationsInput.getWord());
|
||||
}
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeReference<ArrayList<TextPron>> typeRef = new TypeReference<ArrayList<TextPron>>() {
|
||||
};
|
||||
try {
|
||||
List<TextPron> responseObject = (List<TextPron>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns other forms of a word
|
||||
|
||||
* @param word Word to fetch forms for
|
||||
|
||||
* @param useCanonical If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
||||
|
||||
|
||||
*
|
||||
* @return RelationshipMap {@link RelationshipMap}
|
||||
* @throws WordnikAPIException 400 - Invalid word supplied. 404 - No results.
|
||||
*/
|
||||
@MethodArgumentNames(value="word, useCanonical")
|
||||
public static RelationshipMap getWordForms(String word, String useCanonical) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/word.{format}/{word}/wordForms";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( useCanonical != null) {
|
||||
queryParams.put("useCanonical", useCanonical);
|
||||
}
|
||||
|
||||
if( word != null) {
|
||||
resourcePath = resourcePath.replace("{word}", word);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
RelationshipMap responseObject = (RelationshipMap)deserialize(response, RelationshipMap.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns definitions for a word based on the sentence in which it is found
|
||||
Use the offset parameter when the word occurs more than once in the sentence
|
||||
* @param wordContextualLookupInput
|
||||
|
||||
|
||||
*
|
||||
* @return DefinitionSearchResults {@link DefinitionSearchResults}
|
||||
* @throws WordnikAPIException 400 - Invalid word supplied.
|
||||
*/
|
||||
@MethodArgumentNames(value="wordContextualLookupInput")
|
||||
public static DefinitionSearchResults contextualLookup(WordContextualLookupInput wordContextualLookupInput) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/word.{format}/{word}/contextualLookup";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getSentence() != null) {
|
||||
queryParams.put("sentence", wordContextualLookupInput.getSentence());
|
||||
}
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getOffset() != null) {
|
||||
queryParams.put("offset", wordContextualLookupInput.getOffset());
|
||||
}
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getExpandTerms() != null) {
|
||||
queryParams.put("expandTerms", wordContextualLookupInput.getExpandTerms());
|
||||
}
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getIncludeSourceDictionaries() != null) {
|
||||
queryParams.put("includeSourceDictionaries", wordContextualLookupInput.getIncludeSourceDictionaries());
|
||||
}
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getExcludeSourceDictionaries() != null) {
|
||||
queryParams.put("excludeSourceDictionaries", wordContextualLookupInput.getExcludeSourceDictionaries());
|
||||
}
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getSkip() != null) {
|
||||
queryParams.put("skip", wordContextualLookupInput.getSkip());
|
||||
}
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getLimit() != null) {
|
||||
queryParams.put("limit", wordContextualLookupInput.getLimit());
|
||||
}
|
||||
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getWord() != null) {
|
||||
resourcePath = resourcePath.replace("{word}", wordContextualLookupInput.getWord());
|
||||
}
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
DefinitionSearchResults responseObject = (DefinitionSearchResults)deserialize(response, DefinitionSearchResults.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns definitions for a word based on the sentence in which it is found
|
||||
Use the offset parameter when the word occurs more than once in the sentence
|
||||
* @param postObject The sentence in which the word occurs
|
||||
|
||||
* @param wordContextualLookupInput
|
||||
|
||||
|
||||
*
|
||||
* @return DefinitionSearchResults {@link DefinitionSearchResults}
|
||||
* @throws WordnikAPIException 400 - Invalid term supplied.
|
||||
*/
|
||||
@MethodArgumentNames(value="postObject, wordContextualLookupInput")
|
||||
public static DefinitionSearchResults contextualLookupPost(String postObject, WordContextualLookupInput wordContextualLookupInput) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/word.{format}/{word}/contextualLookup";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "POST";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getOffset() != null) {
|
||||
queryParams.put("offset", wordContextualLookupInput.getOffset());
|
||||
}
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getExpandTerms() != null) {
|
||||
queryParams.put("expandTerms", wordContextualLookupInput.getExpandTerms());
|
||||
}
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getIncludeSourceDictionaries() != null) {
|
||||
queryParams.put("includeSourceDictionaries", wordContextualLookupInput.getIncludeSourceDictionaries());
|
||||
}
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getExcludeSourceDictionaries() != null) {
|
||||
queryParams.put("excludeSourceDictionaries", wordContextualLookupInput.getExcludeSourceDictionaries());
|
||||
}
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getSkip() != null) {
|
||||
queryParams.put("skip", wordContextualLookupInput.getSkip());
|
||||
}
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getLimit() != null) {
|
||||
queryParams.put("limit", wordContextualLookupInput.getLimit());
|
||||
}
|
||||
|
||||
if( wordContextualLookupInput != null && wordContextualLookupInput.getWord() != null) {
|
||||
resourcePath = resourcePath.replace("{word}", wordContextualLookupInput.getWord());
|
||||
}
|
||||
|
||||
//make the API Call
|
||||
|
||||
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, postObject);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
DefinitionSearchResults responseObject = (DefinitionSearchResults)deserialize(response, DefinitionSearchResults.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
282
android/driver/src/main/java/com/wordnik/api/WordListAPI.java
Normal file
282
android/driver/src/main/java/com/wordnik/api/WordListAPI.java
Normal file
@ -0,0 +1,282 @@
|
||||
package com.wordnik.api;
|
||||
|
||||
|
||||
import com.wordnik.common.*;
|
||||
import com.wordnik.common.ext.*;
|
||||
import com.wordnik.exception.WordnikExceptionCodes;
|
||||
import com.wordnik.exception.WordnikAPIException;
|
||||
import com.wordnik.model.*;
|
||||
import java.util.*;
|
||||
import com.wordnik.annotations.MethodArgumentNames;
|
||||
import org.codehaus.jackson.map.DeserializationConfig.Feature;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordListAPI extends WordnikAPI {
|
||||
|
||||
/**
|
||||
* Fetches a WordList by ID
|
||||
|
||||
* @param wordListId ID of WordList to fetch
|
||||
|
||||
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
|
||||
|
||||
|
||||
*
|
||||
* @return WordList {@link WordList}
|
||||
* @throws WordnikAPIException 400 - Invalid ID supplied 403 - Not Authorized to access WordList 404 - WordList not found
|
||||
*/
|
||||
@MethodArgumentNames(value="wordListId, authToken")
|
||||
public static WordList getWordListById(String wordListId, String authToken) throws WordnikAPIException {
|
||||
|
||||
if(authToken == null || authToken.length() == 0) {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
|
||||
}
|
||||
//parse inputs
|
||||
String resourcePath = "/wordList.{format}/{wordListId}";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( wordListId != null) {
|
||||
resourcePath = resourcePath.replace("{wordListId}", wordListId);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(authToken, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
WordList responseObject = (WordList)deserialize(response, WordList.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches words in a WordList
|
||||
|
||||
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
|
||||
|
||||
* @param wordListWordsInput
|
||||
|
||||
|
||||
*
|
||||
* @return List<WordListWord> {@link WordListWord}
|
||||
* @throws WordnikAPIException 400 - Invalid ID supplied 403 - Not Authorized to access WordList 404 - WordList not found
|
||||
*/
|
||||
@MethodArgumentNames(value="authToken, wordListWordsInput")
|
||||
public static List<WordListWord> getWordListWords(String authToken, WordListWordsInput wordListWordsInput) throws WordnikAPIException {
|
||||
|
||||
if(authToken == null || authToken.length() == 0) {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
|
||||
}
|
||||
//parse inputs
|
||||
String resourcePath = "/wordList.{format}/{wordListId}/words";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
if( wordListWordsInput != null && wordListWordsInput.getSortBy() != null) {
|
||||
queryParams.put("sortBy", wordListWordsInput.getSortBy());
|
||||
}
|
||||
if( wordListWordsInput != null && wordListWordsInput.getSortOrder() != null) {
|
||||
queryParams.put("sortOrder", wordListWordsInput.getSortOrder());
|
||||
}
|
||||
if( wordListWordsInput != null && wordListWordsInput.getSkip() != null) {
|
||||
queryParams.put("skip", wordListWordsInput.getSkip());
|
||||
}
|
||||
if( wordListWordsInput != null && wordListWordsInput.getLimit() != null) {
|
||||
queryParams.put("limit", wordListWordsInput.getLimit());
|
||||
}
|
||||
|
||||
if( wordListWordsInput != null && wordListWordsInput.getWordListId() != null) {
|
||||
resourcePath = resourcePath.replace("{wordListId}", wordListWordsInput.getWordListId());
|
||||
}
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(authToken, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeReference<ArrayList<WordListWord>> typeRef = new TypeReference<ArrayList<WordListWord>>() {
|
||||
};
|
||||
try {
|
||||
List<WordListWord> responseObject = (List<WordListWord>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds words to a WordList
|
||||
|
||||
* @param wordListId ID of WordList to user
|
||||
|
||||
* @param postObject Words to add to WordList
|
||||
|
||||
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
|
||||
|
||||
|
||||
*
|
||||
* @return void {@link Void}
|
||||
* @throws WordnikAPIException 400 - Invalid ID supplied 403 - Not Authorized to access WordList 404 - WordList not found
|
||||
*/
|
||||
@MethodArgumentNames(value="wordListId, postObject, authToken")
|
||||
public static void addWordsToWordList(String wordListId, StringValue[] postObject, String authToken) throws WordnikAPIException {
|
||||
|
||||
if(authToken == null || authToken.length() == 0) {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
|
||||
}
|
||||
//parse inputs
|
||||
String resourcePath = "/wordList.{format}/{wordListId}/words";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "POST";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( wordListId != null) {
|
||||
resourcePath = resourcePath.replace("{wordListId}", wordListId);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
|
||||
String response = invokeAPI(authToken, resourcePath, method, queryParams, postObject);
|
||||
|
||||
//create output objects if the response has more than one object
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates an existing WordList
|
||||
|
||||
* @param wordListId ID of WordList to update
|
||||
|
||||
* @param postObject Updated WordList
|
||||
|
||||
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
|
||||
|
||||
|
||||
*
|
||||
* @return void {@link Void}
|
||||
* @throws WordnikAPIException 400 - Invalid ID supplied 403 - Not Authorized to update WordList 404 - WordList not found
|
||||
*/
|
||||
@MethodArgumentNames(value="wordListId, postObject, authToken")
|
||||
public static void updateWordList(String wordListId, WordList postObject, String authToken) throws WordnikAPIException {
|
||||
|
||||
if(authToken == null || authToken.length() == 0) {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
|
||||
}
|
||||
//parse inputs
|
||||
String resourcePath = "/wordList.{format}/{wordListId}";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "PUT";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( wordListId != null) {
|
||||
resourcePath = resourcePath.replace("{wordListId}", wordListId);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
|
||||
String response = invokeAPI(authToken, resourcePath, method, queryParams, postObject);
|
||||
|
||||
//create output objects if the response has more than one object
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deletes an existing WordList
|
||||
|
||||
* @param wordListId ID of WordList to delete
|
||||
|
||||
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
|
||||
|
||||
|
||||
*
|
||||
* @return void {@link Void}
|
||||
* @throws WordnikAPIException 400 - Invalid ID supplied 403 - Not Authorized to delete WordList 404 - WordList not found
|
||||
*/
|
||||
@MethodArgumentNames(value="wordListId, authToken")
|
||||
public static void deleteWordList(String wordListId, String authToken) throws WordnikAPIException {
|
||||
|
||||
if(authToken == null || authToken.length() == 0) {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
|
||||
}
|
||||
//parse inputs
|
||||
String resourcePath = "/wordList.{format}/{wordListId}";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "DELETE";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( wordListId != null) {
|
||||
resourcePath = resourcePath.replace("{wordListId}", wordListId);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(authToken, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes words from a WordList
|
||||
|
||||
* @param wordListId ID of WordList to use
|
||||
|
||||
* @param postObject Words to remove from WordList
|
||||
|
||||
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
|
||||
|
||||
|
||||
*
|
||||
* @return void {@link Void}
|
||||
* @throws WordnikAPIException 400 - Invalid ID supplied 403 - Not Authorized to modify WordList 404 - WordList not found
|
||||
*/
|
||||
@MethodArgumentNames(value="wordListId, postObject, authToken")
|
||||
public static void deleteWordsFromWordList(String wordListId, StringValue[] postObject, String authToken) throws WordnikAPIException {
|
||||
|
||||
if(authToken == null || authToken.length() == 0) {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
|
||||
}
|
||||
//parse inputs
|
||||
String resourcePath = "/wordList.{format}/{wordListId}/deleteWords";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "POST";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( wordListId != null) {
|
||||
resourcePath = resourcePath.replace("{wordListId}", wordListId);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
|
||||
String response = invokeAPI(authToken, resourcePath, method, queryParams, postObject);
|
||||
|
||||
//create output objects if the response has more than one object
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package com.wordnik.api;
|
||||
|
||||
|
||||
import com.wordnik.common.*;
|
||||
import com.wordnik.common.ext.*;
|
||||
import com.wordnik.exception.WordnikExceptionCodes;
|
||||
import com.wordnik.exception.WordnikAPIException;
|
||||
import com.wordnik.model.*;
|
||||
import java.util.*;
|
||||
import com.wordnik.annotations.MethodArgumentNames;
|
||||
import org.codehaus.jackson.map.DeserializationConfig.Feature;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordListsAPI extends WordnikAPI {
|
||||
|
||||
/**
|
||||
* Returns information about API parameters
|
||||
|
||||
*
|
||||
* @return Doc {@link Doc}
|
||||
* @throws WordnikAPIException 404 - No data available
|
||||
*/
|
||||
public static Doc getHelp() throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/wordLists.{format}";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
Doc responseObject = (Doc)deserialize(response, Doc.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a WordList.
|
||||
|
||||
* @param postObject WordList to create
|
||||
|
||||
* @param authToken The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
|
||||
|
||||
|
||||
*
|
||||
* @return WordList {@link WordList}
|
||||
* @throws WordnikAPIException 400 - Invalid WordList supplied or mandatory fields are missing. 403 - Not authenticated. 404 - WordList owner not found.
|
||||
*/
|
||||
@MethodArgumentNames(value="postObject, authToken")
|
||||
public static WordList createWordList(WordList postObject, String authToken) throws WordnikAPIException {
|
||||
|
||||
if(authToken == null || authToken.length() == 0) {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
|
||||
}
|
||||
//parse inputs
|
||||
String resourcePath = "/wordLists.{format}";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "POST";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
|
||||
//make the API Call
|
||||
|
||||
String response = invokeAPI(authToken, resourcePath, method, queryParams, postObject);
|
||||
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
WordList responseObject = (WordList)deserialize(response, WordList.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
848
android/driver/src/main/java/com/wordnik/api/WordsAPI.java
Normal file
848
android/driver/src/main/java/com/wordnik/api/WordsAPI.java
Normal file
@ -0,0 +1,848 @@
|
||||
package com.wordnik.api;
|
||||
|
||||
|
||||
import com.wordnik.common.*;
|
||||
import com.wordnik.common.ext.*;
|
||||
import com.wordnik.exception.WordnikExceptionCodes;
|
||||
import com.wordnik.exception.WordnikAPIException;
|
||||
import com.wordnik.model.*;
|
||||
import java.util.*;
|
||||
import com.wordnik.annotations.MethodArgumentNames;
|
||||
import org.codehaus.jackson.map.DeserializationConfig.Feature;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordsAPI extends WordnikAPI {
|
||||
|
||||
/**
|
||||
* Returns a single random WordObject, in the format specified by the URL
|
||||
|
||||
* @param wordsRandomWordInput
|
||||
|
||||
|
||||
*
|
||||
* @return WordObject {@link WordObject}
|
||||
* @throws WordnikAPIException 404 - No word found.
|
||||
*/
|
||||
@MethodArgumentNames(value="wordsRandomWordInput")
|
||||
public static WordObject getRandomWord(WordsRandomWordInput wordsRandomWordInput) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/randomWord";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
if( wordsRandomWordInput != null && wordsRandomWordInput.getHasDictionaryDef() != null) {
|
||||
queryParams.put("hasDictionaryDef", wordsRandomWordInput.getHasDictionaryDef());
|
||||
}
|
||||
if( wordsRandomWordInput != null && wordsRandomWordInput.getIncludePartOfSpeech() != null) {
|
||||
queryParams.put("includePartOfSpeech", wordsRandomWordInput.getIncludePartOfSpeech());
|
||||
}
|
||||
if( wordsRandomWordInput != null && wordsRandomWordInput.getExcludePartOfSpeech() != null) {
|
||||
queryParams.put("excludePartOfSpeech", wordsRandomWordInput.getExcludePartOfSpeech());
|
||||
}
|
||||
if( wordsRandomWordInput != null && wordsRandomWordInput.getMinCorpusCount() != null) {
|
||||
queryParams.put("minCorpusCount", wordsRandomWordInput.getMinCorpusCount());
|
||||
}
|
||||
if( wordsRandomWordInput != null && wordsRandomWordInput.getMaxCorpusCount() != null) {
|
||||
queryParams.put("maxCorpusCount", wordsRandomWordInput.getMaxCorpusCount());
|
||||
}
|
||||
if( wordsRandomWordInput != null && wordsRandomWordInput.getMinDictionaryCount() != null) {
|
||||
queryParams.put("minDictionaryCount", wordsRandomWordInput.getMinDictionaryCount());
|
||||
}
|
||||
if( wordsRandomWordInput != null && wordsRandomWordInput.getMaxDictionaryCount() != null) {
|
||||
queryParams.put("maxDictionaryCount", wordsRandomWordInput.getMaxDictionaryCount());
|
||||
}
|
||||
if( wordsRandomWordInput != null && wordsRandomWordInput.getMinLength() != null) {
|
||||
queryParams.put("minLength", wordsRandomWordInput.getMinLength());
|
||||
}
|
||||
if( wordsRandomWordInput != null && wordsRandomWordInput.getMaxLength() != null) {
|
||||
queryParams.put("maxLength", wordsRandomWordInput.getMaxLength());
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
WordObject responseObject = (WordObject)deserialize(response, WordObject.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of random WordObjects, in the format specified by the URL
|
||||
|
||||
* @param wordsRandomWordsInput
|
||||
|
||||
|
||||
*
|
||||
* @return List<WordObject> {@link WordObject}
|
||||
* @throws WordnikAPIException 400 - Invalid term supplied. 404 - No results.
|
||||
*/
|
||||
@MethodArgumentNames(value="wordsRandomWordsInput")
|
||||
public static List<WordObject> getRandomWords(WordsRandomWordsInput wordsRandomWordsInput) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/randomWords";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getHasDictionaryDef() != null) {
|
||||
queryParams.put("hasDictionaryDef", wordsRandomWordsInput.getHasDictionaryDef());
|
||||
}
|
||||
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getIncludePartOfSpeech() != null) {
|
||||
queryParams.put("includePartOfSpeech", wordsRandomWordsInput.getIncludePartOfSpeech());
|
||||
}
|
||||
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getExcludePartOfSpeech() != null) {
|
||||
queryParams.put("excludePartOfSpeech", wordsRandomWordsInput.getExcludePartOfSpeech());
|
||||
}
|
||||
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getMinCorpusCount() != null) {
|
||||
queryParams.put("minCorpusCount", wordsRandomWordsInput.getMinCorpusCount());
|
||||
}
|
||||
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getMaxCorpusCount() != null) {
|
||||
queryParams.put("maxCorpusCount", wordsRandomWordsInput.getMaxCorpusCount());
|
||||
}
|
||||
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getMinDictionaryCount() != null) {
|
||||
queryParams.put("minDictionaryCount", wordsRandomWordsInput.getMinDictionaryCount());
|
||||
}
|
||||
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getMaxDictionaryCount() != null) {
|
||||
queryParams.put("maxDictionaryCount", wordsRandomWordsInput.getMaxDictionaryCount());
|
||||
}
|
||||
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getMinLength() != null) {
|
||||
queryParams.put("minLength", wordsRandomWordsInput.getMinLength());
|
||||
}
|
||||
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getMaxLength() != null) {
|
||||
queryParams.put("maxLength", wordsRandomWordsInput.getMaxLength());
|
||||
}
|
||||
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getSortBy() != null) {
|
||||
queryParams.put("sortBy", wordsRandomWordsInput.getSortBy());
|
||||
}
|
||||
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getSortOrder() != null) {
|
||||
queryParams.put("sortOrder", wordsRandomWordsInput.getSortOrder());
|
||||
}
|
||||
if( wordsRandomWordsInput != null && wordsRandomWordsInput.getLimit() != null) {
|
||||
queryParams.put("limit", wordsRandomWordsInput.getLimit());
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeReference<ArrayList<WordObject>> typeRef = new TypeReference<ArrayList<WordObject>>() {
|
||||
};
|
||||
try {
|
||||
List<WordObject> responseObject = (List<WordObject>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Searches words.
|
||||
|
||||
* @param wordsSearchInput
|
||||
|
||||
|
||||
*
|
||||
* @return List<WordFrequency> {@link WordFrequency}
|
||||
* @throws WordnikAPIException 400 - Invalid term supplied. 404 - No results.
|
||||
*/
|
||||
@MethodArgumentNames(value="wordsSearchInput")
|
||||
public static List<WordFrequency> searchWords(WordsSearchInput wordsSearchInput) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/search";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
if( wordsSearchInput != null && wordsSearchInput.getQuery() != null) {
|
||||
queryParams.put("query", wordsSearchInput.getQuery());
|
||||
}
|
||||
if( wordsSearchInput != null && wordsSearchInput.getCaseSensitive() != null) {
|
||||
queryParams.put("caseSensitive", wordsSearchInput.getCaseSensitive());
|
||||
}
|
||||
if( wordsSearchInput != null && wordsSearchInput.getIncludePartOfSpeech() != null) {
|
||||
queryParams.put("includePartOfSpeech", wordsSearchInput.getIncludePartOfSpeech());
|
||||
}
|
||||
if( wordsSearchInput != null && wordsSearchInput.getExcludePartOfSpeech() != null) {
|
||||
queryParams.put("excludePartOfSpeech", wordsSearchInput.getExcludePartOfSpeech());
|
||||
}
|
||||
if( wordsSearchInput != null && wordsSearchInput.getMinCorpusCount() != null) {
|
||||
queryParams.put("minCorpusCount", wordsSearchInput.getMinCorpusCount());
|
||||
}
|
||||
if( wordsSearchInput != null && wordsSearchInput.getMaxCorpusCount() != null) {
|
||||
queryParams.put("maxCorpusCount", wordsSearchInput.getMaxCorpusCount());
|
||||
}
|
||||
if( wordsSearchInput != null && wordsSearchInput.getMinDictionaryCount() != null) {
|
||||
queryParams.put("minDictionaryCount", wordsSearchInput.getMinDictionaryCount());
|
||||
}
|
||||
if( wordsSearchInput != null && wordsSearchInput.getMaxDictionaryCount() != null) {
|
||||
queryParams.put("maxDictionaryCount", wordsSearchInput.getMaxDictionaryCount());
|
||||
}
|
||||
if( wordsSearchInput != null && wordsSearchInput.getMinLength() != null) {
|
||||
queryParams.put("minLength", wordsSearchInput.getMinLength());
|
||||
}
|
||||
if( wordsSearchInput != null && wordsSearchInput.getMaxLength() != null) {
|
||||
queryParams.put("maxLength", wordsSearchInput.getMaxLength());
|
||||
}
|
||||
if( wordsSearchInput != null && wordsSearchInput.getSkip() != null) {
|
||||
queryParams.put("skip", wordsSearchInput.getSkip());
|
||||
}
|
||||
if( wordsSearchInput != null && wordsSearchInput.getLimit() != null) {
|
||||
queryParams.put("limit", wordsSearchInput.getLimit());
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeReference<ArrayList<WordFrequency>> typeRef = new TypeReference<ArrayList<WordFrequency>>() {
|
||||
};
|
||||
try {
|
||||
List<WordFrequency> responseObject = (List<WordFrequency>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches an array of WordOfTheDayList basd on a criteria
|
||||
|
||||
* @param containsWord Lists must contain a specific word
|
||||
|
||||
* @param subscriberCount Lists must have the specified number of subscribers
|
||||
|
||||
* @param itemCount Lists must have the specified number of items
|
||||
|
||||
* @param includeAll Returns future WordOfTheDay items
|
||||
|
||||
|
||||
*
|
||||
* @return List<WordOfTheDayList> {@link WordOfTheDayList}
|
||||
* @throws WordnikAPIException 400 - Invalid word supplied.
|
||||
*/
|
||||
@MethodArgumentNames(value="containsWord, subscriberCount, itemCount, includeAll")
|
||||
public static List<WordOfTheDayList> getWordOfTheDayListsContainingWord(String containsWord, String subscriberCount, String itemCount, String includeAll) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/wordOfTheDayLists";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( containsWord != null) {
|
||||
queryParams.put("containsWord", containsWord);
|
||||
}
|
||||
if( subscriberCount != null) {
|
||||
queryParams.put("subscriberCount", subscriberCount);
|
||||
}
|
||||
if( itemCount != null) {
|
||||
queryParams.put("itemCount", itemCount);
|
||||
}
|
||||
if( includeAll != null) {
|
||||
queryParams.put("includeAll", includeAll);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeReference<ArrayList<WordOfTheDayList>> typeRef = new TypeReference<ArrayList<WordOfTheDayList>>() {
|
||||
};
|
||||
try {
|
||||
List<WordOfTheDayList> responseObject = (List<WordOfTheDayList>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches WordOfTheDay objects for a specific date
|
||||
|
||||
* @param date ID of WordOfTheDayList
|
||||
|
||||
* @param includeAll Returns future WordOfTheDay items
|
||||
|
||||
|
||||
*
|
||||
* @return List<WordOfTheDay> {@link WordOfTheDay}
|
||||
* @throws WordnikAPIException 400 - Invalid ID supplied 404 - WordOfTheDayList or User not found
|
||||
*/
|
||||
@MethodArgumentNames(value="date, includeAll")
|
||||
public static List<WordOfTheDay> getWordOfTheDayListsForDate(String date, String includeAll) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/wordOfTheDayLists/{date}";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( includeAll != null) {
|
||||
queryParams.put("includeAll", includeAll);
|
||||
}
|
||||
|
||||
if( date != null) {
|
||||
resourcePath = resourcePath.replace("{date}", date);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeReference<ArrayList<WordOfTheDay>> typeRef = new TypeReference<ArrayList<WordOfTheDay>>() {
|
||||
};
|
||||
try {
|
||||
List<WordOfTheDay> responseObject = (List<WordOfTheDay>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Subscribes a user to a WordOfTheDayList
|
||||
|
||||
* @param authToken auth_token of logged-in user
|
||||
|
||||
* @param permalink ID of WordOfTheDayList
|
||||
|
||||
* @param medium Medium to subscribe with
|
||||
|
||||
* @param postObject Username to subscribe
|
||||
|
||||
|
||||
*
|
||||
* @return void {@link Void}
|
||||
* @throws WordnikAPIException 400 - Invalid ID supplied 403 - Not authorized to subscribe 404 - WordOfTheDayList or User not found
|
||||
*/
|
||||
@MethodArgumentNames(value="authToken, permalink, medium, postObject")
|
||||
public static void subscribeToList(String authToken, String permalink, String medium, String postObject) throws WordnikAPIException {
|
||||
|
||||
if(authToken == null || authToken.length() == 0) {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
|
||||
}
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/wordOfTheDayList/{permalink}/subscription";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "POST";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( medium != null) {
|
||||
queryParams.put("medium", medium);
|
||||
}
|
||||
|
||||
if( permalink != null) {
|
||||
resourcePath = resourcePath.replace("{permalink}", permalink);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
|
||||
String response = invokeAPI(authToken, resourcePath, method, queryParams, postObject);
|
||||
|
||||
//create output objects if the response has more than one object
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Searches definitions.
|
||||
|
||||
* @param wordsSearchDefinitionsInput
|
||||
|
||||
|
||||
*
|
||||
* @return DefinitionSearchResults {@link DefinitionSearchResults}
|
||||
* @throws WordnikAPIException 400 - Invalid term supplied.
|
||||
*/
|
||||
@MethodArgumentNames(value="wordsSearchDefinitionsInput")
|
||||
public static DefinitionSearchResults searchDefinitions(WordsSearchDefinitionsInput wordsSearchDefinitionsInput) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/searchDefinitions";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getQuery() != null) {
|
||||
queryParams.put("query", wordsSearchDefinitionsInput.getQuery());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getDefinedWordSearchTerm() != null) {
|
||||
queryParams.put("definedWordSearchTerm", wordsSearchDefinitionsInput.getDefinedWordSearchTerm());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getIncludeSourceDictionaries() != null) {
|
||||
queryParams.put("includeSourceDictionaries", wordsSearchDefinitionsInput.getIncludeSourceDictionaries());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getExcludeSourceDictionaries() != null) {
|
||||
queryParams.put("excludeSourceDictionaries", wordsSearchDefinitionsInput.getExcludeSourceDictionaries());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getIncludePartOfSpeech() != null) {
|
||||
queryParams.put("includePartOfSpeech", wordsSearchDefinitionsInput.getIncludePartOfSpeech());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getExcludePartOfSpeech() != null) {
|
||||
queryParams.put("excludePartOfSpeech", wordsSearchDefinitionsInput.getExcludePartOfSpeech());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getMinCorpusCount() != null) {
|
||||
queryParams.put("minCorpusCount", wordsSearchDefinitionsInput.getMinCorpusCount());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getMaxCorpusCount() != null) {
|
||||
queryParams.put("maxCorpusCount", wordsSearchDefinitionsInput.getMaxCorpusCount());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getMinLength() != null) {
|
||||
queryParams.put("minLength", wordsSearchDefinitionsInput.getMinLength());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getMaxLength() != null) {
|
||||
queryParams.put("maxLength", wordsSearchDefinitionsInput.getMaxLength());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getExpandTerms() != null) {
|
||||
queryParams.put("expandTerms", wordsSearchDefinitionsInput.getExpandTerms());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getWordTypes() != null) {
|
||||
queryParams.put("wordTypes", wordsSearchDefinitionsInput.getWordTypes());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getIncludeTags() != null) {
|
||||
queryParams.put("includeTags", wordsSearchDefinitionsInput.getIncludeTags());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getSortBy() != null) {
|
||||
queryParams.put("sortBy", wordsSearchDefinitionsInput.getSortBy());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getSortOrder() != null) {
|
||||
queryParams.put("sortOrder", wordsSearchDefinitionsInput.getSortOrder());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getSkip() != null) {
|
||||
queryParams.put("skip", wordsSearchDefinitionsInput.getSkip());
|
||||
}
|
||||
if( wordsSearchDefinitionsInput != null && wordsSearchDefinitionsInput.getLimit() != null) {
|
||||
queryParams.put("limit", wordsSearchDefinitionsInput.getLimit());
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
DefinitionSearchResults responseObject = (DefinitionSearchResults)deserialize(response, DefinitionSearchResults.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Searches dictionary entries.
|
||||
|
||||
* @param query Search term
|
||||
|
||||
* @param skip Results to skip
|
||||
* Allowed values are - 0 to 1000
|
||||
* @param limit Maximum number of results to return
|
||||
* Allowed values are - 1 to 1000
|
||||
|
||||
*
|
||||
* @return EntrySearchResults {@link EntrySearchResults}
|
||||
* @throws WordnikAPIException 400 - Invalid term supplied.
|
||||
*/
|
||||
@MethodArgumentNames(value="query, skip, limit")
|
||||
public static EntrySearchResults searchEntries(String query, String skip, String limit) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/searchEntries";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( query != null) {
|
||||
queryParams.put("query", query);
|
||||
}
|
||||
if( skip != null) {
|
||||
queryParams.put("skip", skip);
|
||||
}
|
||||
if( limit != null) {
|
||||
queryParams.put("limit", limit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
EntrySearchResults responseObject = (EntrySearchResults)deserialize(response, EntrySearchResults.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches surface forms of a word
|
||||
|
||||
* @param term Word to get surface forms for.
|
||||
|
||||
|
||||
*
|
||||
* @return String {@link String}
|
||||
* @throws WordnikAPIException 400 - Invalid term supplied.
|
||||
*/
|
||||
@MethodArgumentNames(value="term")
|
||||
public static String getSurfaceForms(String term) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/surfaceForms";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( term != null) {
|
||||
queryParams.put("term", term);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
String responseObject = (String)deserialize(response, String.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a specific WordOfTheDay
|
||||
|
||||
* @param date Fetches by date in yyyy-MM-dd
|
||||
|
||||
* @param category Filters response by category
|
||||
|
||||
* @param creator Filters response by username
|
||||
|
||||
|
||||
*
|
||||
* @return WordOfTheDay {@link WordOfTheDay}
|
||||
* @throws WordnikAPIException 404 - No data available
|
||||
*/
|
||||
@MethodArgumentNames(value="date, category, creator")
|
||||
public static WordOfTheDay getWordOfTheDay(String date, String category, String creator) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/wordOfTheDay";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( date != null) {
|
||||
queryParams.put("date", date);
|
||||
}
|
||||
if( category != null) {
|
||||
queryParams.put("category", category);
|
||||
}
|
||||
if( creator != null) {
|
||||
queryParams.put("creator", creator);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
WordOfTheDay responseObject = (WordOfTheDay)deserialize(response, WordOfTheDay.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a WordOfTheDay range
|
||||
|
||||
* @param wordsWordOfTheDayInputRangeInput
|
||||
|
||||
|
||||
*
|
||||
* @return List<WordOfTheDay> {@link WordOfTheDay}
|
||||
* @throws WordnikAPIException 404 - No data available
|
||||
*/
|
||||
@MethodArgumentNames(value="wordsWordOfTheDayInputRangeInput")
|
||||
public static List<WordOfTheDay> getWordOfTheDayRange(WordsWordOfTheDayInputRangeInput wordsWordOfTheDayInputRangeInput) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/wordOfTheDay/range";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
if( wordsWordOfTheDayInputRangeInput != null && wordsWordOfTheDayInputRangeInput.getCategory() != null) {
|
||||
queryParams.put("category", wordsWordOfTheDayInputRangeInput.getCategory());
|
||||
}
|
||||
if( wordsWordOfTheDayInputRangeInput != null && wordsWordOfTheDayInputRangeInput.getCreator() != null) {
|
||||
queryParams.put("creator", wordsWordOfTheDayInputRangeInput.getCreator());
|
||||
}
|
||||
if( wordsWordOfTheDayInputRangeInput != null && wordsWordOfTheDayInputRangeInput.getProvider() != null) {
|
||||
queryParams.put("provider", wordsWordOfTheDayInputRangeInput.getProvider());
|
||||
}
|
||||
if( wordsWordOfTheDayInputRangeInput != null && wordsWordOfTheDayInputRangeInput.getSkip() != null) {
|
||||
queryParams.put("skip", wordsWordOfTheDayInputRangeInput.getSkip());
|
||||
}
|
||||
if( wordsWordOfTheDayInputRangeInput != null && wordsWordOfTheDayInputRangeInput.getLimit() != null) {
|
||||
queryParams.put("limit", wordsWordOfTheDayInputRangeInput.getLimit());
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeReference<ArrayList<WordOfTheDay>> typeRef = new TypeReference<ArrayList<WordOfTheDay>>() {
|
||||
};
|
||||
try {
|
||||
List<WordOfTheDay> responseObject = (List<WordOfTheDay>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches a WordOfTheDayList by ID
|
||||
|
||||
* @param permalink ID of WordOfTheDayList
|
||||
|
||||
* @param includeAll Returns future WordOfTheDay items
|
||||
|
||||
|
||||
*
|
||||
* @return WordOfTheDayList {@link WordOfTheDayList}
|
||||
* @throws WordnikAPIException 400 - Invalid id supplied 404 - WordOfTheDayList not found
|
||||
*/
|
||||
@MethodArgumentNames(value="permalink, includeAll")
|
||||
public static WordOfTheDayList getWordOfTheDayList(String permalink, String includeAll) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/wordOfTheDayList/{permalink}";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( includeAll != null) {
|
||||
queryParams.put("includeAll", includeAll);
|
||||
}
|
||||
|
||||
if( permalink != null) {
|
||||
resourcePath = resourcePath.replace("{permalink}", permalink);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
WordOfTheDayList responseObject = (WordOfTheDayList)deserialize(response, WordOfTheDayList.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches a WordOfTheDayList by ID
|
||||
|
||||
* @param permalink ID of WordOfTheDayList
|
||||
|
||||
* @param specifier Specifier for the item to fetch. Either 'current' or a date.
|
||||
|
||||
|
||||
*
|
||||
* @return WordOfTheDay {@link WordOfTheDay}
|
||||
* @throws WordnikAPIException 400 - Invalid id supplied 404 - WordOfTheDayList not found
|
||||
*/
|
||||
@MethodArgumentNames(value="permalink, specifier")
|
||||
public static WordOfTheDay getWordOfTheDayListItem(String permalink, String specifier) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/wordOfTheDayList/{permalink}/{specifier}";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( permalink != null) {
|
||||
resourcePath = resourcePath.replace("{permalink}", permalink);
|
||||
}
|
||||
if( specifier != null) {
|
||||
resourcePath = resourcePath.replace("{specifier}", specifier);
|
||||
}
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
WordOfTheDay responseObject = (WordOfTheDay)deserialize(response, WordOfTheDay.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches recently created WordOfTheDayLists
|
||||
|
||||
* @param skip Results to skip
|
||||
|
||||
* @param limit Maximum number of results to return
|
||||
|
||||
|
||||
*
|
||||
* @return List<WordOfTheDayList> {@link WordOfTheDayList}
|
||||
* @throws WordnikAPIException 404 - No WordOfTheDayLists found.
|
||||
*/
|
||||
@MethodArgumentNames(value="skip, limit")
|
||||
public static List<WordOfTheDayList> getRecentWordOfTheDayLists(String skip, String limit) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/wordOfTheDayLists/recent";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( skip != null) {
|
||||
queryParams.put("skip", skip);
|
||||
}
|
||||
if( limit != null) {
|
||||
queryParams.put("limit", limit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeReference<ArrayList<WordOfTheDayList>> typeRef = new TypeReference<ArrayList<WordOfTheDayList>>() {
|
||||
};
|
||||
try {
|
||||
List<WordOfTheDayList> responseObject = (List<WordOfTheDayList>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether or not a subscription process has been run.
|
||||
Uses the current server time (day resolution) as the default date to check for, optionally a dateString can be supplied for a specific date to check for.
|
||||
* @param date Date string to fetch for.
|
||||
|
||||
|
||||
*
|
||||
* @return String {@link String}
|
||||
* @throws WordnikAPIException 400 - Invalid date format supplied.
|
||||
*/
|
||||
@MethodArgumentNames(value="date")
|
||||
public static String getWordOfTheDayListSubscriptionProcessStatus(String date) throws WordnikAPIException {
|
||||
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "/words.{format}/wordOfTheDayLists/subscriptionProcess";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "GET";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
|
||||
if( date != null) {
|
||||
queryParams.put("date", date);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//make the API Call
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
//create output objects if the response has more than one object
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
String responseObject = (String)deserialize(response, String.class);
|
||||
return responseObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
238
android/driver/src/main/java/com/wordnik/common/WordnikAPI.java
Normal file
238
android/driver/src/main/java/com/wordnik/common/WordnikAPI.java
Normal file
@ -0,0 +1,238 @@
|
||||
package com.wordnik.common;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
||||
import org.apache.http.HttpException;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.*;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.map.DeserializationConfig.Feature;
|
||||
|
||||
import com.wordnik.exception.WordnikAPIException;
|
||||
import com.wordnik.exception.WordnikExceptionCodes;
|
||||
|
||||
/**
|
||||
* Provides way to initialize the communication with Wordnik API server.
|
||||
* This is also a Base class for all API classes
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordnikAPI {
|
||||
|
||||
private static String apiServer = "http://api.wordnik.com/v4";
|
||||
private static String apiKey = "";
|
||||
private static boolean loggingEnabled;
|
||||
private static Logger logger = null;
|
||||
|
||||
public static final String WORDNIK_HEADER_NAME = "api_key";
|
||||
|
||||
protected static String POST = "POST";
|
||||
protected static String GET = "GET";
|
||||
protected static String PUT = "PUT";
|
||||
protected static String DELETE = "DELETE";
|
||||
protected static ObjectMapper mapper = new ObjectMapper();
|
||||
static{
|
||||
mapper.getDeserializationConfig().set(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the API communication with required inputs.
|
||||
* @param apiKey provide the key provided as part of registration
|
||||
* @param apiServer Sets the URL for the API server. It is defaulted to the server
|
||||
* used while building the driver. This value should be provided while testing the APIs against
|
||||
* test servers or if there is any changes in production server URLs.
|
||||
* @param enableLogging This will enable the logging using Jersey logging filter. Refer the following documentation
|
||||
* for more details. {@link //LoggingFilter}. Default output is sent to system.out.
|
||||
* Create a logger ({@link Logger} class and set using setLogger method.
|
||||
*/
|
||||
public static void initialize(String apiKey, String apiServer, boolean enableLogging) {
|
||||
setApiKey(apiKey);
|
||||
if(apiServer != null && apiServer.length() > 0) {
|
||||
if(apiServer.substring(apiServer.length()-1).equals("/")){
|
||||
apiServer = apiServer.substring(0, apiServer.length()-1);
|
||||
}
|
||||
setApiServer(apiServer);
|
||||
}
|
||||
loggingEnabled = enableLogging;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the logger instance used for Jersey logging.
|
||||
* @param aLogger
|
||||
*/
|
||||
public static void setLogger(Logger aLogger) {
|
||||
logger = aLogger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the API key used for server communication.
|
||||
* This value is set using initialize method.
|
||||
* @return
|
||||
*/
|
||||
private static String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
|
||||
private static void setApiKey(String apiKey) {
|
||||
WordnikAPI.apiKey = apiKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the URL for the API server. It is defaulted to the server used while building the driver.
|
||||
* @return
|
||||
*/
|
||||
private static String getApiServer() {
|
||||
return apiServer;
|
||||
}
|
||||
|
||||
private static void setApiServer(String server) {
|
||||
WordnikAPI.apiServer = server;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Invokes the API and returns the response as json string.
|
||||
* This is an internal method called by individual APIs for communication. It sets the required HTTP headers
|
||||
* based on API key and auth token.
|
||||
* @param authToken - token that is received as part of authentication call. This is only needed for the calls that are secure.
|
||||
* @param resourceURL - URL for the rest resource
|
||||
* @param method - Method we should use for communicating to the back end.
|
||||
* @param postObject - if the method is POST, provide the object that should be sent as part of post request.
|
||||
* @return JSON response of the API call.
|
||||
* @throws com.wordnik.exception.WordnikAPIException if the call to API server fails.
|
||||
*/
|
||||
protected static String invokeAPI(String authToken, String resourceURL, String method,
|
||||
Map<String, String> queryParams, Object postObject)
|
||||
throws WordnikAPIException {
|
||||
String responseString = null;
|
||||
try {
|
||||
//check for app key and server values
|
||||
if(getApiKey() == null || getApiKey().length() == 0) {
|
||||
String[] args = {getApiKey()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.API_KEY_NOT_VALID, args);
|
||||
}
|
||||
if(getApiServer() == null || getApiServer().length() == 0) {
|
||||
String[] args = {getApiServer()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.API_SERVER_NOT_VALID, args);
|
||||
}
|
||||
|
||||
String url = getApiServer() + resourceURL + getQueryParams(queryParams);
|
||||
|
||||
HttpUriRequest request = null;
|
||||
if(method.equals(GET)) {
|
||||
request = new HttpGet(url);
|
||||
} else if (method.equals(POST)) {
|
||||
request = new HttpPost(url);
|
||||
if(postObject != null) {
|
||||
StringEntity entity = new StringEntity(serialize(postObject));
|
||||
((HttpPost) request).setEntity(entity);
|
||||
}
|
||||
} else if (method.equals(PUT)) {
|
||||
request = new HttpPut(url);
|
||||
if(postObject != null) {
|
||||
StringEntity entity = new StringEntity(serialize(postObject));
|
||||
((HttpPut) request).setEntity(entity);
|
||||
}
|
||||
} else if (method.equals(DELETE)) {
|
||||
request = new HttpDelete(url);
|
||||
} else {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_FROM_WEBSERVICE_CALL, "Http method not valid - " + method);
|
||||
}
|
||||
|
||||
request.setHeader("Content-type", "application/json");
|
||||
request.addHeader(WORDNIK_HEADER_NAME, getApiKey());
|
||||
if(authToken != null){
|
||||
request.addHeader("auth_token", authToken);
|
||||
}
|
||||
|
||||
final HttpClient hc = new DefaultHttpClient();
|
||||
final HttpResponse resp = hc.execute(request);
|
||||
final int status = resp.getStatusLine().getStatusCode();
|
||||
if (status == HttpStatus.SC_OK) {
|
||||
if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
|
||||
responseString = EntityUtils.toString(resp.getEntity(), HTTP.UTF_8);
|
||||
} else {
|
||||
throw new WordnikAPIException(resp.getStatusLine().getStatusCode(), EntityUtils.toString(resp.getEntity(), HTTP.UTF_8));
|
||||
}
|
||||
} else {
|
||||
throw new WordnikAPIException(status, EntityUtils.toString(resp.getEntity(), HTTP.UTF_8));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_FROM_WEBSERVICE_CALL, e.getMessage(), e);
|
||||
}
|
||||
|
||||
return responseString;
|
||||
}
|
||||
|
||||
private static String getQueryParams(Map<String, String> queryParams) {
|
||||
if(queryParams == null || queryParams.size() == 0) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("?");
|
||||
|
||||
for(String key : queryParams.keySet()) {
|
||||
String value = queryParams.get(key);
|
||||
|
||||
try {
|
||||
value = URLEncoder.encode(value, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(buf.length() > 1) {
|
||||
buf.append("&");
|
||||
}
|
||||
|
||||
buf.append(key).append("=").append(value);
|
||||
}
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* De-serialize the object from String to input object.
|
||||
* @param response
|
||||
* @param inputClassName
|
||||
* @return
|
||||
*/
|
||||
public static Object deserialize(String response, Class inputClassName) throws WordnikAPIException {
|
||||
try {
|
||||
Object responseObject = mapper.readValue(response, inputClassName);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, inputClassName.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in coversting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* serialize the object from String to input object.
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static String serialize(Object input) throws WordnikAPIException {
|
||||
try {
|
||||
if(input != null) {
|
||||
return mapper.writeValueAsString(input);
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JAVA_TO_JSON, "Error in coverting input java to json : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class ApiResponse extends WordnikObject {
|
||||
|
||||
//
|
||||
private String message ;
|
||||
//
|
||||
private String type ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
//
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class ApiTokenStatus extends WordnikObject {
|
||||
|
||||
//
|
||||
private String token ;
|
||||
//
|
||||
private Long expiresInMillis ;
|
||||
//
|
||||
private Long totalRequests ;
|
||||
//
|
||||
private Long remainingCalls ;
|
||||
//
|
||||
private Long resetsInMillis ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
//
|
||||
|
||||
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;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getRemainingCalls() {
|
||||
return remainingCalls;
|
||||
}
|
||||
|
||||
public void setRemainingCalls(Long remainingCalls) {
|
||||
this.remainingCalls = remainingCalls;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getResetsInMillis() {
|
||||
return resetsInMillis;
|
||||
}
|
||||
|
||||
public void setResetsInMillis(Long resetsInMillis) {
|
||||
this.resetsInMillis = resetsInMillis;
|
||||
}
|
||||
|
||||
}
|
134
android/driver/src/main/java/com/wordnik/model/AudioFile.java
Normal file
134
android/driver/src/main/java/com/wordnik/model/AudioFile.java
Normal file
@ -0,0 +1,134 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class AudioFile extends WordnikObject {
|
||||
|
||||
//
|
||||
private Long id ;
|
||||
//
|
||||
private String description ;
|
||||
//
|
||||
private String createdBy ;
|
||||
//
|
||||
private String word ;
|
||||
//
|
||||
private Date createdAt ;
|
||||
//
|
||||
private int commentCount ;
|
||||
//
|
||||
private int voteCount ;
|
||||
//
|
||||
private float voteAverage ;
|
||||
//
|
||||
private float voteWeightedAverage ;
|
||||
//
|
||||
private String fileUrl ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
@Required
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
//
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
//
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
//
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
//
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Date createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
//
|
||||
|
||||
public int getCommentCount() {
|
||||
return commentCount;
|
||||
}
|
||||
|
||||
public void setCommentCount(int commentCount) {
|
||||
this.commentCount = commentCount;
|
||||
}
|
||||
//
|
||||
|
||||
public int getVoteCount() {
|
||||
return voteCount;
|
||||
}
|
||||
|
||||
public void setVoteCount(int voteCount) {
|
||||
this.voteCount = voteCount;
|
||||
}
|
||||
//
|
||||
|
||||
public float getVoteAverage() {
|
||||
return voteAverage;
|
||||
}
|
||||
|
||||
public void setVoteAverage(float voteAverage) {
|
||||
this.voteAverage = voteAverage;
|
||||
}
|
||||
//
|
||||
|
||||
public float getVoteWeightedAverage() {
|
||||
return voteWeightedAverage;
|
||||
}
|
||||
|
||||
public void setVoteWeightedAverage(float voteWeightedAverage) {
|
||||
this.voteWeightedAverage = voteWeightedAverage;
|
||||
}
|
||||
//
|
||||
|
||||
public String getFileUrl() {
|
||||
return fileUrl;
|
||||
}
|
||||
|
||||
public void setFileUrl(String fileUrl) {
|
||||
this.fileUrl = fileUrl;
|
||||
}
|
||||
|
||||
}
|
165
android/driver/src/main/java/com/wordnik/model/AudioObject.java
Normal file
165
android/driver/src/main/java/com/wordnik/model/AudioObject.java
Normal file
@ -0,0 +1,165 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class AudioObject extends WordnikObject {
|
||||
|
||||
//
|
||||
private Long id ;
|
||||
//
|
||||
private AudioType type ;
|
||||
//
|
||||
private String description ;
|
||||
//
|
||||
private Long userId ;
|
||||
//
|
||||
private String createdBy ;
|
||||
//
|
||||
private String wordstring ;
|
||||
//
|
||||
private Long wordId ;
|
||||
//
|
||||
private Date createdAt ;
|
||||
//
|
||||
private String filePath ;
|
||||
//
|
||||
private String recordId ;
|
||||
//
|
||||
private AudioType audioFileType ;
|
||||
//
|
||||
private Long audioFileId ;
|
||||
//
|
||||
private String streamPath ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
//
|
||||
|
||||
public AudioType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(AudioType type) {
|
||||
this.type = type;
|
||||
}
|
||||
//
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
//
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
//
|
||||
|
||||
public String getWordstring() {
|
||||
return wordstring;
|
||||
}
|
||||
|
||||
public void setWordstring(String wordstring) {
|
||||
this.wordstring = wordstring;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getWordId() {
|
||||
return wordId;
|
||||
}
|
||||
|
||||
public void setWordId(Long wordId) {
|
||||
this.wordId = wordId;
|
||||
}
|
||||
//
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Date createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
//
|
||||
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
//
|
||||
|
||||
public String getRecordId() {
|
||||
return recordId;
|
||||
}
|
||||
|
||||
public void setRecordId(String recordId) {
|
||||
this.recordId = recordId;
|
||||
}
|
||||
//
|
||||
|
||||
public AudioType getAudioFileType() {
|
||||
return audioFileType;
|
||||
}
|
||||
|
||||
public void setAudioFileType(AudioType audioFileType) {
|
||||
this.audioFileType = audioFileType;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getAudioFileId() {
|
||||
return audioFileId;
|
||||
}
|
||||
|
||||
public void setAudioFileId(Long audioFileId) {
|
||||
this.audioFileId = audioFileId;
|
||||
}
|
||||
//
|
||||
|
||||
public String getStreamPath() {
|
||||
return streamPath;
|
||||
}
|
||||
|
||||
public void setStreamPath(String streamPath) {
|
||||
this.streamPath = streamPath;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class AudioType extends WordnikObject {
|
||||
|
||||
//
|
||||
private String name ;
|
||||
//
|
||||
private int id ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class AuthenticationToken extends WordnikObject {
|
||||
|
||||
//
|
||||
private String token ;
|
||||
//
|
||||
private Long userId ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
76
android/driver/src/main/java/com/wordnik/model/Bigram.java
Normal file
76
android/driver/src/main/java/com/wordnik/model/Bigram.java
Normal file
@ -0,0 +1,76 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Bigram extends WordnikObject {
|
||||
|
||||
//
|
||||
private Long count ;
|
||||
//
|
||||
private String gram1 ;
|
||||
//
|
||||
private String gram2 ;
|
||||
//
|
||||
private Double mi ;
|
||||
//
|
||||
private Double wlmi ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public Long getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Long count) {
|
||||
this.count = count;
|
||||
}
|
||||
//
|
||||
|
||||
public String getGram1() {
|
||||
return gram1;
|
||||
}
|
||||
|
||||
public void setGram1(String gram1) {
|
||||
this.gram1 = gram1;
|
||||
}
|
||||
//
|
||||
|
||||
public String getGram2() {
|
||||
return gram2;
|
||||
}
|
||||
|
||||
public void setGram2(String gram2) {
|
||||
this.gram2 = gram2;
|
||||
}
|
||||
//
|
||||
|
||||
public Double getMi() {
|
||||
return mi;
|
||||
}
|
||||
|
||||
public void setMi(Double mi) {
|
||||
this.mi = mi;
|
||||
}
|
||||
//
|
||||
|
||||
public Double getWlmi() {
|
||||
return wlmi;
|
||||
}
|
||||
|
||||
public void setWlmi(Double wlmi) {
|
||||
this.wlmi = wlmi;
|
||||
}
|
||||
|
||||
}
|
32
android/driver/src/main/java/com/wordnik/model/Category.java
Normal file
32
android/driver/src/main/java/com/wordnik/model/Category.java
Normal file
@ -0,0 +1,32 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Category extends WordnikObject {
|
||||
|
||||
//
|
||||
private String name ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
43
android/driver/src/main/java/com/wordnik/model/Citation.java
Normal file
43
android/driver/src/main/java/com/wordnik/model/Citation.java
Normal file
@ -0,0 +1,43 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Citation extends WordnikObject {
|
||||
|
||||
//
|
||||
private String source ;
|
||||
//
|
||||
private String cite ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
//
|
||||
|
||||
public String getCite() {
|
||||
return cite;
|
||||
}
|
||||
|
||||
public void setCite(String cite) {
|
||||
this.cite = cite;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class ContentProvider extends WordnikObject {
|
||||
|
||||
//
|
||||
private String name ;
|
||||
//
|
||||
private int id ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
177
android/driver/src/main/java/com/wordnik/model/Definition.java
Normal file
177
android/driver/src/main/java/com/wordnik/model/Definition.java
Normal file
@ -0,0 +1,177 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Definition extends WordnikObject {
|
||||
|
||||
//
|
||||
private List<ExampleUsage> exampleUses = new ArrayList< ExampleUsage>();
|
||||
//
|
||||
private String word ;
|
||||
//
|
||||
private String text ;
|
||||
//
|
||||
private List<TextPron> textProns = new ArrayList< TextPron>();
|
||||
//
|
||||
private float score ;
|
||||
//
|
||||
private String partOfSpeech ;
|
||||
//
|
||||
private List<Note> notes = new ArrayList< Note>();
|
||||
//
|
||||
private List<Citation> citations = new ArrayList< Citation>();
|
||||
//
|
||||
private List<Related> relatedWords = new ArrayList< Related>();
|
||||
//
|
||||
private String sourceDictionary ;
|
||||
//
|
||||
private List<Label> labels = new ArrayList< Label>();
|
||||
//
|
||||
private String sequence ;
|
||||
//
|
||||
private String seqString ;
|
||||
//
|
||||
private String extendedText ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public List<ExampleUsage> getExampleUses() {
|
||||
return exampleUses;
|
||||
}
|
||||
|
||||
public void setExampleUses(List<ExampleUsage> exampleUses) {
|
||||
this.exampleUses = exampleUses;
|
||||
}
|
||||
//
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
//
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
//
|
||||
|
||||
public List<TextPron> getTextProns() {
|
||||
return textProns;
|
||||
}
|
||||
|
||||
public void setTextProns(List<TextPron> textProns) {
|
||||
this.textProns = textProns;
|
||||
}
|
||||
//
|
||||
|
||||
public float getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public void setScore(float score) {
|
||||
this.score = score;
|
||||
}
|
||||
//
|
||||
|
||||
public String getPartOfSpeech() {
|
||||
return partOfSpeech;
|
||||
}
|
||||
|
||||
public void setPartOfSpeech(String partOfSpeech) {
|
||||
this.partOfSpeech = partOfSpeech;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Note> getNotes() {
|
||||
return notes;
|
||||
}
|
||||
|
||||
public void setNotes(List<Note> notes) {
|
||||
this.notes = notes;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Citation> getCitations() {
|
||||
return citations;
|
||||
}
|
||||
|
||||
public void setCitations(List<Citation> citations) {
|
||||
this.citations = citations;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Related> getRelatedWords() {
|
||||
return relatedWords;
|
||||
}
|
||||
|
||||
public void setRelatedWords(List<Related> relatedWords) {
|
||||
this.relatedWords = relatedWords;
|
||||
}
|
||||
//
|
||||
|
||||
public String getSourceDictionary() {
|
||||
return sourceDictionary;
|
||||
}
|
||||
|
||||
public void setSourceDictionary(String sourceDictionary) {
|
||||
this.sourceDictionary = sourceDictionary;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Label> getLabels() {
|
||||
return labels;
|
||||
}
|
||||
|
||||
public void setLabels(List<Label> labels) {
|
||||
this.labels = labels;
|
||||
}
|
||||
//
|
||||
|
||||
public String getSequence() {
|
||||
return sequence;
|
||||
}
|
||||
|
||||
public void setSequence(String sequence) {
|
||||
this.sequence = sequence;
|
||||
}
|
||||
//
|
||||
|
||||
public String getSeqString() {
|
||||
return seqString;
|
||||
}
|
||||
|
||||
public void setSeqString(String seqString) {
|
||||
this.seqString = seqString;
|
||||
}
|
||||
//
|
||||
|
||||
public String getExtendedText() {
|
||||
return extendedText;
|
||||
}
|
||||
|
||||
public void setExtendedText(String extendedText) {
|
||||
this.extendedText = extendedText;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class DefinitionSearchResults extends WordnikObject {
|
||||
|
||||
//
|
||||
private List<Definition> results = new ArrayList< Definition>();
|
||||
//
|
||||
private int totalResults ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public List<Definition> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(List<Definition> results) {
|
||||
this.results = results;
|
||||
}
|
||||
//
|
||||
|
||||
public int getTotalResults() {
|
||||
return totalResults;
|
||||
}
|
||||
|
||||
public void setTotalResults(int totalResults) {
|
||||
this.totalResults = totalResults;
|
||||
}
|
||||
|
||||
}
|
45
android/driver/src/main/java/com/wordnik/model/Doc.java
Normal file
45
android/driver/src/main/java/com/wordnik/model/Doc.java
Normal file
@ -0,0 +1,45 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Doc extends WordnikObject {
|
||||
|
||||
//
|
||||
private List<Endpoint> endPoints = new ArrayList< Endpoint>();
|
||||
//
|
||||
private List<Object> models = new ArrayList< Object>();
|
||||
|
||||
|
||||
//
|
||||
|
||||
public List<Endpoint> getEndPoints() {
|
||||
return endPoints;
|
||||
}
|
||||
|
||||
public void setEndPoints(List<Endpoint> endPoints) {
|
||||
this.endPoints = endPoints;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Object> getModels() {
|
||||
return models;
|
||||
}
|
||||
|
||||
public void setModels(List<Object> models) {
|
||||
this.models = models;
|
||||
}
|
||||
|
||||
}
|
56
android/driver/src/main/java/com/wordnik/model/Endpoint.java
Normal file
56
android/driver/src/main/java/com/wordnik/model/Endpoint.java
Normal file
@ -0,0 +1,56 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Endpoint extends WordnikObject {
|
||||
|
||||
//
|
||||
private String path ;
|
||||
//
|
||||
private String description ;
|
||||
//
|
||||
private List<Operation> operations = new ArrayList< Operation>();
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
//
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Operation> getOperations() {
|
||||
return operations;
|
||||
}
|
||||
|
||||
public void setOperations(List<Operation> operations) {
|
||||
this.operations = operations;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class EntrySearchResult extends WordnikObject {
|
||||
|
||||
//
|
||||
private List<Definition> definitions = new ArrayList< Definition>();
|
||||
//
|
||||
private String sourceDictionary ;
|
||||
//
|
||||
private String headWord ;
|
||||
//
|
||||
private Long entryId ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public List<Definition> getDefinitions() {
|
||||
return definitions;
|
||||
}
|
||||
|
||||
public void setDefinitions(List<Definition> definitions) {
|
||||
this.definitions = definitions;
|
||||
}
|
||||
//
|
||||
|
||||
public String getSourceDictionary() {
|
||||
return sourceDictionary;
|
||||
}
|
||||
|
||||
public void setSourceDictionary(String sourceDictionary) {
|
||||
this.sourceDictionary = sourceDictionary;
|
||||
}
|
||||
//
|
||||
|
||||
public String getHeadWord() {
|
||||
return headWord;
|
||||
}
|
||||
|
||||
public void setHeadWord(String headWord) {
|
||||
this.headWord = headWord;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getEntryId() {
|
||||
return entryId;
|
||||
}
|
||||
|
||||
public void setEntryId(Long entryId) {
|
||||
this.entryId = entryId;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class EntrySearchResults extends WordnikObject {
|
||||
|
||||
//
|
||||
private List<EntrySearchResult> searchResults = new ArrayList< EntrySearchResult>();
|
||||
//
|
||||
private int totalResults ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public List<EntrySearchResult> getSearchResults() {
|
||||
return searchResults;
|
||||
}
|
||||
|
||||
public void setSearchResults(List<EntrySearchResult> searchResults) {
|
||||
this.searchResults = searchResults;
|
||||
}
|
||||
//
|
||||
|
||||
public int getTotalResults() {
|
||||
return totalResults;
|
||||
}
|
||||
|
||||
public void setTotalResults(int totalResults) {
|
||||
this.totalResults = totalResults;
|
||||
}
|
||||
|
||||
}
|
43
android/driver/src/main/java/com/wordnik/model/Error.java
Normal file
43
android/driver/src/main/java/com/wordnik/model/Error.java
Normal file
@ -0,0 +1,43 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Error extends WordnikObject {
|
||||
|
||||
//
|
||||
private String reason ;
|
||||
//
|
||||
private int code ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
//
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
}
|
120
android/driver/src/main/java/com/wordnik/model/Example.java
Normal file
120
android/driver/src/main/java/com/wordnik/model/Example.java
Normal file
@ -0,0 +1,120 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Example extends WordnikObject {
|
||||
|
||||
//
|
||||
private int year ;
|
||||
//
|
||||
private ContentProvider provider ;
|
||||
//
|
||||
private String url ;
|
||||
//
|
||||
private String word ;
|
||||
//
|
||||
private String text ;
|
||||
//
|
||||
private String title ;
|
||||
//
|
||||
private float rating ;
|
||||
//
|
||||
private Long exampleId ;
|
||||
//
|
||||
private Long documentId ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public int getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(int year) {
|
||||
this.year = year;
|
||||
}
|
||||
//
|
||||
|
||||
public ContentProvider getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProvider(ContentProvider provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
//
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
//
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
//
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
//
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
//
|
||||
|
||||
public float getRating() {
|
||||
return rating;
|
||||
}
|
||||
|
||||
public void setRating(float rating) {
|
||||
this.rating = rating;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getExampleId() {
|
||||
return exampleId;
|
||||
}
|
||||
|
||||
public void setExampleId(Long exampleId) {
|
||||
this.exampleId = exampleId;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getDocumentId() {
|
||||
return documentId;
|
||||
}
|
||||
|
||||
public void setDocumentId(Long documentId) {
|
||||
this.documentId = documentId;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class ExampleSearchResults extends WordnikObject {
|
||||
|
||||
//
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class ExampleUsage extends WordnikObject {
|
||||
|
||||
//
|
||||
private String text ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
}
|
45
android/driver/src/main/java/com/wordnik/model/Facet.java
Normal file
45
android/driver/src/main/java/com/wordnik/model/Facet.java
Normal file
@ -0,0 +1,45 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Facet extends WordnikObject {
|
||||
|
||||
//
|
||||
private String name ;
|
||||
//
|
||||
private List<FacetValue> facetValues = new ArrayList< FacetValue>();
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//
|
||||
|
||||
public List<FacetValue> getFacetValues() {
|
||||
return facetValues;
|
||||
}
|
||||
|
||||
public void setFacetValues(List<FacetValue> facetValues) {
|
||||
this.facetValues = facetValues;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class FacetValue extends WordnikObject {
|
||||
|
||||
//
|
||||
private String value ;
|
||||
//
|
||||
private Long count ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Long count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Frequency extends WordnikObject {
|
||||
|
||||
//
|
||||
private int year ;
|
||||
//
|
||||
private Long count ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public int getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(int year) {
|
||||
this.year = year;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Long count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class FrequencyElement extends WordnikObject {
|
||||
|
||||
//
|
||||
private int year ;
|
||||
//
|
||||
private Double lowerWisker ;
|
||||
//
|
||||
private Double upperWisker ;
|
||||
//
|
||||
private Double lowerBox ;
|
||||
//
|
||||
private Double upperBox ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public int getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(int year) {
|
||||
this.year = year;
|
||||
}
|
||||
//
|
||||
|
||||
public Double getLowerWisker() {
|
||||
return lowerWisker;
|
||||
}
|
||||
|
||||
public void setLowerWisker(Double lowerWisker) {
|
||||
this.lowerWisker = lowerWisker;
|
||||
}
|
||||
//
|
||||
|
||||
public Double getUpperWisker() {
|
||||
return upperWisker;
|
||||
}
|
||||
|
||||
public void setUpperWisker(Double upperWisker) {
|
||||
this.upperWisker = upperWisker;
|
||||
}
|
||||
//
|
||||
|
||||
public Double getLowerBox() {
|
||||
return lowerBox;
|
||||
}
|
||||
|
||||
public void setLowerBox(Double lowerBox) {
|
||||
this.lowerBox = lowerBox;
|
||||
}
|
||||
//
|
||||
|
||||
public Double getUpperBox() {
|
||||
return upperBox;
|
||||
}
|
||||
|
||||
public void setUpperBox(Double upperBox) {
|
||||
this.upperBox = upperBox;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class FrequencySummary extends WordnikObject {
|
||||
|
||||
//
|
||||
private String word ;
|
||||
//
|
||||
private Long totalCount ;
|
||||
//
|
||||
private List<Frequency> frequency = new ArrayList< Frequency>();
|
||||
//
|
||||
private int unknownYearCount ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getTotalCount() {
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
public void setTotalCount(Long totalCount) {
|
||||
this.totalCount = totalCount;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Frequency> getFrequency() {
|
||||
return frequency;
|
||||
}
|
||||
|
||||
public void setFrequency(List<Frequency> frequency) {
|
||||
this.frequency = frequency;
|
||||
}
|
||||
//
|
||||
|
||||
public int getUnknownYearCount() {
|
||||
return unknownYearCount;
|
||||
}
|
||||
|
||||
public void setUnknownYearCount(int unknownYearCount) {
|
||||
this.unknownYearCount = unknownYearCount;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class FrequencySummaryE extends WordnikObject {
|
||||
|
||||
//
|
||||
private List<FrequencyElement> elements = new ArrayList< FrequencyElement>();
|
||||
|
||||
|
||||
//
|
||||
|
||||
public List<FrequencyElement> getElements() {
|
||||
return elements;
|
||||
}
|
||||
|
||||
public void setElements(List<FrequencyElement> elements) {
|
||||
this.elements = elements;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class GetAudioOutput extends WordnikObject {
|
||||
|
||||
//
|
||||
private List<AudioObject> audioObject = new ArrayList< AudioObject>();
|
||||
//
|
||||
private List<AudioFile> audioFile = new ArrayList< AudioFile>();
|
||||
|
||||
|
||||
//
|
||||
|
||||
public List<AudioObject> getAudioObject() {
|
||||
return audioObject;
|
||||
}
|
||||
|
||||
public void setAudioObject(List<AudioObject> audioObject) {
|
||||
this.audioObject = audioObject;
|
||||
}
|
||||
//
|
||||
|
||||
public List<AudioFile> getAudioFile() {
|
||||
return audioFile;
|
||||
}
|
||||
|
||||
public void setAudioFile(List<AudioFile> audioFile) {
|
||||
this.audioFile = audioFile;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class GetFrequencyOutput extends WordnikObject {
|
||||
|
||||
//
|
||||
private FrequencySummary frequencySummary ;
|
||||
//
|
||||
private FrequencySummaryE frequencySummaryE ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public FrequencySummary getFrequencySummary() {
|
||||
return frequencySummary;
|
||||
}
|
||||
|
||||
public void setFrequencySummary(FrequencySummary frequencySummary) {
|
||||
this.frequencySummary = frequencySummary;
|
||||
}
|
||||
//
|
||||
|
||||
public FrequencySummaryE getFrequencySummaryE() {
|
||||
return frequencySummaryE;
|
||||
}
|
||||
|
||||
public void setFrequencySummaryE(FrequencySummaryE frequencySummaryE) {
|
||||
this.frequencySummaryE = frequencySummaryE;
|
||||
}
|
||||
|
||||
}
|
43
android/driver/src/main/java/com/wordnik/model/Label.java
Normal file
43
android/driver/src/main/java/com/wordnik/model/Label.java
Normal file
@ -0,0 +1,43 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Label extends WordnikObject {
|
||||
|
||||
//
|
||||
private String type ;
|
||||
//
|
||||
private String text ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
//
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
}
|
67
android/driver/src/main/java/com/wordnik/model/Note.java
Normal file
67
android/driver/src/main/java/com/wordnik/model/Note.java
Normal file
@ -0,0 +1,67 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Note extends WordnikObject {
|
||||
|
||||
//Contains the type of note
|
||||
private String noteType ;
|
||||
//
|
||||
private int pos ;
|
||||
//
|
||||
private String value ;
|
||||
//
|
||||
private List<String> appliesTo = new ArrayList< String>();
|
||||
|
||||
|
||||
//Contains the type of note
|
||||
@AllowableValues(value="x, y, z")
|
||||
public String getNoteType() {
|
||||
return noteType;
|
||||
}
|
||||
|
||||
public void setNoteType(String noteType) {
|
||||
this.noteType = noteType;
|
||||
}
|
||||
//
|
||||
|
||||
public int getPos() {
|
||||
return pos;
|
||||
}
|
||||
|
||||
public void setPos(int pos) {
|
||||
this.pos = pos;
|
||||
}
|
||||
//
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
//
|
||||
|
||||
public List<String> getAppliesTo() {
|
||||
return appliesTo;
|
||||
}
|
||||
|
||||
public void setAppliesTo(List<String> appliesTo) {
|
||||
this.appliesTo = appliesTo;
|
||||
}
|
||||
|
||||
}
|
56
android/driver/src/main/java/com/wordnik/model/Object.java
Normal file
56
android/driver/src/main/java/com/wordnik/model/Object.java
Normal file
@ -0,0 +1,56 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Object extends WordnikObject {
|
||||
|
||||
//
|
||||
private String name ;
|
||||
//
|
||||
private List<Parameter> fields = new ArrayList< Parameter>();
|
||||
//
|
||||
private String uniqueFieldName ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Parameter> getFields() {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public void setFields(List<Parameter> fields) {
|
||||
this.fields = fields;
|
||||
}
|
||||
//
|
||||
|
||||
public String getUniqueFieldName() {
|
||||
return uniqueFieldName;
|
||||
}
|
||||
|
||||
public void setUniqueFieldName(String uniqueFieldName) {
|
||||
this.uniqueFieldName = uniqueFieldName;
|
||||
}
|
||||
|
||||
}
|
122
android/driver/src/main/java/com/wordnik/model/Operation.java
Normal file
122
android/driver/src/main/java/com/wordnik/model/Operation.java
Normal file
@ -0,0 +1,122 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Operation extends WordnikObject {
|
||||
|
||||
//
|
||||
private List<Parameter> parameters = new ArrayList< Parameter>();
|
||||
//
|
||||
private List<Response> response = new ArrayList< Response>();
|
||||
//
|
||||
private String category ;
|
||||
//
|
||||
private String summary ;
|
||||
//
|
||||
private String suggestedName ;
|
||||
//
|
||||
private boolean deprecated ;
|
||||
//
|
||||
private boolean open ;
|
||||
//
|
||||
private String notes ;
|
||||
//
|
||||
private String httpMethod ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public List<Parameter> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public void setParameters(List<Parameter> parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Response> getResponse() {
|
||||
return response;
|
||||
}
|
||||
|
||||
public void setResponse(List<Response> response) {
|
||||
this.response = response;
|
||||
}
|
||||
//
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
//
|
||||
|
||||
public String getSummary() {
|
||||
return summary;
|
||||
}
|
||||
|
||||
public void setSummary(String summary) {
|
||||
this.summary = summary;
|
||||
}
|
||||
//
|
||||
|
||||
public String getSuggestedName() {
|
||||
return suggestedName;
|
||||
}
|
||||
|
||||
public void setSuggestedName(String suggestedName) {
|
||||
this.suggestedName = suggestedName;
|
||||
}
|
||||
//
|
||||
|
||||
public boolean getDeprecated() {
|
||||
return deprecated;
|
||||
}
|
||||
|
||||
public void setDeprecated(boolean deprecated) {
|
||||
this.deprecated = deprecated;
|
||||
}
|
||||
//
|
||||
|
||||
public boolean getOpen() {
|
||||
return open;
|
||||
}
|
||||
|
||||
public void setOpen(boolean open) {
|
||||
this.open = open;
|
||||
}
|
||||
//
|
||||
|
||||
public String getNotes() {
|
||||
return notes;
|
||||
}
|
||||
|
||||
public void setNotes(String notes) {
|
||||
this.notes = notes;
|
||||
}
|
||||
//
|
||||
|
||||
public String getHttpMethod() {
|
||||
return httpMethod;
|
||||
}
|
||||
|
||||
public void setHttpMethod(String httpMethod) {
|
||||
this.httpMethod = httpMethod;
|
||||
}
|
||||
|
||||
}
|
131
android/driver/src/main/java/com/wordnik/model/Parameter.java
Normal file
131
android/driver/src/main/java/com/wordnik/model/Parameter.java
Normal file
@ -0,0 +1,131 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Parameter extends WordnikObject {
|
||||
|
||||
//
|
||||
private String name ;
|
||||
//
|
||||
private String defaultValue ;
|
||||
//
|
||||
private String description ;
|
||||
//
|
||||
private boolean required ;
|
||||
//
|
||||
private String dataType ;
|
||||
//
|
||||
private String allowableValues ;
|
||||
//
|
||||
private String wrapperName ;
|
||||
//
|
||||
private String internalDescription ;
|
||||
//
|
||||
private String paramAccess ;
|
||||
//
|
||||
private String paramType ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
//
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
//
|
||||
|
||||
public boolean getRequired() {
|
||||
return required;
|
||||
}
|
||||
|
||||
public void setRequired(boolean required) {
|
||||
this.required = required;
|
||||
}
|
||||
//
|
||||
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
//
|
||||
|
||||
public String getAllowableValues() {
|
||||
return allowableValues;
|
||||
}
|
||||
|
||||
public void setAllowableValues(String allowableValues) {
|
||||
this.allowableValues = allowableValues;
|
||||
}
|
||||
//
|
||||
|
||||
public String getWrapperName() {
|
||||
return wrapperName;
|
||||
}
|
||||
|
||||
public void setWrapperName(String wrapperName) {
|
||||
this.wrapperName = wrapperName;
|
||||
}
|
||||
//
|
||||
|
||||
public String getInternalDescription() {
|
||||
return internalDescription;
|
||||
}
|
||||
|
||||
public void setInternalDescription(String internalDescription) {
|
||||
this.internalDescription = internalDescription;
|
||||
}
|
||||
//
|
||||
|
||||
public String getParamAccess() {
|
||||
return paramAccess;
|
||||
}
|
||||
|
||||
public void setParamAccess(String paramAccess) {
|
||||
this.paramAccess = paramAccess;
|
||||
}
|
||||
//
|
||||
|
||||
public String getParamType() {
|
||||
return paramType;
|
||||
}
|
||||
|
||||
public void setParamType(String paramType) {
|
||||
this.paramType = paramType;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class PartOfSpeech extends WordnikObject {
|
||||
|
||||
//
|
||||
private List<Root> roots = new ArrayList< Root>();
|
||||
|
||||
|
||||
//
|
||||
|
||||
public List<Root> getRoots() {
|
||||
return roots;
|
||||
}
|
||||
|
||||
public void setRoots(List<Root> roots) {
|
||||
this.roots = roots;
|
||||
}
|
||||
|
||||
}
|
100
android/driver/src/main/java/com/wordnik/model/Related.java
Normal file
100
android/driver/src/main/java/com/wordnik/model/Related.java
Normal file
@ -0,0 +1,100 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Related extends WordnikObject {
|
||||
|
||||
//
|
||||
private List<String> words = new ArrayList< String>();
|
||||
//
|
||||
private String relationshipType ;
|
||||
//
|
||||
private String label1 ;
|
||||
//
|
||||
private String label2 ;
|
||||
//
|
||||
private String label3 ;
|
||||
//
|
||||
private String label4 ;
|
||||
//
|
||||
private String gram ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public List<String> getWords() {
|
||||
return words;
|
||||
}
|
||||
|
||||
public void setWords(List<String> words) {
|
||||
this.words = words;
|
||||
}
|
||||
//
|
||||
|
||||
public String getRelationshipType() {
|
||||
return relationshipType;
|
||||
}
|
||||
|
||||
public void setRelationshipType(String relationshipType) {
|
||||
this.relationshipType = relationshipType;
|
||||
}
|
||||
//
|
||||
|
||||
public String getLabel1() {
|
||||
return label1;
|
||||
}
|
||||
|
||||
public void setLabel1(String label1) {
|
||||
this.label1 = label1;
|
||||
}
|
||||
//
|
||||
|
||||
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 String getLabel4() {
|
||||
return label4;
|
||||
}
|
||||
|
||||
public void setLabel4(String label4) {
|
||||
this.label4 = label4;
|
||||
}
|
||||
//
|
||||
|
||||
public String getGram() {
|
||||
return gram;
|
||||
}
|
||||
|
||||
public void setGram(String gram) {
|
||||
this.gram = gram;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class RelationshipMap extends WordnikObject {
|
||||
|
||||
//
|
||||
private String sourceWordstring ;
|
||||
//
|
||||
private List<Suggestion> suggestions = new ArrayList< Suggestion>();
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getSourceWordstring() {
|
||||
return sourceWordstring;
|
||||
}
|
||||
|
||||
public void setSourceWordstring(String sourceWordstring) {
|
||||
this.sourceWordstring = sourceWordstring;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Suggestion> getSuggestions() {
|
||||
return suggestions;
|
||||
}
|
||||
|
||||
public void setSuggestions(List<Suggestion> suggestions) {
|
||||
this.suggestions = suggestions;
|
||||
}
|
||||
|
||||
}
|
67
android/driver/src/main/java/com/wordnik/model/Response.java
Normal file
67
android/driver/src/main/java/com/wordnik/model/Response.java
Normal file
@ -0,0 +1,67 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Response extends WordnikObject {
|
||||
|
||||
//
|
||||
private String valueType ;
|
||||
//
|
||||
private List<Error> errorResponses = new ArrayList< Error>();
|
||||
//
|
||||
private String occurs ;
|
||||
//
|
||||
private String condition ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getValueType() {
|
||||
return valueType;
|
||||
}
|
||||
|
||||
public void setValueType(String valueType) {
|
||||
this.valueType = valueType;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Error> getErrorResponses() {
|
||||
return errorResponses;
|
||||
}
|
||||
|
||||
public void setErrorResponses(List<Error> errorResponses) {
|
||||
this.errorResponses = errorResponses;
|
||||
}
|
||||
//
|
||||
|
||||
public String getOccurs() {
|
||||
return occurs;
|
||||
}
|
||||
|
||||
public void setOccurs(String occurs) {
|
||||
this.occurs = occurs;
|
||||
}
|
||||
//
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public void setCondition(String condition) {
|
||||
this.condition = condition;
|
||||
}
|
||||
|
||||
}
|
45
android/driver/src/main/java/com/wordnik/model/Root.java
Normal file
45
android/driver/src/main/java/com/wordnik/model/Root.java
Normal file
@ -0,0 +1,45 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Root extends WordnikObject {
|
||||
|
||||
//
|
||||
private String name ;
|
||||
//
|
||||
private List<Category> categories = new ArrayList< Category>();
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Category> getCategories() {
|
||||
return categories;
|
||||
}
|
||||
|
||||
public void setCategories(List<Category> categories) {
|
||||
this.categories = categories;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class ScoredWord extends WordnikObject {
|
||||
|
||||
//
|
||||
private Long id ;
|
||||
//
|
||||
private String wordType ;
|
||||
//
|
||||
private int position ;
|
||||
//
|
||||
private String word ;
|
||||
//
|
||||
private float score ;
|
||||
//
|
||||
private Long sentenceId ;
|
||||
//
|
||||
private String partOfSpeech ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
//
|
||||
|
||||
public String getWordType() {
|
||||
return wordType;
|
||||
}
|
||||
|
||||
public void setWordType(String wordType) {
|
||||
this.wordType = wordType;
|
||||
}
|
||||
//
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void setPosition(int position) {
|
||||
this.position = position;
|
||||
}
|
||||
//
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
//
|
||||
|
||||
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 getPartOfSpeech() {
|
||||
return partOfSpeech;
|
||||
}
|
||||
|
||||
public void setPartOfSpeech(String partOfSpeech) {
|
||||
this.partOfSpeech = partOfSpeech;
|
||||
}
|
||||
|
||||
}
|
78
android/driver/src/main/java/com/wordnik/model/Sentence.java
Normal file
78
android/driver/src/main/java/com/wordnik/model/Sentence.java
Normal file
@ -0,0 +1,78 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Sentence extends WordnikObject {
|
||||
|
||||
//
|
||||
private Long id ;
|
||||
//
|
||||
private List<ScoredWord> scoredWords = new ArrayList< ScoredWord>();
|
||||
//
|
||||
private String display ;
|
||||
//
|
||||
private Long documentMetadataId ;
|
||||
//
|
||||
private int rating ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
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 Long getDocumentMetadataId() {
|
||||
return documentMetadataId;
|
||||
}
|
||||
|
||||
public void setDocumentMetadataId(Long documentMetadataId) {
|
||||
this.documentMetadataId = documentMetadataId;
|
||||
}
|
||||
//
|
||||
|
||||
public int getRating() {
|
||||
return rating;
|
||||
}
|
||||
|
||||
public void setRating(int rating) {
|
||||
this.rating = rating;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class SimpleDefinition extends WordnikObject {
|
||||
|
||||
//
|
||||
private String text ;
|
||||
//
|
||||
private String partOfSpeech ;
|
||||
//
|
||||
private String note ;
|
||||
//
|
||||
private String source ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
//
|
||||
|
||||
public String getPartOfSpeech() {
|
||||
return partOfSpeech;
|
||||
}
|
||||
|
||||
public void setPartOfSpeech(String partOfSpeech) {
|
||||
this.partOfSpeech = partOfSpeech;
|
||||
}
|
||||
//
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
//
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class SimpleExample extends WordnikObject {
|
||||
|
||||
//
|
||||
private String url ;
|
||||
//
|
||||
private String text ;
|
||||
//
|
||||
private String title ;
|
||||
//
|
||||
private Long id ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
//
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
//
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class SubscriptionStatus extends WordnikObject {
|
||||
|
||||
//
|
||||
private String name ;
|
||||
//
|
||||
private int id ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Suggestion extends WordnikObject {
|
||||
|
||||
//
|
||||
private int type ;
|
||||
//
|
||||
private String wordstring ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
//
|
||||
|
||||
public String getWordstring() {
|
||||
return wordstring;
|
||||
}
|
||||
|
||||
public void setWordstring(String wordstring) {
|
||||
this.wordstring = wordstring;
|
||||
}
|
||||
|
||||
}
|
54
android/driver/src/main/java/com/wordnik/model/Syllable.java
Normal file
54
android/driver/src/main/java/com/wordnik/model/Syllable.java
Normal file
@ -0,0 +1,54 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class Syllable extends WordnikObject {
|
||||
|
||||
//
|
||||
private String type ;
|
||||
//
|
||||
private int seq ;
|
||||
//
|
||||
private String text ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
//
|
||||
|
||||
public int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
|
||||
public void setSeq(int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
//
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
}
|
596
android/driver/src/main/java/com/wordnik/model/TestData.java
Normal file
596
android/driver/src/main/java/com/wordnik/model/TestData.java
Normal file
@ -0,0 +1,596 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import com.wordnik.common.StringValue;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class TestData extends WordnikObject {
|
||||
|
||||
//
|
||||
private List<Note> noteList = new ArrayList< Note>();
|
||||
//
|
||||
private List<Example> exampleList = new ArrayList< Example>();
|
||||
//
|
||||
private List<Definition> definitionList = new ArrayList< Definition>();
|
||||
//
|
||||
private List<Category> categoryList = new ArrayList< Category>();
|
||||
//
|
||||
private List<Frequency> frequencyList = new ArrayList< Frequency>();
|
||||
//
|
||||
private List<ContentProvider> contentProviderList = new ArrayList< ContentProvider>();
|
||||
//
|
||||
private List<AudioType> audioTypeList = new ArrayList< AudioType>();
|
||||
//
|
||||
private List<ExampleUsage> exampleUsageList = new ArrayList< ExampleUsage>();
|
||||
//
|
||||
private List<Root> rootList = new ArrayList< Root>();
|
||||
//
|
||||
private List<FrequencySummary> frequencySummaryList = new ArrayList< FrequencySummary>();
|
||||
//
|
||||
private List<Citation> citationList = new ArrayList< Citation>();
|
||||
//
|
||||
private List<ScoredWord> scoredWordList = new ArrayList< ScoredWord>();
|
||||
//
|
||||
private List<FacetValue> facetValueList = new ArrayList< FacetValue>();
|
||||
//
|
||||
private List<Sentence> sentenceList = new ArrayList< Sentence>();
|
||||
//
|
||||
private List<Facet> facetList = new ArrayList< Facet>();
|
||||
//
|
||||
private List<WordObject> wordObjectList = new ArrayList< WordObject>();
|
||||
//
|
||||
private List<RelationshipMap> relationshipMapList = new ArrayList< RelationshipMap>();
|
||||
//
|
||||
private List<Bigram> bigramList = new ArrayList< Bigram>();
|
||||
//
|
||||
private List<Related> relatedList = new ArrayList< Related>();
|
||||
//
|
||||
private List<ExampleSearchResults> exampleSearchResultsList = new ArrayList< ExampleSearchResults>();
|
||||
//
|
||||
private List<FrequencySummaryE> frequencySummaryEList = new ArrayList< FrequencySummaryE>();
|
||||
//
|
||||
private List<PartOfSpeech> partOfSpeechList = new ArrayList< PartOfSpeech>();
|
||||
//
|
||||
private List<AudioFile> audioFileList = new ArrayList< AudioFile>();
|
||||
//
|
||||
private List<Syllable> syllableList = new ArrayList< Syllable>();
|
||||
//
|
||||
private List<TextPron> textPronList = new ArrayList< TextPron>();
|
||||
//
|
||||
private List<Label> labelList = new ArrayList< Label>();
|
||||
//
|
||||
private List<DefinitionSearchResults> definitionSearchResultsList = new ArrayList< DefinitionSearchResults>();
|
||||
//
|
||||
private List<FrequencyElement> frequencyElementList = new ArrayList< FrequencyElement>();
|
||||
//
|
||||
private List<AudioObject> audioObjectList = new ArrayList< AudioObject>();
|
||||
//
|
||||
private List<Suggestion> suggestionList = new ArrayList< Suggestion>();
|
||||
//
|
||||
private List<WordFrequency> wordFrequencyList = new ArrayList< WordFrequency>();
|
||||
//
|
||||
private List<EntrySearchResult> entrySearchResultList = new ArrayList< EntrySearchResult>();
|
||||
//
|
||||
private List<WordOfTheDayList> wordOfTheDayListList = new ArrayList< WordOfTheDayList>();
|
||||
//
|
||||
private List<WordOfTheDay> wordOfTheDayList = new ArrayList< WordOfTheDay>();
|
||||
//
|
||||
private List<SubscriptionStatus> subscriptionStatusList = new ArrayList< SubscriptionStatus>();
|
||||
//
|
||||
private List<SimpleDefinition> simpleDefinitionList = new ArrayList< SimpleDefinition>();
|
||||
//
|
||||
private List<SimpleExample> simpleExampleList = new ArrayList< SimpleExample>();
|
||||
//
|
||||
private List<EntrySearchResults> entrySearchResultsList = new ArrayList< EntrySearchResults>();
|
||||
//
|
||||
private List<WordList> wordListList = new ArrayList< WordList>();
|
||||
//
|
||||
private List<WordListWord> wordListWordList = new ArrayList< WordListWord>();
|
||||
//
|
||||
private List<Error> errorList = new ArrayList< Error>();
|
||||
//
|
||||
private List<Response> responseList = new ArrayList< Response>();
|
||||
//
|
||||
private List<Parameter> parameterList = new ArrayList< Parameter>();
|
||||
//
|
||||
private List<Doc> docList = new ArrayList< Doc>();
|
||||
//
|
||||
private List<Object> objectList = new ArrayList< Object>();
|
||||
//
|
||||
private List<Endpoint> endpointList = new ArrayList< Endpoint>();
|
||||
//
|
||||
private List<Operation> operationList = new ArrayList< Operation>();
|
||||
//
|
||||
private List<ApiResponse> apiResponseList = new ArrayList< ApiResponse>();
|
||||
//
|
||||
private List<ApiTokenStatus> apiTokenStatusList = new ArrayList< ApiTokenStatus>();
|
||||
//
|
||||
private List<AuthenticationToken> authenticationTokenList = new ArrayList< AuthenticationToken>();
|
||||
//
|
||||
private List<User> userList = new ArrayList< User>();
|
||||
//
|
||||
private List<StringValue> StringValueList = new ArrayList< StringValue>();
|
||||
|
||||
|
||||
//
|
||||
|
||||
public List<Note> getNoteList() {
|
||||
return noteList;
|
||||
}
|
||||
|
||||
public void setNoteList(List<Note> noteList) {
|
||||
this.noteList = noteList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Example> getExampleList() {
|
||||
return exampleList;
|
||||
}
|
||||
|
||||
public void setExampleList(List<Example> exampleList) {
|
||||
this.exampleList = exampleList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Definition> getDefinitionList() {
|
||||
return definitionList;
|
||||
}
|
||||
|
||||
public void setDefinitionList(List<Definition> definitionList) {
|
||||
this.definitionList = definitionList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Category> getCategoryList() {
|
||||
return categoryList;
|
||||
}
|
||||
|
||||
public void setCategoryList(List<Category> categoryList) {
|
||||
this.categoryList = categoryList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Frequency> getFrequencyList() {
|
||||
return frequencyList;
|
||||
}
|
||||
|
||||
public void setFrequencyList(List<Frequency> frequencyList) {
|
||||
this.frequencyList = frequencyList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<ContentProvider> getContentProviderList() {
|
||||
return contentProviderList;
|
||||
}
|
||||
|
||||
public void setContentProviderList(List<ContentProvider> contentProviderList) {
|
||||
this.contentProviderList = contentProviderList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<AudioType> getAudioTypeList() {
|
||||
return audioTypeList;
|
||||
}
|
||||
|
||||
public void setAudioTypeList(List<AudioType> audioTypeList) {
|
||||
this.audioTypeList = audioTypeList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<ExampleUsage> getExampleUsageList() {
|
||||
return exampleUsageList;
|
||||
}
|
||||
|
||||
public void setExampleUsageList(List<ExampleUsage> exampleUsageList) {
|
||||
this.exampleUsageList = exampleUsageList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Root> getRootList() {
|
||||
return rootList;
|
||||
}
|
||||
|
||||
public void setRootList(List<Root> rootList) {
|
||||
this.rootList = rootList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<FrequencySummary> getFrequencySummaryList() {
|
||||
return frequencySummaryList;
|
||||
}
|
||||
|
||||
public void setFrequencySummaryList(List<FrequencySummary> frequencySummaryList) {
|
||||
this.frequencySummaryList = frequencySummaryList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Citation> getCitationList() {
|
||||
return citationList;
|
||||
}
|
||||
|
||||
public void setCitationList(List<Citation> citationList) {
|
||||
this.citationList = citationList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<ScoredWord> getScoredWordList() {
|
||||
return scoredWordList;
|
||||
}
|
||||
|
||||
public void setScoredWordList(List<ScoredWord> scoredWordList) {
|
||||
this.scoredWordList = scoredWordList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<FacetValue> getFacetValueList() {
|
||||
return facetValueList;
|
||||
}
|
||||
|
||||
public void setFacetValueList(List<FacetValue> facetValueList) {
|
||||
this.facetValueList = facetValueList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Sentence> getSentenceList() {
|
||||
return sentenceList;
|
||||
}
|
||||
|
||||
public void setSentenceList(List<Sentence> sentenceList) {
|
||||
this.sentenceList = sentenceList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Facet> getFacetList() {
|
||||
return facetList;
|
||||
}
|
||||
|
||||
public void setFacetList(List<Facet> facetList) {
|
||||
this.facetList = facetList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<WordObject> getWordObjectList() {
|
||||
return wordObjectList;
|
||||
}
|
||||
|
||||
public void setWordObjectList(List<WordObject> wordObjectList) {
|
||||
this.wordObjectList = wordObjectList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<RelationshipMap> getRelationshipMapList() {
|
||||
return relationshipMapList;
|
||||
}
|
||||
|
||||
public void setRelationshipMapList(List<RelationshipMap> relationshipMapList) {
|
||||
this.relationshipMapList = relationshipMapList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Bigram> getBigramList() {
|
||||
return bigramList;
|
||||
}
|
||||
|
||||
public void setBigramList(List<Bigram> bigramList) {
|
||||
this.bigramList = bigramList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Related> getRelatedList() {
|
||||
return relatedList;
|
||||
}
|
||||
|
||||
public void setRelatedList(List<Related> relatedList) {
|
||||
this.relatedList = relatedList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<ExampleSearchResults> getExampleSearchResultsList() {
|
||||
return exampleSearchResultsList;
|
||||
}
|
||||
|
||||
public void setExampleSearchResultsList(List<ExampleSearchResults> exampleSearchResultsList) {
|
||||
this.exampleSearchResultsList = exampleSearchResultsList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<FrequencySummaryE> getFrequencySummaryEList() {
|
||||
return frequencySummaryEList;
|
||||
}
|
||||
|
||||
public void setFrequencySummaryEList(List<FrequencySummaryE> frequencySummaryEList) {
|
||||
this.frequencySummaryEList = frequencySummaryEList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<PartOfSpeech> getPartOfSpeechList() {
|
||||
return partOfSpeechList;
|
||||
}
|
||||
|
||||
public void setPartOfSpeechList(List<PartOfSpeech> partOfSpeechList) {
|
||||
this.partOfSpeechList = partOfSpeechList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<AudioFile> getAudioFileList() {
|
||||
return audioFileList;
|
||||
}
|
||||
|
||||
public void setAudioFileList(List<AudioFile> audioFileList) {
|
||||
this.audioFileList = audioFileList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Syllable> getSyllableList() {
|
||||
return syllableList;
|
||||
}
|
||||
|
||||
public void setSyllableList(List<Syllable> syllableList) {
|
||||
this.syllableList = syllableList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<TextPron> getTextPronList() {
|
||||
return textPronList;
|
||||
}
|
||||
|
||||
public void setTextPronList(List<TextPron> textPronList) {
|
||||
this.textPronList = textPronList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Label> getLabelList() {
|
||||
return labelList;
|
||||
}
|
||||
|
||||
public void setLabelList(List<Label> labelList) {
|
||||
this.labelList = labelList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<DefinitionSearchResults> getDefinitionSearchResultsList() {
|
||||
return definitionSearchResultsList;
|
||||
}
|
||||
|
||||
public void setDefinitionSearchResultsList(List<DefinitionSearchResults> definitionSearchResultsList) {
|
||||
this.definitionSearchResultsList = definitionSearchResultsList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<FrequencyElement> getFrequencyElementList() {
|
||||
return frequencyElementList;
|
||||
}
|
||||
|
||||
public void setFrequencyElementList(List<FrequencyElement> frequencyElementList) {
|
||||
this.frequencyElementList = frequencyElementList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<AudioObject> getAudioObjectList() {
|
||||
return audioObjectList;
|
||||
}
|
||||
|
||||
public void setAudioObjectList(List<AudioObject> audioObjectList) {
|
||||
this.audioObjectList = audioObjectList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Suggestion> getSuggestionList() {
|
||||
return suggestionList;
|
||||
}
|
||||
|
||||
public void setSuggestionList(List<Suggestion> suggestionList) {
|
||||
this.suggestionList = suggestionList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<WordFrequency> getWordFrequencyList() {
|
||||
return wordFrequencyList;
|
||||
}
|
||||
|
||||
public void setWordFrequencyList(List<WordFrequency> wordFrequencyList) {
|
||||
this.wordFrequencyList = wordFrequencyList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<EntrySearchResult> getEntrySearchResultList() {
|
||||
return entrySearchResultList;
|
||||
}
|
||||
|
||||
public void setEntrySearchResultList(List<EntrySearchResult> entrySearchResultList) {
|
||||
this.entrySearchResultList = entrySearchResultList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<WordOfTheDayList> getWordOfTheDayListList() {
|
||||
return wordOfTheDayListList;
|
||||
}
|
||||
|
||||
public void setWordOfTheDayListList(List<WordOfTheDayList> wordOfTheDayListList) {
|
||||
this.wordOfTheDayListList = wordOfTheDayListList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<WordOfTheDay> getWordOfTheDayList() {
|
||||
return wordOfTheDayList;
|
||||
}
|
||||
|
||||
public void setWordOfTheDayList(List<WordOfTheDay> wordOfTheDayList) {
|
||||
this.wordOfTheDayList = wordOfTheDayList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<SubscriptionStatus> getSubscriptionStatusList() {
|
||||
return subscriptionStatusList;
|
||||
}
|
||||
|
||||
public void setSubscriptionStatusList(List<SubscriptionStatus> subscriptionStatusList) {
|
||||
this.subscriptionStatusList = subscriptionStatusList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<SimpleDefinition> getSimpleDefinitionList() {
|
||||
return simpleDefinitionList;
|
||||
}
|
||||
|
||||
public void setSimpleDefinitionList(List<SimpleDefinition> simpleDefinitionList) {
|
||||
this.simpleDefinitionList = simpleDefinitionList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<SimpleExample> getSimpleExampleList() {
|
||||
return simpleExampleList;
|
||||
}
|
||||
|
||||
public void setSimpleExampleList(List<SimpleExample> simpleExampleList) {
|
||||
this.simpleExampleList = simpleExampleList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<EntrySearchResults> getEntrySearchResultsList() {
|
||||
return entrySearchResultsList;
|
||||
}
|
||||
|
||||
public void setEntrySearchResultsList(List<EntrySearchResults> entrySearchResultsList) {
|
||||
this.entrySearchResultsList = entrySearchResultsList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<WordList> getWordListList() {
|
||||
return wordListList;
|
||||
}
|
||||
|
||||
public void setWordListList(List<WordList> wordListList) {
|
||||
this.wordListList = wordListList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<WordListWord> getWordListWordList() {
|
||||
return wordListWordList;
|
||||
}
|
||||
|
||||
public void setWordListWordList(List<WordListWord> wordListWordList) {
|
||||
this.wordListWordList = wordListWordList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Error> getErrorList() {
|
||||
return errorList;
|
||||
}
|
||||
|
||||
public void setErrorList(List<Error> errorList) {
|
||||
this.errorList = errorList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Response> getResponseList() {
|
||||
return responseList;
|
||||
}
|
||||
|
||||
public void setResponseList(List<Response> responseList) {
|
||||
this.responseList = responseList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Parameter> getParameterList() {
|
||||
return parameterList;
|
||||
}
|
||||
|
||||
public void setParameterList(List<Parameter> parameterList) {
|
||||
this.parameterList = parameterList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Doc> getDocList() {
|
||||
return docList;
|
||||
}
|
||||
|
||||
public void setDocList(List<Doc> docList) {
|
||||
this.docList = docList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Object> getObjectList() {
|
||||
return objectList;
|
||||
}
|
||||
|
||||
public void setObjectList(List<Object> objectList) {
|
||||
this.objectList = objectList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Endpoint> getEndpointList() {
|
||||
return endpointList;
|
||||
}
|
||||
|
||||
public void setEndpointList(List<Endpoint> endpointList) {
|
||||
this.endpointList = endpointList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<Operation> getOperationList() {
|
||||
return operationList;
|
||||
}
|
||||
|
||||
public void setOperationList(List<Operation> operationList) {
|
||||
this.operationList = operationList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<ApiResponse> getApiResponseList() {
|
||||
return apiResponseList;
|
||||
}
|
||||
|
||||
public void setApiResponseList(List<ApiResponse> apiResponseList) {
|
||||
this.apiResponseList = apiResponseList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<ApiTokenStatus> getApiTokenStatusList() {
|
||||
return apiTokenStatusList;
|
||||
}
|
||||
|
||||
public void setApiTokenStatusList(List<ApiTokenStatus> apiTokenStatusList) {
|
||||
this.apiTokenStatusList = apiTokenStatusList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<AuthenticationToken> getAuthenticationTokenList() {
|
||||
return authenticationTokenList;
|
||||
}
|
||||
|
||||
public void setAuthenticationTokenList(List<AuthenticationToken> authenticationTokenList) {
|
||||
this.authenticationTokenList = authenticationTokenList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<User> getUserList() {
|
||||
return userList;
|
||||
}
|
||||
|
||||
public void setUserList(List<User> userList) {
|
||||
this.userList = userList;
|
||||
}
|
||||
//
|
||||
|
||||
public List<StringValue> getStringValueList() {
|
||||
return StringValueList;
|
||||
}
|
||||
|
||||
public void setStringValueList(List<StringValue> StringValueList) {
|
||||
this.StringValueList = StringValueList;
|
||||
}
|
||||
|
||||
}
|
65
android/driver/src/main/java/com/wordnik/model/TextPron.java
Normal file
65
android/driver/src/main/java/com/wordnik/model/TextPron.java
Normal file
@ -0,0 +1,65 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class TextPron extends WordnikObject {
|
||||
|
||||
//
|
||||
private Long id ;
|
||||
//
|
||||
private int seq ;
|
||||
//
|
||||
private String raw ;
|
||||
//
|
||||
private String rawType ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
//
|
||||
|
||||
public int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
|
||||
public void setSeq(int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
//
|
||||
|
||||
public String getRaw() {
|
||||
return raw;
|
||||
}
|
||||
|
||||
public void setRaw(String raw) {
|
||||
this.raw = raw;
|
||||
}
|
||||
//
|
||||
|
||||
public String getRawType() {
|
||||
return rawType;
|
||||
}
|
||||
|
||||
public void setRawType(String rawType) {
|
||||
this.rawType = rawType;
|
||||
}
|
||||
|
||||
}
|
98
android/driver/src/main/java/com/wordnik/model/User.java
Normal file
98
android/driver/src/main/java/com/wordnik/model/User.java
Normal file
@ -0,0 +1,98 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class User extends WordnikObject {
|
||||
|
||||
//Unique idenitifier for a user
|
||||
private Long id ;
|
||||
//Display name
|
||||
private String displayName ;
|
||||
//Account status
|
||||
private int status ;
|
||||
//
|
||||
private String password ;
|
||||
//User name
|
||||
private String userName ;
|
||||
//Email address
|
||||
private String email ;
|
||||
//Facebook ID
|
||||
private String faceBookId ;
|
||||
|
||||
|
||||
//Unique idenitifier for a user
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
//Display name
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
//Account status
|
||||
@AllowableValues(value="0,1,2,3")
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
//
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
//User name
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
//Email address
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
//Facebook ID
|
||||
|
||||
public String getFaceBookId() {
|
||||
return faceBookId;
|
||||
}
|
||||
|
||||
public void setFaceBookId(String faceBookId) {
|
||||
this.faceBookId = faceBookId;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordContextualLookupInput extends WordnikObject {
|
||||
|
||||
//Word to return definitions for
|
||||
private String word ;
|
||||
//The sentence in which the word occurs
|
||||
private String sentence ;
|
||||
//The start character offset of the word in the given sentence
|
||||
private String offset ;
|
||||
//Expand context terms using related words
|
||||
private String expandTerms ;
|
||||
//Only include these comma-delimited source dictionaries
|
||||
private String includeSourceDictionaries ;
|
||||
//Exclude these comma-delimited source dictionaries
|
||||
private String excludeSourceDictionaries ;
|
||||
//Results to skip
|
||||
private String skip ;
|
||||
//Maximum number of results to return
|
||||
private String limit ;
|
||||
|
||||
|
||||
//Word to return definitions for
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
//The sentence in which the word occurs
|
||||
|
||||
public String getSentence() {
|
||||
return sentence;
|
||||
}
|
||||
|
||||
public void setSentence(String sentence) {
|
||||
this.sentence = sentence;
|
||||
}
|
||||
//The start character offset of the word in the given sentence
|
||||
@AllowableValues(value="0 to 4096")
|
||||
public String getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
public void setOffset(String offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
//Expand context terms using related words
|
||||
@AllowableValues(value="true,false")
|
||||
public String getExpandTerms() {
|
||||
return expandTerms;
|
||||
}
|
||||
|
||||
public void setExpandTerms(String expandTerms) {
|
||||
this.expandTerms = expandTerms;
|
||||
}
|
||||
//Only include these comma-delimited source dictionaries
|
||||
@AllowableValues(value="ahd, century, wiktionary, webster, wordnet")
|
||||
public String getIncludeSourceDictionaries() {
|
||||
return includeSourceDictionaries;
|
||||
}
|
||||
|
||||
public void setIncludeSourceDictionaries(String includeSourceDictionaries) {
|
||||
this.includeSourceDictionaries = includeSourceDictionaries;
|
||||
}
|
||||
//Exclude these comma-delimited source dictionaries
|
||||
@AllowableValues(value="ahd, century, wiktionary, webster, wordnet")
|
||||
public String getExcludeSourceDictionaries() {
|
||||
return excludeSourceDictionaries;
|
||||
}
|
||||
|
||||
public void setExcludeSourceDictionaries(String excludeSourceDictionaries) {
|
||||
this.excludeSourceDictionaries = excludeSourceDictionaries;
|
||||
}
|
||||
//Results to skip
|
||||
@AllowableValues(value="0 to 1000")
|
||||
public String getSkip() {
|
||||
return skip;
|
||||
}
|
||||
|
||||
public void setSkip(String skip) {
|
||||
this.skip = skip;
|
||||
}
|
||||
//Maximum number of results to return
|
||||
@AllowableValues(value="1 to 1000")
|
||||
public String getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(String limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordDefinitionsInput extends WordnikObject {
|
||||
|
||||
//Word to return definitions for
|
||||
private String word ;
|
||||
//Maximum number of results to return
|
||||
private String limit ;
|
||||
//CSV list of part-of-speech types
|
||||
private String partOfSpeech ;
|
||||
//Return related words with definitions
|
||||
private String includeRelated ;
|
||||
//Gets from dictionaries in the supplied order of precedence
|
||||
private String sourceDictionaries ;
|
||||
//If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
||||
private String useCanonical ;
|
||||
//Return a closed set of XML tags in response
|
||||
private String includeTags ;
|
||||
|
||||
|
||||
//Word to return definitions for
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
//Maximum number of results to return
|
||||
|
||||
public String getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(String limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
//CSV list of part-of-speech types
|
||||
@AllowableValues(value="noun,adjective,verb,adverb,interjection,pronoun,preposition,abbreviation,affix,article,auxiliary-verb,conjunction,definite-article,family-name,given-name,idiom,imperative,noun-plural,noun-posessive,past-participle,phrasal-prefix,proper-noun,proper-noun-plural,proper-noun-posessive,suffix,verb-intransitive,verb-transitive")
|
||||
public String getPartOfSpeech() {
|
||||
return partOfSpeech;
|
||||
}
|
||||
|
||||
public void setPartOfSpeech(String partOfSpeech) {
|
||||
this.partOfSpeech = partOfSpeech;
|
||||
}
|
||||
//Return related words with definitions
|
||||
@AllowableValues(value="true,false")
|
||||
public String getIncludeRelated() {
|
||||
return includeRelated;
|
||||
}
|
||||
|
||||
public void setIncludeRelated(String includeRelated) {
|
||||
this.includeRelated = includeRelated;
|
||||
}
|
||||
//Gets from dictionaries in the supplied order of precedence
|
||||
@AllowableValues(value="ahd, century, wiktionary, webster, wordnet")
|
||||
public String getSourceDictionaries() {
|
||||
return sourceDictionaries;
|
||||
}
|
||||
|
||||
public void setSourceDictionaries(String sourceDictionaries) {
|
||||
this.sourceDictionaries = sourceDictionaries;
|
||||
}
|
||||
//If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
||||
@AllowableValues(value="false,true")
|
||||
public String getUseCanonical() {
|
||||
return useCanonical;
|
||||
}
|
||||
|
||||
public void setUseCanonical(String useCanonical) {
|
||||
this.useCanonical = useCanonical;
|
||||
}
|
||||
//Return a closed set of XML tags in response
|
||||
@AllowableValues(value="false,true")
|
||||
public String getIncludeTags() {
|
||||
return includeTags;
|
||||
}
|
||||
|
||||
public void setIncludeTags(String includeTags) {
|
||||
this.includeTags = includeTags;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordExamplesInput extends WordnikObject {
|
||||
|
||||
//Word to return examples for
|
||||
private String word ;
|
||||
//Maximum number of results to return
|
||||
private String limit ;
|
||||
//Show duplicate examples from different sources
|
||||
private String includeDuplicates ;
|
||||
//Return results from a specific ContentProvider
|
||||
private String contentProvider ;
|
||||
//If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
||||
private String useCanonical ;
|
||||
//Results to skip
|
||||
private String skip ;
|
||||
|
||||
|
||||
//Word to return examples for
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
//Maximum number of results to return
|
||||
|
||||
public String getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(String limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
//Show duplicate examples from different sources
|
||||
|
||||
public String getIncludeDuplicates() {
|
||||
return includeDuplicates;
|
||||
}
|
||||
|
||||
public void setIncludeDuplicates(String includeDuplicates) {
|
||||
this.includeDuplicates = includeDuplicates;
|
||||
}
|
||||
//Return results from a specific ContentProvider
|
||||
|
||||
public String getContentProvider() {
|
||||
return contentProvider;
|
||||
}
|
||||
|
||||
public void setContentProvider(String contentProvider) {
|
||||
this.contentProvider = contentProvider;
|
||||
}
|
||||
//If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
||||
|
||||
public String getUseCanonical() {
|
||||
return useCanonical;
|
||||
}
|
||||
|
||||
public void setUseCanonical(String useCanonical) {
|
||||
this.useCanonical = useCanonical;
|
||||
}
|
||||
//Results to skip
|
||||
|
||||
public String getSkip() {
|
||||
return skip;
|
||||
}
|
||||
|
||||
public void setSkip(String skip) {
|
||||
this.skip = skip;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordFrequency extends WordnikObject {
|
||||
|
||||
//
|
||||
private Long count ;
|
||||
//
|
||||
private String wordstring ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public Long getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Long count) {
|
||||
this.count = count;
|
||||
}
|
||||
//
|
||||
|
||||
public String getWordstring() {
|
||||
return wordstring;
|
||||
}
|
||||
|
||||
public void setWordstring(String wordstring) {
|
||||
this.wordstring = wordstring;
|
||||
}
|
||||
|
||||
}
|
132
android/driver/src/main/java/com/wordnik/model/WordList.java
Normal file
132
android/driver/src/main/java/com/wordnik/model/WordList.java
Normal file
@ -0,0 +1,132 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordList extends WordnikObject {
|
||||
|
||||
//
|
||||
private String name ;
|
||||
//
|
||||
private Long id ;
|
||||
//
|
||||
private String type ;
|
||||
//
|
||||
private String description ;
|
||||
//
|
||||
private Long userId ;
|
||||
//
|
||||
private String permalink ;
|
||||
//
|
||||
private Date createdAt ;
|
||||
//
|
||||
private String username ;
|
||||
//
|
||||
private Date updatedAt ;
|
||||
//
|
||||
private Long numberWordsInList ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
//
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
//
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
//
|
||||
|
||||
public String getPermalink() {
|
||||
return permalink;
|
||||
}
|
||||
|
||||
public void setPermalink(String permalink) {
|
||||
this.permalink = permalink;
|
||||
}
|
||||
//
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Date createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
//
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
//
|
||||
|
||||
public Date getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Date updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
//
|
||||
|
||||
public Long getNumberWordsInList() {
|
||||
return numberWordsInList;
|
||||
}
|
||||
|
||||
public void setNumberWordsInList(Long numberWordsInList) {
|
||||
this.numberWordsInList = numberWordsInList;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordListWord extends WordnikObject {
|
||||
|
||||
//
|
||||
private Long userId ;
|
||||
//
|
||||
private String word ;
|
||||
//
|
||||
private Date createdAt ;
|
||||
//
|
||||
private String username ;
|
||||
//
|
||||
private Long numberCommentsOnWord ;
|
||||
//
|
||||
private Long numberLists ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
//
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
//
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Date createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
//
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
//
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordListWordsInput extends WordnikObject {
|
||||
|
||||
//ID of WordList to use
|
||||
private String wordListId ;
|
||||
//Field to sort by
|
||||
private String sortBy ;
|
||||
//Direction to sort
|
||||
private String sortOrder ;
|
||||
//Results to skip
|
||||
private String skip ;
|
||||
//Maximum number of results to return
|
||||
private String limit ;
|
||||
|
||||
|
||||
//ID of WordList to use
|
||||
|
||||
public String getWordListId() {
|
||||
return wordListId;
|
||||
}
|
||||
|
||||
public void setWordListId(String wordListId) {
|
||||
this.wordListId = wordListId;
|
||||
}
|
||||
//Field to sort by
|
||||
@AllowableValues(value="createDate,alpha")
|
||||
public String getSortBy() {
|
||||
return sortBy;
|
||||
}
|
||||
|
||||
public void setSortBy(String sortBy) {
|
||||
this.sortBy = sortBy;
|
||||
}
|
||||
//Direction to sort
|
||||
@AllowableValues(value="asc,desc")
|
||||
public String getSortOrder() {
|
||||
return sortOrder;
|
||||
}
|
||||
|
||||
public void setSortOrder(String sortOrder) {
|
||||
this.sortOrder = sortOrder;
|
||||
}
|
||||
//Results to skip
|
||||
|
||||
public String getSkip() {
|
||||
return skip;
|
||||
}
|
||||
|
||||
public void setSkip(String skip) {
|
||||
this.skip = skip;
|
||||
}
|
||||
//Maximum number of results to return
|
||||
|
||||
public String getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(String limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordObject extends WordnikObject {
|
||||
|
||||
//
|
||||
private String word ;
|
||||
//
|
||||
private String vulgar ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
//
|
||||
|
||||
public String getVulgar() {
|
||||
return vulgar;
|
||||
}
|
||||
|
||||
public void setVulgar(String vulgar) {
|
||||
this.vulgar = vulgar;
|
||||
}
|
||||
|
||||
}
|
158
android/driver/src/main/java/com/wordnik/model/WordOfTheDay.java
Normal file
158
android/driver/src/main/java/com/wordnik/model/WordOfTheDay.java
Normal file
@ -0,0 +1,158 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordOfTheDay extends WordnikObject {
|
||||
|
||||
//
|
||||
private Long id ;
|
||||
//
|
||||
private String category ;
|
||||
//
|
||||
private List<SimpleExample> examples = new ArrayList< SimpleExample>();
|
||||
//
|
||||
private String createdBy ;
|
||||
//
|
||||
private String word ;
|
||||
//
|
||||
private List<SimpleDefinition> definitions = new ArrayList< SimpleDefinition>();
|
||||
//
|
||||
private ContentProvider contentProvider ;
|
||||
//
|
||||
private Date createdAt ;
|
||||
//
|
||||
private Date publishDate ;
|
||||
//
|
||||
private String parentId ;
|
||||
//
|
||||
private String note ;
|
||||
//
|
||||
private String htmlExtra ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
@Required
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
//
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
//
|
||||
|
||||
public List<SimpleExample> getExamples() {
|
||||
return examples;
|
||||
}
|
||||
|
||||
public void setExamples(List<SimpleExample> examples) {
|
||||
this.examples = examples;
|
||||
}
|
||||
//
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
//
|
||||
|
||||
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 ContentProvider getContentProvider() {
|
||||
return contentProvider;
|
||||
}
|
||||
|
||||
public void setContentProvider(ContentProvider contentProvider) {
|
||||
this.contentProvider = contentProvider;
|
||||
}
|
||||
//
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Date createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
//
|
||||
|
||||
public Date getPublishDate() {
|
||||
return publishDate;
|
||||
}
|
||||
|
||||
public void setPublishDate(Date publishDate) {
|
||||
this.publishDate = publishDate;
|
||||
}
|
||||
//
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
//
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
//
|
||||
|
||||
public String getHtmlExtra() {
|
||||
return htmlExtra;
|
||||
}
|
||||
|
||||
public void setHtmlExtra(String htmlExtra) {
|
||||
this.htmlExtra = htmlExtra;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,235 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordOfTheDayList extends WordnikObject {
|
||||
|
||||
//
|
||||
private String name ;
|
||||
//
|
||||
private String id ;
|
||||
//
|
||||
private String description ;
|
||||
//
|
||||
private String category ;
|
||||
//
|
||||
private String createdBy ;
|
||||
//
|
||||
private List<WordOfTheDay> items = new ArrayList< WordOfTheDay>();
|
||||
//
|
||||
private int subscriberCount ;
|
||||
//
|
||||
private String subscriptionStatus ;
|
||||
//
|
||||
private Date createdAt ;
|
||||
//
|
||||
private int commentCount ;
|
||||
//
|
||||
private int voteCount ;
|
||||
//
|
||||
private float voteAverage ;
|
||||
//
|
||||
private float voteWeightedAverage ;
|
||||
//
|
||||
private int itemCount ;
|
||||
//
|
||||
private Date firstItemDate ;
|
||||
//
|
||||
private Date lastItemDate ;
|
||||
//
|
||||
private String subscriptionSchedule ;
|
||||
//
|
||||
private String subscriptionNamespace ;
|
||||
//
|
||||
private String subscriptionIdentifier ;
|
||||
|
||||
|
||||
//
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
//
|
||||
|
||||
@Required
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
//
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
//
|
||||
|
||||
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 List<WordOfTheDay> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<WordOfTheDay> items) {
|
||||
this.items = items;
|
||||
}
|
||||
//
|
||||
|
||||
public int getSubscriberCount() {
|
||||
return subscriberCount;
|
||||
}
|
||||
|
||||
public void setSubscriberCount(int subscriberCount) {
|
||||
this.subscriberCount = subscriberCount;
|
||||
}
|
||||
//
|
||||
|
||||
public String getSubscriptionStatus() {
|
||||
return subscriptionStatus;
|
||||
}
|
||||
|
||||
public void setSubscriptionStatus(String subscriptionStatus) {
|
||||
this.subscriptionStatus = subscriptionStatus;
|
||||
}
|
||||
//
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Date createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
//
|
||||
|
||||
public int getCommentCount() {
|
||||
return commentCount;
|
||||
}
|
||||
|
||||
public void setCommentCount(int commentCount) {
|
||||
this.commentCount = commentCount;
|
||||
}
|
||||
//
|
||||
|
||||
public int getVoteCount() {
|
||||
return voteCount;
|
||||
}
|
||||
|
||||
public void setVoteCount(int voteCount) {
|
||||
this.voteCount = voteCount;
|
||||
}
|
||||
//
|
||||
|
||||
public float getVoteAverage() {
|
||||
return voteAverage;
|
||||
}
|
||||
|
||||
public void setVoteAverage(float voteAverage) {
|
||||
this.voteAverage = voteAverage;
|
||||
}
|
||||
//
|
||||
|
||||
public float getVoteWeightedAverage() {
|
||||
return voteWeightedAverage;
|
||||
}
|
||||
|
||||
public void setVoteWeightedAverage(float voteWeightedAverage) {
|
||||
this.voteWeightedAverage = voteWeightedAverage;
|
||||
}
|
||||
//
|
||||
|
||||
public int getItemCount() {
|
||||
return itemCount;
|
||||
}
|
||||
|
||||
public void setItemCount(int itemCount) {
|
||||
this.itemCount = itemCount;
|
||||
}
|
||||
//
|
||||
|
||||
public Date getFirstItemDate() {
|
||||
return firstItemDate;
|
||||
}
|
||||
|
||||
public void setFirstItemDate(Date firstItemDate) {
|
||||
this.firstItemDate = firstItemDate;
|
||||
}
|
||||
//
|
||||
|
||||
public Date getLastItemDate() {
|
||||
return lastItemDate;
|
||||
}
|
||||
|
||||
public void setLastItemDate(Date lastItemDate) {
|
||||
this.lastItemDate = lastItemDate;
|
||||
}
|
||||
//
|
||||
|
||||
public String getSubscriptionSchedule() {
|
||||
return subscriptionSchedule;
|
||||
}
|
||||
|
||||
public void setSubscriptionSchedule(String subscriptionSchedule) {
|
||||
this.subscriptionSchedule = subscriptionSchedule;
|
||||
}
|
||||
//
|
||||
|
||||
public String getSubscriptionNamespace() {
|
||||
return subscriptionNamespace;
|
||||
}
|
||||
|
||||
public void setSubscriptionNamespace(String subscriptionNamespace) {
|
||||
this.subscriptionNamespace = subscriptionNamespace;
|
||||
}
|
||||
//
|
||||
|
||||
public String getSubscriptionIdentifier() {
|
||||
return subscriptionIdentifier;
|
||||
}
|
||||
|
||||
public void setSubscriptionIdentifier(String subscriptionIdentifier) {
|
||||
this.subscriptionIdentifier = subscriptionIdentifier;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordPronunciationsInput extends WordnikObject {
|
||||
|
||||
//Word to get pronunciations for
|
||||
private String word ;
|
||||
//If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
||||
private String useCanonical ;
|
||||
//Get from a single dictionary.
|
||||
private String sourceDictionary ;
|
||||
//Text pronunciation type
|
||||
private String typeFormat ;
|
||||
//Maximum number of results to return
|
||||
private String limit ;
|
||||
|
||||
|
||||
//Word to get pronunciations for
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
//If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
||||
|
||||
public String getUseCanonical() {
|
||||
return useCanonical;
|
||||
}
|
||||
|
||||
public void setUseCanonical(String useCanonical) {
|
||||
this.useCanonical = useCanonical;
|
||||
}
|
||||
//Get from a single dictionary.
|
||||
@AllowableValues(value="ahd,century,cmu,macmillan,wiktionary,webster,wordnet")
|
||||
public String getSourceDictionary() {
|
||||
return sourceDictionary;
|
||||
}
|
||||
|
||||
public void setSourceDictionary(String sourceDictionary) {
|
||||
this.sourceDictionary = sourceDictionary;
|
||||
}
|
||||
//Text pronunciation type
|
||||
@AllowableValues(value="ahd,arpabet,gcide-diacritical,IPA")
|
||||
public String getTypeFormat() {
|
||||
return typeFormat;
|
||||
}
|
||||
|
||||
public void setTypeFormat(String typeFormat) {
|
||||
this.typeFormat = typeFormat;
|
||||
}
|
||||
//Maximum number of results to return
|
||||
|
||||
public String getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(String limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordRelatedInput extends WordnikObject {
|
||||
|
||||
//Word for which to return related words
|
||||
private String word ;
|
||||
//CSV list of part-of-speech types
|
||||
private String partOfSpeech ;
|
||||
//Get data from a single dictionary. Valid options are ahd, century, wiktionary, webster, and wordnet.
|
||||
private String sourceDictionary ;
|
||||
//Maximum number of results to return
|
||||
private String limit ;
|
||||
//If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
||||
private String useCanonical ;
|
||||
//Relationship type
|
||||
private String type ;
|
||||
|
||||
|
||||
//Word for which to return related words
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
//CSV list of part-of-speech types
|
||||
@AllowableValues(value="noun,adjective,verb,adverb,interjection,pronoun,preposition,abbreviation,affix,article,auxiliary-verb,conjunction,definite-article,family-name,given-name,idiom,imperative,noun-plural,noun-posessive,past-participle,phrasal-prefix,proper-noun,proper-noun-plural,proper-noun-posessive,suffix,verb-intransitive,verb-transitive")
|
||||
public String getPartOfSpeech() {
|
||||
return partOfSpeech;
|
||||
}
|
||||
|
||||
public void setPartOfSpeech(String partOfSpeech) {
|
||||
this.partOfSpeech = partOfSpeech;
|
||||
}
|
||||
//Get data from a single dictionary. Valid options are ahd, century, wiktionary, webster, and wordnet.
|
||||
|
||||
public String getSourceDictionary() {
|
||||
return sourceDictionary;
|
||||
}
|
||||
|
||||
public void setSourceDictionary(String sourceDictionary) {
|
||||
this.sourceDictionary = sourceDictionary;
|
||||
}
|
||||
//Maximum number of results to return
|
||||
|
||||
public String getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(String limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
//If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
||||
@AllowableValues(value="false,true")
|
||||
public String getUseCanonical() {
|
||||
return useCanonical;
|
||||
}
|
||||
|
||||
public void setUseCanonical(String useCanonical) {
|
||||
this.useCanonical = useCanonical;
|
||||
}
|
||||
//Relationship type
|
||||
@AllowableValues(value="synonym,antonym,variant,equivalent,cross-reference,related-word,rhyme,form,etymologically-related-term,hypernym,hyponym,inflected-form,primary,same-context,verb-form,verb-stem,unknown")
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordsRandomWordInput extends WordnikObject {
|
||||
|
||||
//Only return words with dictionary definitions
|
||||
private String hasDictionaryDef ;
|
||||
//CSV part-of-speech values to include
|
||||
private String includePartOfSpeech ;
|
||||
//CSV part-of-speech values to exclude
|
||||
private String excludePartOfSpeech ;
|
||||
//Minimum corpus frequency for terms
|
||||
private String minCorpusCount ;
|
||||
//Maximum corpus frequency for terms
|
||||
private String maxCorpusCount ;
|
||||
//Minimum dictionary count
|
||||
private String minDictionaryCount ;
|
||||
//Maximum dictionary count
|
||||
private String maxDictionaryCount ;
|
||||
//Minimum word length
|
||||
private String minLength ;
|
||||
//Maximum word length
|
||||
private String maxLength ;
|
||||
|
||||
|
||||
//Only return words with dictionary definitions
|
||||
|
||||
public String getHasDictionaryDef() {
|
||||
return hasDictionaryDef;
|
||||
}
|
||||
|
||||
public void setHasDictionaryDef(String hasDictionaryDef) {
|
||||
this.hasDictionaryDef = hasDictionaryDef;
|
||||
}
|
||||
//CSV part-of-speech values to include
|
||||
|
||||
public String getIncludePartOfSpeech() {
|
||||
return includePartOfSpeech;
|
||||
}
|
||||
|
||||
public void setIncludePartOfSpeech(String includePartOfSpeech) {
|
||||
this.includePartOfSpeech = includePartOfSpeech;
|
||||
}
|
||||
//CSV part-of-speech values to exclude
|
||||
|
||||
public String getExcludePartOfSpeech() {
|
||||
return excludePartOfSpeech;
|
||||
}
|
||||
|
||||
public void setExcludePartOfSpeech(String excludePartOfSpeech) {
|
||||
this.excludePartOfSpeech = excludePartOfSpeech;
|
||||
}
|
||||
//Minimum corpus frequency for terms
|
||||
|
||||
public String getMinCorpusCount() {
|
||||
return minCorpusCount;
|
||||
}
|
||||
|
||||
public void setMinCorpusCount(String minCorpusCount) {
|
||||
this.minCorpusCount = minCorpusCount;
|
||||
}
|
||||
//Maximum corpus frequency for terms
|
||||
|
||||
public String getMaxCorpusCount() {
|
||||
return maxCorpusCount;
|
||||
}
|
||||
|
||||
public void setMaxCorpusCount(String maxCorpusCount) {
|
||||
this.maxCorpusCount = maxCorpusCount;
|
||||
}
|
||||
//Minimum dictionary count
|
||||
|
||||
public String getMinDictionaryCount() {
|
||||
return minDictionaryCount;
|
||||
}
|
||||
|
||||
public void setMinDictionaryCount(String minDictionaryCount) {
|
||||
this.minDictionaryCount = minDictionaryCount;
|
||||
}
|
||||
//Maximum dictionary count
|
||||
|
||||
public String getMaxDictionaryCount() {
|
||||
return maxDictionaryCount;
|
||||
}
|
||||
|
||||
public void setMaxDictionaryCount(String maxDictionaryCount) {
|
||||
this.maxDictionaryCount = maxDictionaryCount;
|
||||
}
|
||||
//Minimum word length
|
||||
|
||||
public String getMinLength() {
|
||||
return minLength;
|
||||
}
|
||||
|
||||
public void setMinLength(String minLength) {
|
||||
this.minLength = minLength;
|
||||
}
|
||||
//Maximum word length
|
||||
|
||||
public String getMaxLength() {
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
public void setMaxLength(String maxLength) {
|
||||
this.maxLength = maxLength;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordsRandomWordsInput extends WordnikObject {
|
||||
|
||||
//Only return words with dictionary definitions
|
||||
private String hasDictionaryDef ;
|
||||
//CSV part-of-speech values to include
|
||||
private String includePartOfSpeech ;
|
||||
//CSV part-of-speech values to exclude
|
||||
private String excludePartOfSpeech ;
|
||||
//Minimum corpus frequency for terms (integer)
|
||||
private String minCorpusCount ;
|
||||
//Maximum corpus frequency for terms (integer)
|
||||
private String maxCorpusCount ;
|
||||
//Minimum dictionary count (integer)
|
||||
private String minDictionaryCount ;
|
||||
//Maximum dictionary count (integer)
|
||||
private String maxDictionaryCount ;
|
||||
//Minimum word length (characters)
|
||||
private String minLength ;
|
||||
//Maximum word length (characters)
|
||||
private String maxLength ;
|
||||
//Attribute to sort by
|
||||
private String sortBy ;
|
||||
//Sort direction
|
||||
private String sortOrder ;
|
||||
//Maximum number of results to return (integer)
|
||||
private String limit ;
|
||||
|
||||
|
||||
//Only return words with dictionary definitions
|
||||
|
||||
public String getHasDictionaryDef() {
|
||||
return hasDictionaryDef;
|
||||
}
|
||||
|
||||
public void setHasDictionaryDef(String hasDictionaryDef) {
|
||||
this.hasDictionaryDef = hasDictionaryDef;
|
||||
}
|
||||
//CSV part-of-speech values to include
|
||||
|
||||
public String getIncludePartOfSpeech() {
|
||||
return includePartOfSpeech;
|
||||
}
|
||||
|
||||
public void setIncludePartOfSpeech(String includePartOfSpeech) {
|
||||
this.includePartOfSpeech = includePartOfSpeech;
|
||||
}
|
||||
//CSV part-of-speech values to exclude
|
||||
|
||||
public String getExcludePartOfSpeech() {
|
||||
return excludePartOfSpeech;
|
||||
}
|
||||
|
||||
public void setExcludePartOfSpeech(String excludePartOfSpeech) {
|
||||
this.excludePartOfSpeech = excludePartOfSpeech;
|
||||
}
|
||||
//Minimum corpus frequency for terms (integer)
|
||||
|
||||
public String getMinCorpusCount() {
|
||||
return minCorpusCount;
|
||||
}
|
||||
|
||||
public void setMinCorpusCount(String minCorpusCount) {
|
||||
this.minCorpusCount = minCorpusCount;
|
||||
}
|
||||
//Maximum corpus frequency for terms (integer)
|
||||
|
||||
public String getMaxCorpusCount() {
|
||||
return maxCorpusCount;
|
||||
}
|
||||
|
||||
public void setMaxCorpusCount(String maxCorpusCount) {
|
||||
this.maxCorpusCount = maxCorpusCount;
|
||||
}
|
||||
//Minimum dictionary count (integer)
|
||||
|
||||
public String getMinDictionaryCount() {
|
||||
return minDictionaryCount;
|
||||
}
|
||||
|
||||
public void setMinDictionaryCount(String minDictionaryCount) {
|
||||
this.minDictionaryCount = minDictionaryCount;
|
||||
}
|
||||
//Maximum dictionary count (integer)
|
||||
|
||||
public String getMaxDictionaryCount() {
|
||||
return maxDictionaryCount;
|
||||
}
|
||||
|
||||
public void setMaxDictionaryCount(String maxDictionaryCount) {
|
||||
this.maxDictionaryCount = maxDictionaryCount;
|
||||
}
|
||||
//Minimum word length (characters)
|
||||
|
||||
public String getMinLength() {
|
||||
return minLength;
|
||||
}
|
||||
|
||||
public void setMinLength(String minLength) {
|
||||
this.minLength = minLength;
|
||||
}
|
||||
//Maximum word length (characters)
|
||||
|
||||
public String getMaxLength() {
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
public void setMaxLength(String maxLength) {
|
||||
this.maxLength = maxLength;
|
||||
}
|
||||
//Attribute to sort by
|
||||
@AllowableValues(value="alpha,count")
|
||||
public String getSortBy() {
|
||||
return sortBy;
|
||||
}
|
||||
|
||||
public void setSortBy(String sortBy) {
|
||||
this.sortBy = sortBy;
|
||||
}
|
||||
//Sort direction
|
||||
@AllowableValues(value="asc,desc")
|
||||
public String getSortOrder() {
|
||||
return sortOrder;
|
||||
}
|
||||
|
||||
public void setSortOrder(String sortOrder) {
|
||||
this.sortOrder = sortOrder;
|
||||
}
|
||||
//Maximum number of results to return (integer)
|
||||
|
||||
public String getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(String limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,208 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordsSearchDefinitionsInput extends WordnikObject {
|
||||
|
||||
//Search term
|
||||
private String query ;
|
||||
//Defined word search term
|
||||
private String definedWordSearchTerm ;
|
||||
//Only include these comma-delimited source dictionaries
|
||||
private String includeSourceDictionaries ;
|
||||
//Exclude these comma-delimited source dictionaries
|
||||
private String excludeSourceDictionaries ;
|
||||
//Only include these comma-delimited parts of speech
|
||||
private String includePartOfSpeech ;
|
||||
//Exclude these comma-delimited parts of speech
|
||||
private String excludePartOfSpeech ;
|
||||
//Minimum corpus frequency for terms
|
||||
private String minCorpusCount ;
|
||||
//Maximum corpus frequency for terms
|
||||
private String maxCorpusCount ;
|
||||
//Minimum word length
|
||||
private String minLength ;
|
||||
//Maximum word length
|
||||
private String maxLength ;
|
||||
//Expand terms
|
||||
private String expandTerms ;
|
||||
//Word types
|
||||
private String wordTypes ;
|
||||
//Return a closed set of XML tags in response
|
||||
private String includeTags ;
|
||||
//Attribute to sort by
|
||||
private String sortBy ;
|
||||
//Sort direction
|
||||
private String sortOrder ;
|
||||
//Results to skip
|
||||
private String skip ;
|
||||
//Maximum number of results to return
|
||||
private String limit ;
|
||||
|
||||
|
||||
//Search term
|
||||
|
||||
public String getQuery() {
|
||||
return query;
|
||||
}
|
||||
|
||||
public void setQuery(String query) {
|
||||
this.query = query;
|
||||
}
|
||||
//Defined word search term
|
||||
|
||||
public String getDefinedWordSearchTerm() {
|
||||
return definedWordSearchTerm;
|
||||
}
|
||||
|
||||
public void setDefinedWordSearchTerm(String definedWordSearchTerm) {
|
||||
this.definedWordSearchTerm = definedWordSearchTerm;
|
||||
}
|
||||
//Only include these comma-delimited source dictionaries
|
||||
@AllowableValues(value="ahd, century, wiktionary, webster, wordnet")
|
||||
public String getIncludeSourceDictionaries() {
|
||||
return includeSourceDictionaries;
|
||||
}
|
||||
|
||||
public void setIncludeSourceDictionaries(String includeSourceDictionaries) {
|
||||
this.includeSourceDictionaries = includeSourceDictionaries;
|
||||
}
|
||||
//Exclude these comma-delimited source dictionaries
|
||||
@AllowableValues(value="ahd, century, wiktionary, webster, wordnet")
|
||||
public String getExcludeSourceDictionaries() {
|
||||
return excludeSourceDictionaries;
|
||||
}
|
||||
|
||||
public void setExcludeSourceDictionaries(String excludeSourceDictionaries) {
|
||||
this.excludeSourceDictionaries = excludeSourceDictionaries;
|
||||
}
|
||||
//Only include these comma-delimited parts of speech
|
||||
|
||||
public String getIncludePartOfSpeech() {
|
||||
return includePartOfSpeech;
|
||||
}
|
||||
|
||||
public void setIncludePartOfSpeech(String includePartOfSpeech) {
|
||||
this.includePartOfSpeech = includePartOfSpeech;
|
||||
}
|
||||
//Exclude these comma-delimited parts of speech
|
||||
|
||||
public String getExcludePartOfSpeech() {
|
||||
return excludePartOfSpeech;
|
||||
}
|
||||
|
||||
public void setExcludePartOfSpeech(String excludePartOfSpeech) {
|
||||
this.excludePartOfSpeech = excludePartOfSpeech;
|
||||
}
|
||||
//Minimum corpus frequency for terms
|
||||
@AllowableValues(value="non-negative integer")
|
||||
public String getMinCorpusCount() {
|
||||
return minCorpusCount;
|
||||
}
|
||||
|
||||
public void setMinCorpusCount(String minCorpusCount) {
|
||||
this.minCorpusCount = minCorpusCount;
|
||||
}
|
||||
//Maximum corpus frequency for terms
|
||||
@AllowableValues(value="non-negative integer")
|
||||
public String getMaxCorpusCount() {
|
||||
return maxCorpusCount;
|
||||
}
|
||||
|
||||
public void setMaxCorpusCount(String maxCorpusCount) {
|
||||
this.maxCorpusCount = maxCorpusCount;
|
||||
}
|
||||
//Minimum word length
|
||||
@AllowableValues(value="0 to 1024")
|
||||
public String getMinLength() {
|
||||
return minLength;
|
||||
}
|
||||
|
||||
public void setMinLength(String minLength) {
|
||||
this.minLength = minLength;
|
||||
}
|
||||
//Maximum word length
|
||||
@AllowableValues(value="0 to 1024")
|
||||
public String getMaxLength() {
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
public void setMaxLength(String maxLength) {
|
||||
this.maxLength = maxLength;
|
||||
}
|
||||
//Expand terms
|
||||
@AllowableValues(value="synonym,hypernym")
|
||||
public String getExpandTerms() {
|
||||
return expandTerms;
|
||||
}
|
||||
|
||||
public void setExpandTerms(String expandTerms) {
|
||||
this.expandTerms = expandTerms;
|
||||
}
|
||||
//Word types
|
||||
@AllowableValues(value="word,multi-word-unit")
|
||||
public String getWordTypes() {
|
||||
return wordTypes;
|
||||
}
|
||||
|
||||
public void setWordTypes(String wordTypes) {
|
||||
this.wordTypes = wordTypes;
|
||||
}
|
||||
//Return a closed set of XML tags in response
|
||||
@AllowableValues(value="false,true")
|
||||
public String getIncludeTags() {
|
||||
return includeTags;
|
||||
}
|
||||
|
||||
public void setIncludeTags(String includeTags) {
|
||||
this.includeTags = includeTags;
|
||||
}
|
||||
//Attribute to sort by
|
||||
@AllowableValues(value="alpha,count,length")
|
||||
public String getSortBy() {
|
||||
return sortBy;
|
||||
}
|
||||
|
||||
public void setSortBy(String sortBy) {
|
||||
this.sortBy = sortBy;
|
||||
}
|
||||
//Sort direction
|
||||
@AllowableValues(value="asc,desc")
|
||||
public String getSortOrder() {
|
||||
return sortOrder;
|
||||
}
|
||||
|
||||
public void setSortOrder(String sortOrder) {
|
||||
this.sortOrder = sortOrder;
|
||||
}
|
||||
//Results to skip
|
||||
@AllowableValues(value="0 to 1000")
|
||||
public String getSkip() {
|
||||
return skip;
|
||||
}
|
||||
|
||||
public void setSkip(String skip) {
|
||||
this.skip = skip;
|
||||
}
|
||||
//Maximum number of results to return
|
||||
@AllowableValues(value="1 to 1000")
|
||||
public String getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(String limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordsSearchInput extends WordnikObject {
|
||||
|
||||
//Search term
|
||||
private String query ;
|
||||
//Search case sensitive
|
||||
private String caseSensitive ;
|
||||
//Only include these comma-delimited parts of speech
|
||||
private String includePartOfSpeech ;
|
||||
//Exclude these comma-delimited parts of speech
|
||||
private String excludePartOfSpeech ;
|
||||
//Minimum corpus frequency for terms
|
||||
private String minCorpusCount ;
|
||||
//Maximum corpus frequency for terms
|
||||
private String maxCorpusCount ;
|
||||
//Minimum number of dictionary entries
|
||||
private String minDictionaryCount ;
|
||||
//Maximum dictionary count
|
||||
private String maxDictionaryCount ;
|
||||
//Minimum word length
|
||||
private String minLength ;
|
||||
//Maximum word length
|
||||
private String maxLength ;
|
||||
//Results to skip
|
||||
private String skip ;
|
||||
//Maximum number of results to return
|
||||
private String limit ;
|
||||
|
||||
|
||||
//Search term
|
||||
|
||||
public String getQuery() {
|
||||
return query;
|
||||
}
|
||||
|
||||
public void setQuery(String query) {
|
||||
this.query = query;
|
||||
}
|
||||
//Search case sensitive
|
||||
@AllowableValues(value="true | false")
|
||||
public String getCaseSensitive() {
|
||||
return caseSensitive;
|
||||
}
|
||||
|
||||
public void setCaseSensitive(String caseSensitive) {
|
||||
this.caseSensitive = caseSensitive;
|
||||
}
|
||||
//Only include these comma-delimited parts of speech
|
||||
|
||||
public String getIncludePartOfSpeech() {
|
||||
return includePartOfSpeech;
|
||||
}
|
||||
|
||||
public void setIncludePartOfSpeech(String includePartOfSpeech) {
|
||||
this.includePartOfSpeech = includePartOfSpeech;
|
||||
}
|
||||
//Exclude these comma-delimited parts of speech
|
||||
|
||||
public String getExcludePartOfSpeech() {
|
||||
return excludePartOfSpeech;
|
||||
}
|
||||
|
||||
public void setExcludePartOfSpeech(String excludePartOfSpeech) {
|
||||
this.excludePartOfSpeech = excludePartOfSpeech;
|
||||
}
|
||||
//Minimum corpus frequency for terms
|
||||
@AllowableValues(value="non-negative integer")
|
||||
public String getMinCorpusCount() {
|
||||
return minCorpusCount;
|
||||
}
|
||||
|
||||
public void setMinCorpusCount(String minCorpusCount) {
|
||||
this.minCorpusCount = minCorpusCount;
|
||||
}
|
||||
//Maximum corpus frequency for terms
|
||||
@AllowableValues(value="non-negative integer")
|
||||
public String getMaxCorpusCount() {
|
||||
return maxCorpusCount;
|
||||
}
|
||||
|
||||
public void setMaxCorpusCount(String maxCorpusCount) {
|
||||
this.maxCorpusCount = maxCorpusCount;
|
||||
}
|
||||
//Minimum number of dictionary entries
|
||||
@AllowableValues(value="non-negative integer")
|
||||
public String getMinDictionaryCount() {
|
||||
return minDictionaryCount;
|
||||
}
|
||||
|
||||
public void setMinDictionaryCount(String minDictionaryCount) {
|
||||
this.minDictionaryCount = minDictionaryCount;
|
||||
}
|
||||
//Maximum dictionary count
|
||||
@AllowableValues(value="non-negative integer")
|
||||
public String getMaxDictionaryCount() {
|
||||
return maxDictionaryCount;
|
||||
}
|
||||
|
||||
public void setMaxDictionaryCount(String maxDictionaryCount) {
|
||||
this.maxDictionaryCount = maxDictionaryCount;
|
||||
}
|
||||
//Minimum word length
|
||||
@AllowableValues(value="0 to 1024")
|
||||
public String getMinLength() {
|
||||
return minLength;
|
||||
}
|
||||
|
||||
public void setMinLength(String minLength) {
|
||||
this.minLength = minLength;
|
||||
}
|
||||
//Maximum word length
|
||||
@AllowableValues(value="0 to 1024")
|
||||
public String getMaxLength() {
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
public void setMaxLength(String maxLength) {
|
||||
this.maxLength = maxLength;
|
||||
}
|
||||
//Results to skip
|
||||
@AllowableValues(value="0 to 1000")
|
||||
public String getSkip() {
|
||||
return skip;
|
||||
}
|
||||
|
||||
public void setSkip(String skip) {
|
||||
this.skip = skip;
|
||||
}
|
||||
//Maximum number of results to return
|
||||
@AllowableValues(value="1 to 1000")
|
||||
public String getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(String limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
import com.wordnik.common.WordListType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class WordsWordOfTheDayInputRangeInput extends WordnikObject {
|
||||
|
||||
//Filters response by category
|
||||
private String category ;
|
||||
//Filters response by username
|
||||
private String creator ;
|
||||
//Filters response by ContentProvider
|
||||
private String provider ;
|
||||
//Results to skip
|
||||
private String skip ;
|
||||
//Maximum number of results to return
|
||||
private String limit ;
|
||||
|
||||
|
||||
//Filters response by category
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
//Filters response by username
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
//Filters response by ContentProvider
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProvider(String provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
//Results to skip
|
||||
|
||||
public String getSkip() {
|
||||
return skip;
|
||||
}
|
||||
|
||||
public void setSkip(String skip) {
|
||||
this.skip = skip;
|
||||
}
|
||||
//Maximum number of results to return
|
||||
|
||||
public String getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(String limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
}
|
21
code-gen/.gitignore
vendored
Normal file
21
code-gen/.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
*.txt
|
||||
*.ser
|
||||
*.idx
|
||||
*.zip
|
||||
*.tmp.gz
|
||||
build/
|
||||
reports/
|
||||
lib/*.jar
|
||||
lib/*.pom
|
||||
|
||||
version.properties
|
||||
|
||||
ivy-report.css
|
||||
build-eclipse/
|
||||
|
||||
.classpath
|
||||
.project
|
||||
.scala_dependencies
|
17
code-gen/bin/runjava.sh
Executable file
17
code-gen/bin/runjava.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
echo "" > classpath.txt
|
||||
for file in `ls lib`;
|
||||
do echo -n 'lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls build`;
|
||||
do echo -n 'build/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
|
||||
export CLASSPATH=$(cat classpath.txt)
|
||||
export JAVA_OPTS="${JAVA_OPTS} -DrulePath=data -Dproperty=Xmx2g -DloggerPath=$BUILD_COMMON/test-config/log4j.properties"
|
||||
java $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH "$@"
|
||||
|
17
code-gen/bin/runscala.sh
Executable file
17
code-gen/bin/runscala.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
echo "" > classpath.txt
|
||||
for file in `ls lib`;
|
||||
do echo -n 'lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls build`;
|
||||
do echo -n 'build/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
|
||||
export CLASSPATH=$(cat classpath.txt)
|
||||
export JAVA_OPTS="${JAVA_OPTS} -DrulePath=data -Dproperty=Xmx2g -DloggerPath=$BUILD_COMMON/test-config/log4j.properties"
|
||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH "$@"
|
||||
|
30
code-gen/build.xml
Normal file
30
code-gen/build.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<project name="wordnik-libs-gen" default="compile" basedir=".">
|
||||
<property environment="env" />
|
||||
<property name="version.identifier" value="1.0" />
|
||||
<condition property="build.common.dir" value="${env.BUILD_COMMON}">
|
||||
<isset property="env.BUILD_COMMON" />
|
||||
</condition>
|
||||
|
||||
<echo message="using build common dir: ${build.common.dir}"/>
|
||||
<import file="${build.common.dir}/ant/ant-common.xml" />
|
||||
<import file="${build.common.dir}/ant/ant-server.xml" />
|
||||
<import file="${build.common.dir}/ant/ant-test.xml" />
|
||||
|
||||
<!-- generates the classes -->
|
||||
<target name="generate-java" depends="compile" description="generates API and model classes for java language">
|
||||
<delete>
|
||||
<fileset dir="../java/src/main/java/com/wordnik/api" includes="*.java"/>
|
||||
<fileset dir="../java/src/main/java/com/wordnik/model" includes="*.java"/>
|
||||
</delete>
|
||||
<java classname="com.wordnik.codegen.java.JavaLibCodeGen">
|
||||
<classpath>
|
||||
<pathelement location="build/main/java" />
|
||||
<fileset dir="lib">
|
||||
<include name="**/*.jar"/>
|
||||
</fileset>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
38
code-gen/conf/templates/java/ModelObject.st
Normal file
38
code-gen/conf/templates/java/ModelObject.st
Normal file
@ -0,0 +1,38 @@
|
||||
package com.wordnik.model;
|
||||
|
||||
import com.wordnik.common.WordnikObject;
|
||||
import com.wordnik.annotations.AllowableValues;
|
||||
import com.wordnik.annotations.Required;
|
||||
|
||||
$imports:{ import |
|
||||
import $import$;
|
||||
}$
|
||||
|
||||
/**
|
||||
* $model.description$
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class $className$ extends WordnikObject {
|
||||
|
||||
$fields:{ field |
|
||||
//$field.description$
|
||||
private $field.attributeDefinition.returnType$ $field.attributeDefinition.name$ $field.attributeDefinition.initialization$;
|
||||
}$
|
||||
|
||||
$fields:{ field |
|
||||
//$field.description$
|
||||
$if(field.required)$
|
||||
@Required $endif$
|
||||
$if(field.allowableValues)$
|
||||
@AllowableValues(value="$field.allowableValues$")$endif$
|
||||
public $field.attributeDefinition.returnType$ get$field.attributeDefinition.NameForMethod$() {
|
||||
return $field.attributeDefinition.name$;
|
||||
}
|
||||
|
||||
public void set$field.attributeDefinition.NameForMethod$($field.attributeDefinition.returnType$ $field.attributeDefinition.name$) {
|
||||
this.$field.attributeDefinition.name$ = $field.attributeDefinition.name$;
|
||||
}
|
||||
}$
|
||||
}
|
121
code-gen/conf/templates/java/ResourceObject.st
Normal file
121
code-gen/conf/templates/java/ResourceObject.st
Normal file
@ -0,0 +1,121 @@
|
||||
package com.wordnik.api;
|
||||
|
||||
|
||||
import com.wordnik.common.*;
|
||||
import com.wordnik.common.ext.*;
|
||||
import com.wordnik.exception.WordnikExceptionCodes;
|
||||
import com.wordnik.exception.WordnikAPIException;
|
||||
import com.wordnik.model.*;
|
||||
import java.util.*;
|
||||
import com.wordnik.annotations.MethodArgumentNames;
|
||||
import org.codehaus.jackson.map.DeserializationConfig.Feature;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the program manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class $resource$ extends $extends$ {
|
||||
|
||||
$methods:{ method |
|
||||
/**
|
||||
* $method.description$
|
||||
$method.arguments:{ argument |
|
||||
* @param $argument.name$ $argument.description$
|
||||
$if(argument.allowedValues)$
|
||||
* Allowed values are - $argument.allowedValues$
|
||||
$endif$
|
||||
}$
|
||||
*
|
||||
* @return $method.returnValue$ {@link $method.returnClassName$}
|
||||
* @throws WordnikAPIException $method.exceptionDescription$
|
||||
*/
|
||||
$if(method.hasArguments)$
|
||||
@MethodArgumentNames(value="$method.argumentNames; separator=", "$")
|
||||
$endif$
|
||||
|
||||
public static $method.returnValue$ $method.name$($method.argumentDefinitions; separator=", "$) throws WordnikAPIException {
|
||||
|
||||
$if(method.authToken)$
|
||||
if(authToken == null || authToken.length() == 0) {
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.AUTH_TOKEN_NOT_VALID);
|
||||
}
|
||||
$endif$
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "$method.resourcePath$";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "$method.methodType$";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
$if(!method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if( $argument.name$ != null) {
|
||||
queryParams.put("$argument.name$", $argument.name$);
|
||||
}
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if( $argument.name$ != null) {
|
||||
resourcePath = resourcePath.replace("{$argument.name$}", $argument.name$);
|
||||
}
|
||||
}$
|
||||
$endif$
|
||||
$if(method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if( $argument.inputModelClassArgument$ != null && $argument.methodNameFromModelClass$ != null) {
|
||||
queryParams.put("$argument.name$", $argument.methodNameFromModelClass$);
|
||||
}
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if( $argument.inputModelClassArgument$ != null && $argument.methodNameFromModelClass$ != null) {
|
||||
resourcePath = resourcePath.replace("{$argument.name$}", $argument.methodNameFromModelClass$);
|
||||
}
|
||||
}$
|
||||
$endif$
|
||||
//make the API Call
|
||||
$if(method.postObject)$
|
||||
$if(method.authToken)$
|
||||
String response = invokeAPI(authToken, resourcePath, method, queryParams, postObject);
|
||||
$endif$
|
||||
$if(!method.authToken)$
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, postObject);
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
$if(!method.postObject)$
|
||||
$if(method.authToken)$
|
||||
String response = invokeAPI(authToken, resourcePath, method, queryParams, null);
|
||||
$endif$
|
||||
$if(!method.authToken)$
|
||||
String response = invokeAPI(null, resourcePath, method, queryParams, null);
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
//create output objects if the response has more than one object
|
||||
$if(!method.responseVoid)$
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
$if(!method.returnValueList)$
|
||||
$method.returnValue$ responseObject = ($method.returnValue$)deserialize(response, $method.returnClassName$.class);
|
||||
return responseObject;
|
||||
$endif$
|
||||
$if(method.returnValueList)$
|
||||
TypeReference<ArrayList<$method.returnClassName$>> typeRef = new TypeReference<ArrayList<$method.returnClassName$>>() {
|
||||
};
|
||||
try {
|
||||
List<$method.returnClassName$> responseObject = (List<$method.returnClassName$>) mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new WordnikAPIException(WordnikExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
$endif$
|
||||
$endif$
|
||||
}
|
||||
|
||||
|
||||
}$
|
||||
}
|
18
code-gen/conf/templates/java/VersionChecker.st
Normal file
18
code-gen/conf/templates/java/VersionChecker.st
Normal file
@ -0,0 +1,18 @@
|
||||
package com.wordnik.api;
|
||||
|
||||
/**
|
||||
* Maintains the compatible server version against which the drive is written
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class VersionChecker {
|
||||
|
||||
private String compatibleVersion = "$apiVersion$";
|
||||
|
||||
/**
|
||||
* Gets the version against which the driver code was written
|
||||
*/
|
||||
public String getCompatibleVersion() {
|
||||
return compatibleVersion;
|
||||
}
|
||||
}
|
37
code-gen/ivy.xml
Normal file
37
code-gen/ivy.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<ivy-module version="2.0">
|
||||
<info organisation="wordnik" module="wordnik-libs-gen"/>
|
||||
<configurations>
|
||||
<conf name="build" visibility="public"/>
|
||||
<conf name="test" visibility="public"/>
|
||||
<conf name="source" visibility="public"/>
|
||||
<conf name="pom" visibility="public"/>
|
||||
<conf name="tools" visibility="public" extends="build"/>
|
||||
</configurations>
|
||||
|
||||
<publications>
|
||||
<artifact name="wordnik-libs-gen" type="jar" conf="build" ext="jar"/>
|
||||
<artifact name="wordnik-libs-gen-test" type="jar" conf="test" ext="jar"/>
|
||||
<artifact name="wordnik-libs-gen-tools" type="jar" conf="tools" ext="jar"/>
|
||||
<artifact name="wordnik-libs-gen-source" type="zip" conf="source" ext="zip"/>
|
||||
<artifact name="wordnik-libs-gen" type="pom" conf="pom" ext="pom"/>
|
||||
</publications>
|
||||
<dependencies>
|
||||
<!-- jersey dependencies -->
|
||||
<dependency org="junit" name="junit" rev="4.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-json" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-client" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-server" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-core" rev="1.4" conf="build->default"/>
|
||||
<dependency org="asm" name="asm-parent" rev="3.1" conf="build->default"/>
|
||||
<dependency org="commons-beanutils" name="commons-beanutils" rev="1.8.0" conf="build->default"/>
|
||||
<dependency org="org.antlr" name="stringtemplate" rev="3.2" conf="build->default"/>
|
||||
<!-- jackson jars -->
|
||||
<dependency org="org.codehaus.jackson" name="jackson-jaxrs" rev="1.7.1" conf="build->default"/>
|
||||
<dependency org="org.codehaus.jackson" name="jackson-xc" rev="1.7.1" conf="build->default"/>
|
||||
<dependency org="org.codehaus.jackson" name="jackson-mapper-asl" rev="1.7.1" conf="build->default"/>
|
||||
<dependency org="net.sourceforge.cobertura" name="cobertura" rev="1.9.2" conf="test->default">
|
||||
<exclude org="asm" name="asm-tree"/>
|
||||
<exclude org="asm" name="asm"/>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</ivy-module>
|
68
code-gen/src/main/java/com/wordnik/codegen/Argument.java
Normal file
68
code-gen/src/main/java/com/wordnik/codegen/Argument.java
Normal file
@ -0,0 +1,68 @@
|
||||
package com.wordnik.codegen;
|
||||
|
||||
import com.wordnik.codegen.config.CodeGenConfig;
|
||||
|
||||
public class Argument {
|
||||
|
||||
public static String ARGUMENT_STRING = "String";
|
||||
public static String ARGUMENT_INTEGER = "int";
|
||||
public static String ARGUMENT_OBJECT = "Object";
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
private String dataType;
|
||||
|
||||
private String allowedValues;
|
||||
|
||||
private String inputModelClassArgument;
|
||||
private String methodNameFromModelClass;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getAllowedValues() {
|
||||
return allowedValues;
|
||||
}
|
||||
|
||||
public void setAllowedValues(String allowedValues) {
|
||||
this.allowedValues = allowedValues;
|
||||
}
|
||||
|
||||
public String getInputModelClassArgument() {
|
||||
return inputModelClassArgument;
|
||||
}
|
||||
|
||||
public void setInputModelClassArgument(String inputModelClass, CodeGenConfig config) {
|
||||
this.inputModelClassArgument = config.getNameGenerator().convertToMethodNameFormat(inputModelClass);
|
||||
if(name != null) {
|
||||
methodNameFromModelClass = config.getNameGenerator().createGetterMethodName(inputModelClassArgument, name);
|
||||
}
|
||||
}
|
||||
|
||||
public String getMethodNameFromModelClass() {
|
||||
return methodNameFromModelClass;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.wordnik.codegen;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AttributeDefinition {
|
||||
|
||||
private String returnType;
|
||||
|
||||
private String name;
|
||||
|
||||
private String initialization;
|
||||
|
||||
private List<String> importDefinitions = new ArrayList<String>();
|
||||
|
||||
public String getReturnType() {
|
||||
return returnType;
|
||||
}
|
||||
|
||||
public void setReturnType(String returnType) {
|
||||
this.returnType = returnType;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getInitialization() {
|
||||
return initialization;
|
||||
}
|
||||
|
||||
public void setInitialization(String initialization) {
|
||||
this.initialization = initialization;
|
||||
}
|
||||
|
||||
public List<String> getImportDefinitions() {
|
||||
return importDefinitions;
|
||||
}
|
||||
|
||||
public String getNameForMethod() {
|
||||
return name.substring(0,1).toUpperCase() + name.substring(1);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,313 @@
|
||||
package com.wordnik.codegen;
|
||||
|
||||
import com.sun.jersey.api.client.Client;
|
||||
import com.sun.jersey.api.client.ClientResponse;
|
||||
import com.sun.jersey.api.client.WebResource;
|
||||
import com.wordnik.codegen.config.CodeGenConfig;
|
||||
import com.wordnik.codegen.resource.*;
|
||||
import com.wordnik.exception.CodeGenerationException;
|
||||
|
||||
import org.antlr.stringtemplate.StringTemplate;
|
||||
import org.antlr.stringtemplate.StringTemplateGroup;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.map.DeserializationConfig.Feature;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* User: ramesh
|
||||
* Date: 3/30/11
|
||||
* Time: 6:59 PM
|
||||
*/
|
||||
public class DriverCodeGenerator {
|
||||
|
||||
private static String HEADER_NAME_API_VERSION = "Wordnik-Api-Version";
|
||||
private static String VERSION_OBJECT_TEMPLATE = "VersionChecker";
|
||||
private static String MODEL_OBJECT_TEMPLATE = "ModelObject";
|
||||
private static String API_OBJECT_TEMPLATE = "ResourceObject";
|
||||
|
||||
private CodeGenConfig config = null;
|
||||
|
||||
public CodeGenConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public void setConfig(CodeGenConfig config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate classes needed for the model and API invocation
|
||||
*/
|
||||
public void generateCode() {
|
||||
//read resources and get their documentation
|
||||
List<Resource> resources = this.readResourceDocumentation(
|
||||
"http://beta.wordnik.com/v4/", "word.json,words.json,wordList.json,wordLists.json,account.json");
|
||||
StringTemplateGroup aTemplateGroup = new StringTemplateGroup("templates",config.getTemplateLocation());
|
||||
if(resources.size() > 0) {
|
||||
generateVersionHelper(resources.get(0).getVersion(), aTemplateGroup);
|
||||
}
|
||||
generateModelClasses(resources, aTemplateGroup);
|
||||
generateAssemblerClassesForOutput(resources, aTemplateGroup, config);
|
||||
generateModelClassesForInput(resources, aTemplateGroup);
|
||||
generateAPIClasses(resources, aTemplateGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the documentation of the resources and constructs the resource object that can be used
|
||||
* for generating the driver related classes. The resource list string should be "," separated
|
||||
*/
|
||||
private List<Resource> readResourceDocumentation(String baseUrl, String resourceList) {
|
||||
|
||||
List<Resource> resourceDocs = new ArrayList<Resource>();
|
||||
|
||||
//valid for input
|
||||
if (baseUrl == null || resourceList == null ||
|
||||
baseUrl.trim().length() == 0 ||
|
||||
resourceList.trim().length() == 0) {
|
||||
throw new CodeGenerationException("Base URL or Resource list input is null");
|
||||
}
|
||||
|
||||
|
||||
//create list of resource URL
|
||||
String[] resources = resourceList.split(",");
|
||||
List<String> resourceURLs = new ArrayList<String>();
|
||||
for (String resource : resources) {
|
||||
resourceURLs.add(baseUrl + resource);
|
||||
}
|
||||
|
||||
//make connection to resource and get the documentation
|
||||
for (String resourceURL : resourceURLs) {
|
||||
Client apiClient = Client.create();
|
||||
WebResource aResource = apiClient.resource(resourceURL);
|
||||
ClientResponse clientResponse = aResource.get(ClientResponse.class);
|
||||
String version = clientResponse.getHeaders().get(HEADER_NAME_API_VERSION).get(0);
|
||||
String response = clientResponse.getEntity(String.class);
|
||||
try {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.getDeserializationConfig().set(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
Resource aResourceDoc = (Resource) mapper.readValue(response, Resource.class);
|
||||
aResourceDoc.setVersion(version);
|
||||
resourceDocs.add(aResourceDoc);
|
||||
} catch (IOException ioe) {
|
||||
throw new CodeGenerationException("Error in coverting resource json documentation to java object");
|
||||
}
|
||||
}
|
||||
return resourceDocs;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates version file based on the version number received from the doc calls. This version file is used
|
||||
* while making the API calls to make sure Client and back end are compatible.
|
||||
* @param version
|
||||
*/
|
||||
private void generateVersionHelper(String version, StringTemplateGroup templateGroup) {
|
||||
StringTemplate template = templateGroup.getInstanceOf(VERSION_OBJECT_TEMPLATE);
|
||||
template.setAttribute("apiVersion", version);
|
||||
File aFile = new File(config.getResourceClassLocation() + config.getNameGenerator().getVersionCheckerClassName()
|
||||
+ config.getClassFileExtension());
|
||||
writeFile(aFile, template.toString(), "Version checker class");
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates model classes. If the class is already generated then ignores the same.
|
||||
*/
|
||||
private void generateModelClasses(List<Resource> resources, StringTemplateGroup templateGroup) {
|
||||
List<String> generatedClassNames = new ArrayList();
|
||||
|
||||
for(Resource resource: resources) {
|
||||
for(Model model : resource.getModels()){
|
||||
if(!generatedClassNames.contains(model.getName())){
|
||||
List<String> imports = new ArrayList<String>();
|
||||
imports.addAll(this.config.getDefaultModelImports());
|
||||
for(Parameter param : model.getFields()){
|
||||
for(String importDef : param.getAttributeDefinition(config.getDataTypeMapper()).getImportDefinitions()){
|
||||
if(!imports.contains(importDef)){
|
||||
imports.add(importDef);
|
||||
}
|
||||
}
|
||||
}
|
||||
StringTemplate template = templateGroup.getInstanceOf(MODEL_OBJECT_TEMPLATE);
|
||||
template.setAttribute("fields", model.getFields());
|
||||
template.setAttribute("imports", imports);
|
||||
template.setAttribute("className", model.getGenratedClassName());
|
||||
File aFile = new File(config.getModelClassLocation()+model.getGenratedClassName()+config.getClassFileExtension());
|
||||
writeFile(aFile, template.toString(), "Model class");
|
||||
generatedClassNames.add(model.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
generateWrapperClassForTestData(generatedClassNames, templateGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates assembler classes if the API returns more than one objects.
|
||||
* @param resources
|
||||
* @param templateGroup
|
||||
*/
|
||||
private void generateAssemblerClassesForOutput(List<Resource> resources, StringTemplateGroup templateGroup,
|
||||
CodeGenConfig config) {
|
||||
List<String> generatedClasses = new ArrayList<String>();
|
||||
for(Resource resource : resources) {
|
||||
if(resource.getEndPoints() != null) {
|
||||
for(Endpoint endpoint : resource.getEndPoints()){
|
||||
if(endpoint.getOperations() != null) {
|
||||
for(EndpointOperation operation : endpoint.getOperations()){
|
||||
Model model = operation.getModelObjectForAggregateObject(endpoint, config);
|
||||
if(model != null){
|
||||
if(!generatedClasses.contains(model.getName())) {
|
||||
List<String> imports = new ArrayList<String>();
|
||||
imports.addAll(this.config.getDefaultModelImports());
|
||||
for(Parameter param : model.getFields()){
|
||||
for(String importDef : param.getAttributeDefinition(config.getDataTypeMapper()).getImportDefinitions()){
|
||||
if(!imports.contains(importDef)){
|
||||
imports.add(importDef);
|
||||
}
|
||||
}
|
||||
}
|
||||
StringTemplate template = templateGroup.getInstanceOf(MODEL_OBJECT_TEMPLATE);
|
||||
template.setAttribute("fields", model.getFields());
|
||||
template.setAttribute("imports", imports);
|
||||
template.setAttribute("className", model.getGenratedClassName());
|
||||
File aFile = new File(config.getModelClassLocation()+model.getGenratedClassName()+config.getClassFileExtension());
|
||||
writeFile(aFile, template.toString(), "Assemble class");
|
||||
generatedClasses.add(model.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates assembler classes if the API returns more than one objects.
|
||||
* @param resources
|
||||
* @param templateGroup
|
||||
*/
|
||||
private void generateModelClassesForInput(List<Resource> resources, StringTemplateGroup templateGroup) {
|
||||
List<String> generatedClasses = new ArrayList<String>();
|
||||
for(Resource resource : resources) {
|
||||
if(resource.getEndPoints() != null) {
|
||||
for(Endpoint endpoint : resource.getEndPoints()){
|
||||
if(endpoint.getOperations() != null) {
|
||||
for(EndpointOperation operation : endpoint.getOperations()){
|
||||
Method method = operation.generateMethod(endpoint, resource, config);
|
||||
if(method.getInputModel() != null) {
|
||||
Model model = method.getInputModel();
|
||||
if(model != null){
|
||||
if(!generatedClasses.contains(model.getName())) {
|
||||
List<String> imports = new ArrayList<String>();
|
||||
imports.addAll(this.config.getDefaultModelImports());
|
||||
for(Parameter param : model.getFields()){
|
||||
for(String importDef : param.getAttributeDefinition(config.getDataTypeMapper()).getImportDefinitions()){
|
||||
if(!imports.contains(importDef)){
|
||||
imports.add(importDef);
|
||||
}
|
||||
}
|
||||
}
|
||||
StringTemplate template = templateGroup.getInstanceOf(MODEL_OBJECT_TEMPLATE);
|
||||
|
||||
template.setAttribute("fields", model.getFields());
|
||||
template.setAttribute("imports", imports);
|
||||
template.setAttribute("className", model.getGenratedClassName());
|
||||
File aFile = new File(config.getModelClassLocation()+model.getGenratedClassName()+config.getClassFileExtension());
|
||||
writeFile(aFile, template.toString(), "Input model class");
|
||||
generatedClasses.add(model.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates one API class for each resource and each end point in the resource is translated as method.
|
||||
* @param resources
|
||||
* @param templateGroup
|
||||
*/
|
||||
private void generateAPIClasses(List<Resource> resources, StringTemplateGroup templateGroup) {
|
||||
|
||||
for(Resource resource : resources) {
|
||||
List<Method> methods = new ArrayList<Method>();
|
||||
methods = resource.generateMethods(resource, config);
|
||||
StringTemplate template = templateGroup.getInstanceOf(API_OBJECT_TEMPLATE);
|
||||
String className = resource.generateClassName(config);
|
||||
List<Method> filteredMethods = new ArrayList<Method>();
|
||||
for(Method method:methods){
|
||||
if(!config.getCodeGenOverridingRules().isMethodIgnored(className, method.getName())){
|
||||
filteredMethods.add(method);
|
||||
}
|
||||
}
|
||||
template.setAttribute("resource", className);
|
||||
template.setAttribute("methods", filteredMethods);
|
||||
template.setAttribute("extends", config.getCodeGenOverridingRules().getServiceExtendingClass(className));
|
||||
|
||||
File aFile = new File(config.getResourceClassLocation()+ resource.generateClassName(config) +config.getClassFileExtension());
|
||||
writeFile(aFile, template.toString(), "API CLasses");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a wrapper model class that contains all model classes as list of objects.
|
||||
* This class is used for storing test data
|
||||
*/
|
||||
private void generateWrapperClassForTestData(List<String> generatedClassNames, StringTemplateGroup templateGroup) {
|
||||
Model model = new Model();
|
||||
model.setName("TestData");
|
||||
model.setDescription("Class used to store all the test data. This should not be used for any development");
|
||||
List<Parameter> parameters = new ArrayList<Parameter>();
|
||||
model.setFields(parameters);
|
||||
for(String className : generatedClassNames){
|
||||
Parameter aParam = new Parameter();
|
||||
aParam.setName(config.getNameGenerator().convertToMethodNameFormat(className)+"List");
|
||||
aParam.setParamType(config.getDataTypeMapper().getListReturnType(className));
|
||||
parameters.add(aParam);
|
||||
}
|
||||
|
||||
//add missing class from models
|
||||
Parameter aParam = new Parameter();
|
||||
aParam.setName("StringValueList");
|
||||
aParam.setParamType(config.getDataTypeMapper().getListReturnType("StringValue"));
|
||||
parameters.add(aParam);
|
||||
|
||||
List<String> imports = new ArrayList<String>();
|
||||
imports.addAll(this.config.getDefaultModelImports());
|
||||
imports.addAll(this.config.getDataTypeMapper().getListImports());
|
||||
for(Parameter param : model.getFields()){
|
||||
for(String importDef : param.getAttributeDefinition(config.getDataTypeMapper()).getImportDefinitions()){
|
||||
if(!imports.contains(importDef)){
|
||||
imports.add(importDef);
|
||||
}
|
||||
}
|
||||
}
|
||||
StringTemplate template = templateGroup.getInstanceOf(MODEL_OBJECT_TEMPLATE);
|
||||
template.setAttribute("fields", model.getFields());
|
||||
template.setAttribute("imports", imports);
|
||||
template.setAttribute("className", model.getGenratedClassName());
|
||||
File aFile = new File(config.getModelClassLocation()+model.getGenratedClassName()+config.getClassFileExtension());
|
||||
writeFile(aFile, template.toString(), "Wrapper class for test data file");
|
||||
}
|
||||
|
||||
private void writeFile(File aFile, String content, String classType){
|
||||
try{
|
||||
FileWriter aWriter = new FileWriter(aFile);
|
||||
BufferedWriter bufWriter = new BufferedWriter(aWriter);
|
||||
bufWriter.write(content);
|
||||
bufWriter.close();
|
||||
}catch(IOException ioe){
|
||||
throw new CodeGenerationException("Error generating " + classType + " : " + ioe.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user