forked from loafle/openapi-generator-original
Merge branch 'master' of github.com:wordnik/swagger-codegen
This commit is contained in:
commit
2ea6c2a3a7
3
.travis.yml
Normal file
3
.travis.yml
Normal file
@ -0,0 +1,3 @@
|
||||
language: scala
|
||||
scala:
|
||||
- 2.10.2
|
11
LICENSE
Normal file
11
LICENSE
Normal file
@ -0,0 +1,11 @@
|
||||
Copyright 2014 Reverb Technologies, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
17
README.md
17
README.md
@ -1,9 +1,18 @@
|
||||
# Swagger Code Generator
|
||||
|
||||
[](https://travis-ci.org/wordnik/swagger-codegen)
|
||||
|
||||
## Overview
|
||||
This is the swagger codegen project, which allows generation of client libraries automatically from a
|
||||
Swagger-compliant server. You can find out more about both the spec and the framework at
|
||||
http://swagger.wordnik.com. For more information about Wordnik's APIs, please visit http://developer.wordnik.com.
|
||||
Swagger-compliant server.
|
||||
|
||||
## What's Swagger?
|
||||
|
||||
The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swager removes the guesswork in calling the service.
|
||||
|
||||
|
||||
Check out [Swagger-Spec](https://github.com/wordnik/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more.
|
||||
|
||||
|
||||
### Prerequisites
|
||||
You need the following installed and available in your $PATH:
|
||||
@ -63,7 +72,7 @@ Other languages have petstore samples, too:
|
||||
It's just as easy--you can either run the default generators:
|
||||
|
||||
```
|
||||
./bin/runscala.sh com.wordnik.swagger.codegen.BasicScalaGenerator http://petstore.swagger.wordnik.com/api/resources.json special-key
|
||||
./bin/runscala.sh com.wordnik.swagger.codegen.BasicScalaGenerator http://petstore.swagger.wordnik.com/api/api-docs special-key
|
||||
```
|
||||
|
||||
Replace `Scala` with `Flash`, `Java`, `Objc`, `PHP`, `Python`, `Python3`, `Ruby`.
|
||||
@ -222,7 +231,7 @@ either repackage the library OR modify your codegen script to use a file path!
|
||||
License
|
||||
-------
|
||||
|
||||
Copyright 2013 Wordnik, Inc.
|
||||
Copyright 2014 Wordnik, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,7 @@
|
||||
val version = scala.util.Properties.scalaPropOrElse("version.number", "unknown").toString match {
|
||||
case "2.10.0" => "2.10"
|
||||
case "2.10.2" => "2.10"
|
||||
case "2.10.3" => "2.10"
|
||||
case e: String => e
|
||||
}
|
||||
println(version)
|
||||
println(version)
|
||||
|
37
bin/all-petstore.sh
Executable file
37
bin/all-petstore.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
cd $APP_DIR
|
||||
./bin/java-wordnik-api.sh
|
||||
./bin/php-wordnik-api.sh
|
||||
./bin/python3-wordnik-api.sh
|
||||
./bin/objc-wordnik-api.sh
|
||||
./bin/python-wordnik-api.sh
|
||||
./bin/scala-wordnik-api.sh
|
||||
|
||||
./bin/android-java-petstore.sh
|
||||
./bin/csharp-petstore.sh
|
||||
./bin/flash-petstore.sh
|
||||
./bin/java-petstore.sh
|
||||
./bin/objc-petstore.sh
|
||||
./bin/php-petstore.sh
|
||||
./bin/python-petstore.sh
|
||||
./bin/python3-petstore.sh
|
||||
./bin/ruby-petstore.sh
|
||||
./bin/scala-petstore.sh
|
32
bin/android-java-wordnik-api.sh
Executable file
32
bin/android-java-wordnik-api.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
cd $APP_DIR
|
||||
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ samples/client/petstore/android-java/AndroidJavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
@ -19,6 +18,7 @@ if [ ! -d "${APP_DIR}" ]; then
|
||||
fi
|
||||
|
||||
cd $APP_DIR
|
||||
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
|
||||
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
@ -26,7 +26,7 @@ export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/
|
||||
ags="$@"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
scala -cp $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
else
|
||||
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
|
||||
fi
|
||||
|
@ -22,8 +22,8 @@ cd $APP_DIR
|
||||
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files"
|
||||
ags="$@ SwaggerDocGenerator http://developer.wordnik.com/v4/resources.json"
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
|
||||
ags="$@ SwaggerDocGenerator https://api.wordnik.com/v4/resources.json"
|
||||
|
||||
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
|
||||
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
|
||||
|
56
bin/yml2swagger.js
Normal file
56
bin/yml2swagger.js
Normal file
@ -0,0 +1,56 @@
|
||||
fs = require('fs')
|
||||
yaml = require('js-yaml')
|
||||
|
||||
var args = process.argv.splice(2);
|
||||
|
||||
if(args.length == 0) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
var arg0 = args[0];
|
||||
var outputdir = ".";
|
||||
|
||||
if(args.length > 1) {
|
||||
outputdir = args[1];
|
||||
}
|
||||
|
||||
var file = fs.lstatSync(arg0);
|
||||
|
||||
if(file.isFile()) {
|
||||
convert(arg0, outputdir);
|
||||
}
|
||||
else if (file.isDirectory()) {
|
||||
var files = fs.readdirSync(arg0);
|
||||
files.map(function(item) {
|
||||
var filename = arg0 + "/" + item;
|
||||
var file = fs.lstatSync(filename);
|
||||
if(file.isFile()) {
|
||||
convert(filename, outputdir);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function convert(filename, outputdir) {
|
||||
console.log("converting " + filename);
|
||||
fs.readFile(filename, "utf8", function (err, data) {
|
||||
if(err) {
|
||||
console.log(err);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
var js = yaml.load(data);
|
||||
var prettyJs = JSON.stringify(js, undefined, 2);
|
||||
var outputFilename = outputdir + "/" + filename.split("/").pop().replace(".yml", "") + ".json";
|
||||
console.log("writing to " + outputFilename);
|
||||
fs.writeFile(outputFilename, prettyJs, function(err) {
|
||||
if(err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
26
build.sbt
26
build.sbt
@ -5,22 +5,24 @@ organization := "com.wordnik"
|
||||
|
||||
name := "swagger-codegen"
|
||||
|
||||
version := "2.0.11"
|
||||
version := "2.0.14"
|
||||
|
||||
scalaVersion := "2.9.1"
|
||||
scalaVersion := "2.10.0"
|
||||
|
||||
crossVersion := CrossVersion.full
|
||||
|
||||
javacOptions ++= Seq("-target", "1.6", "-source", "1.6", "-Xlint:unchecked", "-Xlint:deprecation")
|
||||
|
||||
scalacOptions ++= Seq("-optimize", "-unchecked", "-deprecation", "-Xcheckinit", "-encoding", "utf8")
|
||||
|
||||
crossScalaVersions := Seq("2.9.0", "2.9.0-1", "2.9.1", "2.9.1-1", "2.9.2", "2.9.3", "2.10.0")
|
||||
crossScalaVersions := Seq("2.9.0", "2.9.0-1", "2.9.1", "2.9.1-1", "2.9.2", "2.9.3", "2.10.0", "2.10.1", "2.10.2")
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"org.json4s" %% "json4s-jackson" % "3.2.5",
|
||||
"io.backchat.inflector" %% "scala-inflector" % "1.3.5",
|
||||
"commons-io" % "commons-io" % "2.3",
|
||||
"ch.qos.logback" % "logback-classic" % "1.0.13" % "provided",
|
||||
"org.rogach" %% "scallop" % "0.9.4",
|
||||
"org.rogach" %% "scallop" % "0.8.1",
|
||||
"junit" % "junit" % "4.11" % "test",
|
||||
"org.scalatest" %% "scalatest" % "1.9.1" % "test"
|
||||
)
|
||||
@ -28,8 +30,16 @@ libraryDependencies ++= Seq(
|
||||
libraryDependencies <+= scalaVersion {
|
||||
case v if v.startsWith("2.9") =>
|
||||
"org.fusesource.scalate" % "scalate-core_2.9" % "1.6.1"
|
||||
case v if v.startsWith("2.10") =>
|
||||
case v if v.startsWith("2.10") => {
|
||||
"org.fusesource.scalate" %% "scalate-core" % "1.6.1"
|
||||
}
|
||||
}
|
||||
|
||||
libraryDependencies ++= {
|
||||
scalaVersion.toString match {
|
||||
case v if v.startsWith("2.10") => Seq("org.scala-lang" % "scala-reflect" % v)
|
||||
case _ => Seq()
|
||||
}
|
||||
}
|
||||
|
||||
packageOptions <+= (name, version, organization) map {
|
||||
@ -55,9 +65,13 @@ publishTo <<= (version) { version: String =>
|
||||
Some("Sonatype Nexus Releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
|
||||
}
|
||||
|
||||
publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/.m2/repository")))
|
||||
|
||||
//publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/.m2/repository")))
|
||||
artifact in (Compile, assembly) ~= { art =>
|
||||
art.copy(`classifier` = Some("assembly"))
|
||||
}
|
||||
|
||||
addArtifact(artifact in (Compile, assembly), assembly)
|
||||
|
||||
publishMavenStyle := true
|
||||
|
||||
|
16
package.json
Normal file
16
package.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "swagger-yaml",
|
||||
"version": "2.0.1",
|
||||
"description": "Converts yaml to swagger json",
|
||||
"author": {
|
||||
"name": "Tony Tam",
|
||||
"email": "fehguy@gmail.com",
|
||||
"url": "http://developer.wordnik.com"
|
||||
},
|
||||
"license": "Apache",
|
||||
"readmeFilename": "README.md",
|
||||
"dependencies": {
|
||||
"json2yaml": "~1.0",
|
||||
"js-yaml": "~3.0"
|
||||
}
|
||||
}
|
@ -1,2 +1,3 @@
|
||||
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8")
|
||||
|
||||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.9.1")
|
||||
|
@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import com.wordnik.swagger.codegen.BasicJavaGenerator
|
||||
import com.wordnik.swagger.codegen.BasicAndroidJavaGenerator
|
||||
|
||||
object AndroidJavaPetstoreCodegen extends BasicJavaGenerator {
|
||||
object AndroidJavaPetstoreCodegen extends BasicAndroidJavaGenerator {
|
||||
def main(args: Array[String]) = generateClient(args)
|
||||
|
||||
// location of templates
|
||||
override def templateDir = "android-java"
|
||||
override def templateDir = "src/main/resources/android-java"
|
||||
|
||||
// where to write generated code
|
||||
override def destinationDir = "samples/client/petstore/android-java/src/main/java"
|
||||
|
@ -27,6 +27,10 @@ public class PetApi {
|
||||
}
|
||||
|
||||
public Pet getPetById (Long petId) throws ApiException {
|
||||
// verify required params are set
|
||||
if(petId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||
|
||||
@ -34,10 +38,6 @@ public class PetApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(petId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -58,6 +58,10 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
public void deletePet (String petId) throws ApiException {
|
||||
// verify required params are set
|
||||
if(petId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||
|
||||
@ -65,10 +69,6 @@ public class PetApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(petId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -89,6 +89,10 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
public List<Pet> partialUpdate (String petId, Pet body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(petId == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||
|
||||
@ -96,10 +100,6 @@ public class PetApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(petId == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -120,6 +120,10 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
public void updatePetWithForm (String petId, String name, String status) throws ApiException {
|
||||
// verify required params are set
|
||||
if(petId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||
|
||||
@ -127,10 +131,6 @@ public class PetApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(petId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -178,6 +178,10 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
public void addPet (Pet body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet".replaceAll("\\{format\\}","json");
|
||||
|
||||
@ -185,10 +189,6 @@ public class PetApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -209,6 +209,10 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
public void updatePet (Pet body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet".replaceAll("\\{format\\}","json");
|
||||
|
||||
@ -216,10 +220,6 @@ public class PetApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -240,6 +240,10 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
public List<Pet> findPetsByStatus (String status) throws ApiException {
|
||||
// verify required params are set
|
||||
if(status == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet/findByStatus".replaceAll("\\{format\\}","json");
|
||||
|
||||
@ -247,10 +251,6 @@ public class PetApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(status == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(status)))
|
||||
queryParams.put("status", String.valueOf(status));
|
||||
String contentType = "application/json";
|
||||
@ -273,6 +273,10 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
public List<Pet> findPetsByTags (String tags) throws ApiException {
|
||||
// verify required params are set
|
||||
if(tags == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet/findByTags".replaceAll("\\{format\\}","json");
|
||||
|
||||
@ -280,10 +284,6 @@ public class PetApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(tags == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(tags)))
|
||||
queryParams.put("tags", String.valueOf(tags));
|
||||
String contentType = "application/json";
|
||||
|
@ -26,6 +26,10 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
public Order getOrderById (String orderId) throws ApiException {
|
||||
// verify required params are set
|
||||
if(orderId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString()));
|
||||
|
||||
@ -33,10 +37,6 @@ public class StoreApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(orderId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -57,6 +57,10 @@ public class StoreApi {
|
||||
}
|
||||
}
|
||||
public void deleteOrder (String orderId) throws ApiException {
|
||||
// verify required params are set
|
||||
if(orderId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString()));
|
||||
|
||||
@ -64,10 +68,6 @@ public class StoreApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(orderId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -88,6 +88,10 @@ public class StoreApi {
|
||||
}
|
||||
}
|
||||
public void placeOrder (Order body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/store/order".replaceAll("\\{format\\}","json");
|
||||
|
||||
@ -95,10 +99,6 @@ public class StoreApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
|
@ -26,6 +26,10 @@ public class UserApi {
|
||||
}
|
||||
|
||||
public void createUser (User body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/user".replaceAll("\\{format\\}","json");
|
||||
|
||||
@ -33,10 +37,6 @@ public class UserApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -57,6 +57,10 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public void createUsersWithArrayInput (List<User> body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/user/createWithArray".replaceAll("\\{format\\}","json");
|
||||
|
||||
@ -64,10 +68,6 @@ public class UserApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -88,6 +88,10 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public void createUsersWithListInput (List<User> body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/user/createWithList".replaceAll("\\{format\\}","json");
|
||||
|
||||
@ -95,10 +99,6 @@ public class UserApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -119,6 +119,10 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public void updateUser (String username, User body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(username == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
|
||||
|
||||
@ -126,10 +130,6 @@ public class UserApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(username == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -150,6 +150,10 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public void deleteUser (String username) throws ApiException {
|
||||
// verify required params are set
|
||||
if(username == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
|
||||
|
||||
@ -157,10 +161,6 @@ public class UserApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(username == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -181,6 +181,10 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public User getUserByName (String username) throws ApiException {
|
||||
// verify required params are set
|
||||
if(username == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
|
||||
|
||||
@ -188,10 +192,6 @@ public class UserApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(username == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -212,6 +212,10 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public String loginUser (String username, String password) throws ApiException {
|
||||
// verify required params are set
|
||||
if(username == null || password == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/user/login".replaceAll("\\{format\\}","json");
|
||||
|
||||
@ -219,10 +223,6 @@ public class UserApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(username == null || password == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(username)))
|
||||
queryParams.put("username", String.valueOf(username));
|
||||
if(!"null".equals(String.valueOf(password)))
|
||||
|
@ -21,6 +21,38 @@
|
||||
return basePath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// uploads an image
|
||||
/// </summary>
|
||||
/// <param name="additionalMetadata">Additional data to pass to server</param>
|
||||
/// <param name="body">file to upload</param>
|
||||
/// <returns></returns>
|
||||
public void uploadFile (string additionalMetadata, File body) {
|
||||
// create path and map variables
|
||||
var path = "/pet/uploadImage".Replace("{format}","json");
|
||||
|
||||
// query params
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
|
||||
string paramStr = null;
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.ErrorCode == 404) {
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Find pet by ID Returns a pet based on ID
|
||||
/// </summary>
|
||||
@ -97,7 +129,7 @@
|
||||
/// <param name="petId">ID of pet that needs to be fetched</param>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
/// <returns></returns>
|
||||
public Array<Pet> partialUpdate (string petId, Pet body) {
|
||||
public List<Pet> partialUpdate (string petId, Pet body) {
|
||||
// create path and map variables
|
||||
var path = "/pet/{petId}".Replace("{format}","json").Replace("{" + "petId" + "}", apiInvoker.escapeString(petId.ToString()));
|
||||
|
||||
@ -113,7 +145,7 @@
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, body, headerParams);
|
||||
if(response != null){
|
||||
return (Array<Pet>) ApiInvoker.deserialize(response, typeof(Array<Pet>));
|
||||
return (List<Pet>) ApiInvoker.deserialize(response, typeof(List<Pet>));
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
@ -165,38 +197,6 @@
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// uploads an image
|
||||
/// </summary>
|
||||
/// <param name="additionalMetadata">Additional data to pass to server</param>
|
||||
/// <param name="body">file to upload</param>
|
||||
/// <returns></returns>
|
||||
public void uploadFile (string additionalMetadata, File body) {
|
||||
// create path and map variables
|
||||
var path = "/pet/uploadImage".Replace("{format}","json");
|
||||
|
||||
// query params
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
|
||||
string paramStr = null;
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.ErrorCode == 404) {
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Add a new pet to the store
|
||||
/// </summary>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
@ -271,7 +271,7 @@
|
||||
/// </summary>
|
||||
/// <param name="status">Status values that need to be considered for filter</param>
|
||||
/// <returns></returns>
|
||||
public Array<Pet> findPetsByStatus (string status) {
|
||||
public List<Pet> findPetsByStatus (string status) {
|
||||
// create path and map variables
|
||||
var path = "/pet/findByStatus".Replace("{format}","json");
|
||||
|
||||
@ -291,7 +291,7 @@
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
|
||||
if(response != null){
|
||||
return (Array<Pet>) ApiInvoker.deserialize(response, typeof(Array<Pet>));
|
||||
return (List<Pet>) ApiInvoker.deserialize(response, typeof(List<Pet>));
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
@ -310,7 +310,7 @@
|
||||
/// </summary>
|
||||
/// <param name="tags">Tags to filter by</param>
|
||||
/// <returns></returns>
|
||||
public Array<Pet> findPetsByTags (string tags) {
|
||||
public List<Pet> findPetsByTags (string tags) {
|
||||
// create path and map variables
|
||||
var path = "/pet/findByTags".Replace("{format}","json");
|
||||
|
||||
@ -330,7 +330,7 @@
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
|
||||
if(response != null){
|
||||
return (Array<Pet>) ApiInvoker.deserialize(response, typeof(Array<Pet>));
|
||||
return (List<Pet>) ApiInvoker.deserialize(response, typeof(List<Pet>));
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
|
@ -21,41 +21,6 @@
|
||||
return basePath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find purchase order by ID For valid response try integer IDs with value <= 5. Anything above 5 or nonintegers will generate API errors
|
||||
/// </summary>
|
||||
/// <param name="orderId">ID of pet that needs to be fetched</param>
|
||||
/// <returns></returns>
|
||||
public Order getOrderById (string orderId) {
|
||||
// create path and map variables
|
||||
var path = "/store/order/{orderId}".Replace("{format}","json").Replace("{" + "orderId" + "}", apiInvoker.escapeString(orderId.ToString()));
|
||||
|
||||
// query params
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if (orderId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
string paramStr = null;
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
|
||||
if(response != null){
|
||||
return (Order) ApiInvoker.deserialize(response, typeof(Order));
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.ErrorCode == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
/// </summary>
|
||||
@ -92,6 +57,41 @@
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Find purchase order by ID For valid response try integer IDs with value <= 5. Anything above 5 or nonintegers will generate API errors
|
||||
/// </summary>
|
||||
/// <param name="orderId">ID of pet that needs to be fetched</param>
|
||||
/// <returns></returns>
|
||||
public Order getOrderById (string orderId) {
|
||||
// create path and map variables
|
||||
var path = "/store/order/{orderId}".Replace("{format}","json").Replace("{" + "orderId" + "}", apiInvoker.escapeString(orderId.ToString()));
|
||||
|
||||
// query params
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if (orderId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
string paramStr = null;
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
|
||||
if(response != null){
|
||||
return (Order) ApiInvoker.deserialize(response, typeof(Order));
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.ErrorCode == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Place an order for a pet
|
||||
/// </summary>
|
||||
/// <param name="body">order placed for purchasing the pet</param>
|
||||
|
@ -21,6 +21,186 @@
|
||||
return basePath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete user This can only be done by the logged in user.
|
||||
/// </summary>
|
||||
/// <param name="username">The name that needs to be deleted</param>
|
||||
/// <returns></returns>
|
||||
public void deleteUser (string username) {
|
||||
// create path and map variables
|
||||
var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.escapeString(username.ToString()));
|
||||
|
||||
// query params
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if (username == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
string paramStr = null;
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.ErrorCode == 404) {
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Get user by user name
|
||||
/// </summary>
|
||||
/// <param name="username">The name that needs to be fetched. Use user1 for testing.</param>
|
||||
/// <returns></returns>
|
||||
public User getUserByName (string username) {
|
||||
// create path and map variables
|
||||
var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.escapeString(username.ToString()));
|
||||
|
||||
// query params
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if (username == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
string paramStr = null;
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
|
||||
if(response != null){
|
||||
return (User) ApiInvoker.deserialize(response, typeof(User));
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.ErrorCode == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Updated user This can only be done by the logged in user.
|
||||
/// </summary>
|
||||
/// <param name="username">name that need to be deleted</param>
|
||||
/// <param name="body">Updated user object</param>
|
||||
/// <returns></returns>
|
||||
public void updateUser (string username, User body) {
|
||||
// create path and map variables
|
||||
var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.escapeString(username.ToString()));
|
||||
|
||||
// query params
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if (username == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
string paramStr = null;
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.ErrorCode == 404) {
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Logs user into the system
|
||||
/// </summary>
|
||||
/// <param name="username">The user name for login</param>
|
||||
/// <param name="password">The password for login in clear text</param>
|
||||
/// <returns></returns>
|
||||
public string loginUser (string username, string password) {
|
||||
// create path and map variables
|
||||
var path = "/user/login".Replace("{format}","json");
|
||||
|
||||
// query params
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if (username == null || password == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
string paramStr = null;
|
||||
if (username != null){
|
||||
paramStr = (username != null && username is DateTime) ? ((DateTime)(object)username).ToString("u") : Convert.ToString(username);
|
||||
queryParams.Add("username", paramStr);
|
||||
}
|
||||
if (password != null){
|
||||
paramStr = (password != null && password is DateTime) ? ((DateTime)(object)password).ToString("u") : Convert.ToString(password);
|
||||
queryParams.Add("password", paramStr);
|
||||
}
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
|
||||
if(response != null){
|
||||
return (string) ApiInvoker.deserialize(response, typeof(string));
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.ErrorCode == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Logs out current logged in user session
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void logoutUser () {
|
||||
// create path and map variables
|
||||
var path = "/user/logout".Replace("{format}","json");
|
||||
|
||||
// query params
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
|
||||
string paramStr = null;
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.ErrorCode == 404) {
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Create user This can only be done by the logged in user.
|
||||
/// </summary>
|
||||
@ -126,185 +306,5 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Updated user This can only be done by the logged in user.
|
||||
/// </summary>
|
||||
/// <param name="username">name that need to be deleted</param>
|
||||
/// <param name="body">Updated user object</param>
|
||||
/// <returns></returns>
|
||||
public void updateUser (string username, User body) {
|
||||
// create path and map variables
|
||||
var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.escapeString(username.ToString()));
|
||||
|
||||
// query params
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if (username == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
string paramStr = null;
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.ErrorCode == 404) {
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Delete user This can only be done by the logged in user.
|
||||
/// </summary>
|
||||
/// <param name="username">The name that needs to be deleted</param>
|
||||
/// <returns></returns>
|
||||
public void deleteUser (string username) {
|
||||
// create path and map variables
|
||||
var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.escapeString(username.ToString()));
|
||||
|
||||
// query params
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if (username == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
string paramStr = null;
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.ErrorCode == 404) {
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Get user by user name
|
||||
/// </summary>
|
||||
/// <param name="username">The name that needs to be fetched. Use user1 for testing.</param>
|
||||
/// <returns></returns>
|
||||
public User getUserByName (string username) {
|
||||
// create path and map variables
|
||||
var path = "/user/{username}".Replace("{format}","json").Replace("{" + "username" + "}", apiInvoker.escapeString(username.ToString()));
|
||||
|
||||
// query params
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if (username == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
string paramStr = null;
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
|
||||
if(response != null){
|
||||
return (User) ApiInvoker.deserialize(response, typeof(User));
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.ErrorCode == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Logs user into the system
|
||||
/// </summary>
|
||||
/// <param name="username">The user name for login</param>
|
||||
/// <param name="password">The password for login in clear text</param>
|
||||
/// <returns></returns>
|
||||
public string loginUser (string username, string password) {
|
||||
// create path and map variables
|
||||
var path = "/user/login".Replace("{format}","json");
|
||||
|
||||
// query params
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if (username == null || password == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
string paramStr = null;
|
||||
if (username != null){
|
||||
paramStr = (username != null && username is DateTime) ? ((DateTime)(object)username).ToString("u") : Convert.ToString(username);
|
||||
queryParams.Add("username", paramStr);
|
||||
}
|
||||
if (password != null){
|
||||
paramStr = (password != null && password is DateTime) ? ((DateTime)(object)password).ToString("u") : Convert.ToString(password);
|
||||
queryParams.Add("password", paramStr);
|
||||
}
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
|
||||
if(response != null){
|
||||
return (string) ApiInvoker.deserialize(response, typeof(string));
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.ErrorCode == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Logs out current logged in user session
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void logoutUser () {
|
||||
// create path and map variables
|
||||
var path = "/user/logout".Replace("{format}","json");
|
||||
|
||||
// query params
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
|
||||
string paramStr = null;
|
||||
try {
|
||||
var response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.ErrorCode == 404) {
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,8 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Com.Wordnik.Petstore.Model {
|
||||
public class Category {
|
||||
/* Category unique identifier */
|
||||
public long id { get; set; }
|
||||
|
||||
/* Name of the category */
|
||||
public string name { get; set; }
|
||||
|
||||
public override string ToString() {
|
||||
|
@ -5,19 +5,15 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Com.Wordnik.Petstore.Model {
|
||||
public class Order {
|
||||
/* Unique identifier for the order */
|
||||
public long id { get; set; }
|
||||
|
||||
/* ID of pet being ordered */
|
||||
public long petId { get; set; }
|
||||
|
||||
/* Number of pets ordered */
|
||||
public int quantity { get; set; }
|
||||
|
||||
/* Status of the order */
|
||||
/* Order Status */
|
||||
public string status { get; set; }
|
||||
|
||||
/* Date shipped, only if it has been */
|
||||
public DateTime shipDate { get; set; }
|
||||
|
||||
public override string ToString() {
|
||||
|
@ -5,19 +5,15 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Com.Wordnik.Petstore.Model {
|
||||
public class Pet {
|
||||
/* Unique identifier for the Pet */
|
||||
/* unique identifier for the pet */
|
||||
public long id { get; set; }
|
||||
|
||||
/* Category the pet is in */
|
||||
public Category category { get; set; }
|
||||
|
||||
/* Friendly name of the pet */
|
||||
public string name { get; set; }
|
||||
|
||||
/* Image URLs */
|
||||
public List<string> photoUrls { get; set; }
|
||||
|
||||
/* Tags assigned to this pet */
|
||||
public List<Tag> tags { get; set; }
|
||||
|
||||
/* pet status in the store */
|
||||
|
@ -5,10 +5,8 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Com.Wordnik.Petstore.Model {
|
||||
public class Tag {
|
||||
/* Unique identifier for the tag */
|
||||
public long id { get; set; }
|
||||
|
||||
/* Friendly name for the tag */
|
||||
public string name { get; set; }
|
||||
|
||||
public override string ToString() {
|
||||
|
@ -5,25 +5,18 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Com.Wordnik.Petstore.Model {
|
||||
public class User {
|
||||
/* Unique identifier for the user */
|
||||
public long id { get; set; }
|
||||
|
||||
/* Unique username */
|
||||
public string username { get; set; }
|
||||
|
||||
/* First name of the user */
|
||||
public string firstName { get; set; }
|
||||
|
||||
/* Last name of the user */
|
||||
public string username { get; set; }
|
||||
|
||||
public string lastName { get; set; }
|
||||
|
||||
/* Email address of the user */
|
||||
public string email { get; set; }
|
||||
|
||||
/* Password name of the user */
|
||||
public string password { get; set; }
|
||||
|
||||
/* Phone number of the user */
|
||||
public string phone { get; set; }
|
||||
|
||||
/* User Status */
|
||||
@ -33,8 +26,8 @@ namespace Com.Wordnik.Petstore.Model {
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class User {\n");
|
||||
sb.Append(" id: ").Append(id).Append("\n");
|
||||
sb.Append(" username: ").Append(username).Append("\n");
|
||||
sb.Append(" firstName: ").Append(firstName).Append("\n");
|
||||
sb.Append(" username: ").Append(username).Append("\n");
|
||||
sb.Append(" lastName: ").Append(lastName).Append("\n");
|
||||
sb.Append(" email: ").Append(email).Append("\n");
|
||||
sb.Append(" password: ").Append(password).Append("\n");
|
||||
|
@ -20,7 +20,7 @@ object JavaPetstoreCodegen extends BasicJavaGenerator {
|
||||
def main(args: Array[String]) = generateClient(args)
|
||||
|
||||
// location of templates
|
||||
override def templateDir = "Java"
|
||||
override def templateDir = "src/main/resources/Java"
|
||||
|
||||
// where to write generated code
|
||||
override def destinationDir = "samples/client/petstore/java/src/main/java"
|
||||
|
@ -178,6 +178,17 @@
|
||||
<version>${jackson-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>2.1.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>${jodatime-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
@ -203,6 +214,7 @@
|
||||
<properties>
|
||||
<jersey-version>1.7</jersey-version>
|
||||
<jackson-version>2.1.4</jackson-version>
|
||||
<jodatime-version>2.3</jodatime-version>
|
||||
<scala-version>2.9.1-1</scala-version>
|
||||
<junit-version>4.8.1</junit-version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
|
@ -12,12 +12,15 @@ import com.sun.jersey.api.client.config.DefaultClientConfig;
|
||||
import com.sun.jersey.api.client.filter.LoggingFilter;
|
||||
import com.sun.jersey.api.client.WebResource.Builder;
|
||||
|
||||
import javax.ws.rs.core.Response.Status.Family;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
public class ApiInvoker {
|
||||
private static ApiInvoker INSTANCE = new ApiInvoker();
|
||||
@ -27,13 +30,18 @@ public class ApiInvoker {
|
||||
public static ApiInvoker getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
public void addDefaultHeader(String key, String value) {
|
||||
defaultHeaderMap.put(key, value);
|
||||
}
|
||||
|
||||
public String escapeString(String str) {
|
||||
return str;
|
||||
try{
|
||||
return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20");
|
||||
}
|
||||
catch(UnsupportedEncodingException e) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {
|
||||
@ -46,7 +54,7 @@ public class ApiInvoker {
|
||||
else if(String.class.equals(cls)) {
|
||||
if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1)
|
||||
return json.substring(1, json.length() - 2);
|
||||
else
|
||||
else
|
||||
return json;
|
||||
}
|
||||
else {
|
||||
@ -60,9 +68,9 @@ public class ApiInvoker {
|
||||
|
||||
public static String serialize(Object obj) throws ApiException {
|
||||
try {
|
||||
if (obj != null)
|
||||
if (obj != null)
|
||||
return JsonUtil.getJsonMapper().writeValueAsString(obj);
|
||||
else
|
||||
else
|
||||
return null;
|
||||
}
|
||||
catch (Exception e) {
|
||||
@ -70,11 +78,11 @@ public class ApiInvoker {
|
||||
}
|
||||
}
|
||||
|
||||
public String invokeAPI(String host, String path, String method, Map<String, String> queryParams, Object body, Map<String, String> headerParams, String contentType) throws ApiException {
|
||||
public String invokeAPI(String host, String path, String method, Map<String, String> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String contentType) throws ApiException {
|
||||
Client client = getClient(host);
|
||||
|
||||
StringBuilder b = new StringBuilder();
|
||||
|
||||
|
||||
for(String key : queryParams.keySet()) {
|
||||
String value = queryParams.get(key);
|
||||
if (value != null){
|
||||
@ -91,7 +99,7 @@ public class ApiInvoker {
|
||||
for(String key : headerParams.keySet()) {
|
||||
builder.header(key, headerParams.get(key));
|
||||
}
|
||||
|
||||
|
||||
for(String key : defaultHeaderMap.keySet()) {
|
||||
if(!headerParams.containsKey(key)) {
|
||||
builder.header(key, defaultHeaderMap.get(key));
|
||||
@ -106,30 +114,55 @@ public class ApiInvoker {
|
||||
if(body == null)
|
||||
response = builder.post(ClientResponse.class, serialize(body));
|
||||
else
|
||||
response = builder.type("application/json").post(ClientResponse.class, serialize(body));
|
||||
response = builder.type(contentType).post(ClientResponse.class, serialize(body));
|
||||
}
|
||||
else if ("PUT".equals(method)) {
|
||||
if(body == null)
|
||||
response = builder.put(ClientResponse.class, serialize(body));
|
||||
else
|
||||
response = builder.type("application/json").put(ClientResponse.class, serialize(body));
|
||||
else {
|
||||
if("application/x-www-form-urlencoded".equals(contentType)) {
|
||||
StringBuilder formParamBuilder = new StringBuilder();
|
||||
|
||||
// encode the form params
|
||||
for(String key : headerParams.keySet()) {
|
||||
String value = headerParams.get(key);
|
||||
if(value != null && !"".equals(value.trim())) {
|
||||
if(formParamBuilder.length() > 0) {
|
||||
formParamBuilder.append("&");
|
||||
}
|
||||
try {
|
||||
formParamBuilder.append(URLEncoder.encode(key, "utf8")).append("=").append(URLEncoder.encode(value, "utf8"));
|
||||
}
|
||||
catch (Exception e) {
|
||||
// move on to next
|
||||
}
|
||||
}
|
||||
}
|
||||
response = builder.type(contentType).put(ClientResponse.class, formParamBuilder.toString());
|
||||
}
|
||||
else
|
||||
response = builder.type(contentType).put(ClientResponse.class, serialize(body));
|
||||
}
|
||||
}
|
||||
else if ("DELETE".equals(method)) {
|
||||
if(body == null)
|
||||
response = builder.delete(ClientResponse.class, serialize(body));
|
||||
else
|
||||
response = builder.type("application/json").delete(ClientResponse.class, serialize(body));
|
||||
response = builder.type(contentType).delete(ClientResponse.class, serialize(body));
|
||||
}
|
||||
else {
|
||||
throw new ApiException(500, "unknown method type " + method);
|
||||
}
|
||||
if(response.getClientResponseStatus() == ClientResponse.Status.OK) {
|
||||
if(response.getClientResponseStatus() == ClientResponse.Status.NO_CONTENT) {
|
||||
return null;
|
||||
}
|
||||
else if(response.getClientResponseStatus().getFamily() == Family.SUCCESSFUL) {
|
||||
return (String) response.getEntity(String.class);
|
||||
}
|
||||
else {
|
||||
throw new ApiException(
|
||||
response.getClientResponseStatus().getStatusCode(),
|
||||
response.getEntity(String.class));
|
||||
response.getEntity(String.class));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@ import com.fasterxml.jackson.databind.*;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.core.JsonGenerator.Feature;
|
||||
|
||||
import com.fasterxml.jackson.datatype.joda.*;
|
||||
|
||||
public class JsonUtil {
|
||||
public static ObjectMapper mapper;
|
||||
|
||||
@ -12,6 +14,7 @@ public class JsonUtil {
|
||||
mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||
mapper.registerModule(new JodaModule());
|
||||
}
|
||||
|
||||
public static ObjectMapper getJsonMapper() {
|
||||
|
@ -23,21 +23,25 @@ public class PetApi {
|
||||
}
|
||||
|
||||
public Pet getPetById (Long petId) throws ApiException {
|
||||
// verify required params are set
|
||||
if(petId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(petId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return (Pet) ApiInvoker.deserialize(response, "", Pet.class);
|
||||
}
|
||||
@ -54,21 +58,25 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
public void deletePet (String petId) throws ApiException {
|
||||
// verify required params are set
|
||||
if(petId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(petId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -85,21 +93,25 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
public List<Pet> partialUpdate (String petId, Pet body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(petId == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(petId == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json","application/xml"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, body, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "PATCH", queryParams, body, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return (List<Pet>) ApiInvoker.deserialize(response, "Array", Pet.class);
|
||||
}
|
||||
@ -116,21 +128,27 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
public void updatePetWithForm (String petId, String name, String status) throws ApiException {
|
||||
// verify required params are set
|
||||
if(petId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(petId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
formParams.put("name", name);
|
||||
formParams.put("status", status);
|
||||
String[] contentTypes = {
|
||||
"application/x-www-form-urlencoded"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, null, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -153,11 +171,16 @@ public class PetApi {
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
String contentType = "application/json";
|
||||
formParams.put("additionalMetadata", additionalMetadata);
|
||||
String[] contentTypes = {
|
||||
"multipart/form-data"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -174,21 +197,25 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
public void addPet (Pet body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json","application/xml"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -205,21 +232,25 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
public void updatePet (Pet body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -236,23 +267,27 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
public List<Pet> findPetsByStatus (String status) throws ApiException {
|
||||
// verify required params are set
|
||||
if(status == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet/findByStatus".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(status == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(status)))
|
||||
queryParams.put("status", String.valueOf(status));
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return (List<Pet>) ApiInvoker.deserialize(response, "Array", Pet.class);
|
||||
}
|
||||
@ -269,23 +304,27 @@ public class PetApi {
|
||||
}
|
||||
}
|
||||
public List<Pet> findPetsByTags (String tags) throws ApiException {
|
||||
// verify required params are set
|
||||
if(tags == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/pet/findByTags".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(tags == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(tags)))
|
||||
queryParams.put("tags", String.valueOf(tags));
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return (List<Pet>) ApiInvoker.deserialize(response, "Array", Pet.class);
|
||||
}
|
||||
|
@ -22,21 +22,25 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
public Order getOrderById (String orderId) throws ApiException {
|
||||
// verify required params are set
|
||||
if(orderId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(orderId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return (Order) ApiInvoker.deserialize(response, "", Order.class);
|
||||
}
|
||||
@ -53,21 +57,25 @@ public class StoreApi {
|
||||
}
|
||||
}
|
||||
public void deleteOrder (String orderId) throws ApiException {
|
||||
// verify required params are set
|
||||
if(orderId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(orderId == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -84,21 +92,25 @@ public class StoreApi {
|
||||
}
|
||||
}
|
||||
public void placeOrder (Order body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/store/order".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
|
@ -22,21 +22,25 @@ public class UserApi {
|
||||
}
|
||||
|
||||
public void createUser (User body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/user".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -53,21 +57,25 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public void createUsersWithArrayInput (List<User> body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/user/createWithArray".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -84,21 +92,25 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public void createUsersWithListInput (List<User> body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/user/createWithList".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -115,21 +127,25 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public void updateUser (String username, User body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(username == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(username == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -146,21 +162,25 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public void deleteUser (String username) throws ApiException {
|
||||
// verify required params are set
|
||||
if(username == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(username == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -177,21 +197,25 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public User getUserByName (String username) throws ApiException {
|
||||
// verify required params are set
|
||||
if(username == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(username == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return (User) ApiInvoker.deserialize(response, "", User.class);
|
||||
}
|
||||
@ -208,25 +232,29 @@ public class UserApi {
|
||||
}
|
||||
}
|
||||
public String loginUser (String username, String password) throws ApiException {
|
||||
// verify required params are set
|
||||
if(username == null || password == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/user/login".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(username == null || password == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(username)))
|
||||
queryParams.put("username", String.valueOf(username));
|
||||
if(!"null".equals(String.valueOf(password)))
|
||||
queryParams.put("password", String.valueOf(password));
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return (String) ApiInvoker.deserialize(response, "", String.class);
|
||||
}
|
||||
@ -249,11 +277,15 @@ public class UserApi {
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
String contentType = "application/json";
|
||||
String[] contentTypes = {
|
||||
"application/json"};
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, formParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
package com.wordnik.petstore.model;
|
||||
|
||||
public class Category {
|
||||
/* Category unique identifier */
|
||||
private Long id = null;
|
||||
/* Name of the category */
|
||||
private String name = null;
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
@ -2,15 +2,12 @@ package com.wordnik.petstore.model;
|
||||
|
||||
import java.util.Date;
|
||||
public class Order {
|
||||
/* Unique identifier for the order */
|
||||
private Long id = null;
|
||||
/* ID of pet being ordered */
|
||||
private Long petId = null;
|
||||
/* Number of pets ordered */
|
||||
private Integer quantity = null;
|
||||
/* Status of the order */
|
||||
/* Order Status */
|
||||
private String status = null;
|
||||
/* Date shipped, only if it has been */
|
||||
//public enum statusEnum { placed, approved, delivered, };
|
||||
private Date shipDate = null;
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
@ -4,18 +4,15 @@ import java.util.*;
|
||||
import com.wordnik.petstore.model.Category;
|
||||
import com.wordnik.petstore.model.Tag;
|
||||
public class Pet {
|
||||
/* Unique identifier for the Pet */
|
||||
/* unique identifier for the pet */
|
||||
private Long id = null;
|
||||
/* Category the pet is in */
|
||||
private Category category = null;
|
||||
/* Friendly name of the pet */
|
||||
private String name = null;
|
||||
/* Image URLs */
|
||||
private List<String> photoUrls = new ArrayList<String>();
|
||||
/* Tags assigned to this pet */
|
||||
private List<Tag> tags = new ArrayList<Tag>();
|
||||
/* pet status in the store */
|
||||
private String status = null;
|
||||
//public enum statusEnum { available, pending, sold, };
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
package com.wordnik.petstore.model;
|
||||
|
||||
public class Tag {
|
||||
/* Unique identifier for the tag */
|
||||
private Long id = null;
|
||||
/* Friendly name for the tag */
|
||||
private String name = null;
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
@ -1,22 +1,16 @@
|
||||
package com.wordnik.petstore.model;
|
||||
|
||||
public class User {
|
||||
/* Unique identifier for the user */
|
||||
private Long id = null;
|
||||
/* Unique username */
|
||||
private String username = null;
|
||||
/* First name of the user */
|
||||
private String firstName = null;
|
||||
/* Last name of the user */
|
||||
private String username = null;
|
||||
private String lastName = null;
|
||||
/* Email address of the user */
|
||||
private String email = null;
|
||||
/* Password name of the user */
|
||||
private String password = null;
|
||||
/* Phone number of the user */
|
||||
private String phone = null;
|
||||
/* User Status */
|
||||
private Integer userStatus = null;
|
||||
//public enum userStatusEnum { 1-registered, 2-active, 3-closed, };
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@ -24,13 +18,6 @@ public class User {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
@ -38,6 +25,13 @@ public class User {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
@ -78,8 +72,8 @@ public class User {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class User {\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" username: ").append(username).append("\n");
|
||||
sb.append(" firstName: ").append(firstName).append("\n");
|
||||
sb.append(" username: ").append(username).append("\n");
|
||||
sb.append(" lastName: ").append(lastName).append("\n");
|
||||
sb.append(" email: ").append(email).append("\n");
|
||||
sb.append(" password: ").append(password).append("\n");
|
||||
|
@ -44,6 +44,8 @@ object ApiInvoker {
|
||||
URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20")
|
||||
}
|
||||
|
||||
def addHeader(key: String, value: String) = defaultHeaders += key -> value
|
||||
|
||||
def escape(value: Long): String = value.toString
|
||||
def escape(value: Double): String = value.toString
|
||||
def escape(value: Float): String = value.toString
|
||||
|
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Copyright 2012 Wordnik, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import com.wordnik.swagger.codegen.BasicAndroidJavaGenerator
|
||||
|
||||
object AndroidWordnikApiCodegen extends BasicAndroidJavaGenerator {
|
||||
def main(args: Array[String]) = generateClient(args)
|
||||
|
||||
// location of templates
|
||||
override def templateDir = "src/main/resources/android-java"
|
||||
|
||||
def destinationRoot = "samples/client/wordnik-api/android"
|
||||
|
||||
// where to write generated code
|
||||
override def destinationDir = destinationRoot + "/src/main/java"
|
||||
|
||||
// package for api invoker, error files
|
||||
override def invokerPackage = Some("com.wordnik.client.common")
|
||||
|
||||
// package for models
|
||||
override def modelPackage = Some("com.wordnik.client.model")
|
||||
|
||||
// package for api classes
|
||||
override def apiPackage = Some("com.wordnik.client.api")
|
||||
|
||||
additionalParams ++= Map(
|
||||
"artifactId" -> "wordnik-android-client",
|
||||
"artifactVersion" -> "1.0.0",
|
||||
"groupId" -> "com.wordnik")
|
||||
|
||||
// supporting classes
|
||||
override def supportingFiles =
|
||||
List(
|
||||
("apiInvoker.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "ApiInvoker.java"),
|
||||
("JsonUtil.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "JsonUtil.java"),
|
||||
("apiException.mustache", destinationDir + java.io.File.separator + invokerPackage.get.replace(".", java.io.File.separator) + java.io.File.separator, "ApiException.java"),
|
||||
("pom.mustache", destinationRoot, "pom.xml"))
|
||||
}
|
79
samples/client/wordnik-api/android/README.md
Normal file
79
samples/client/wordnik-api/android/README.md
Normal file
@ -0,0 +1,79 @@
|
||||
# Wordnik Android client library
|
||||
|
||||
## Overview
|
||||
This is a full client library for the Wordnik API. It requires that you have a valid Wordnik API Key--you
|
||||
can get one for free at http://developer.wordnik.com.
|
||||
|
||||
This library is built using the Wordnik [Swagger](http://swagger.wordnik.com) client library generator. You
|
||||
can re-generate this library by running ./bin/android-java-wordnik-api.sh from the swagger-codegen project
|
||||
|
||||
## Usage
|
||||
You can use maven central to add this library to your current project:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.wordnik</groupId>
|
||||
<artifactId>wordnik-android-client</artifactId>
|
||||
<version>4.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
or with gradle:
|
||||
|
||||
```gradle
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.wordnik:wordnik-android-client:4.0'
|
||||
}
|
||||
```
|
||||
|
||||
or you can pull the source and re-generate the client library with Maven:
|
||||
|
||||
```
|
||||
mvn package
|
||||
```
|
||||
|
||||
Add the library to your project and you're ready to go:
|
||||
|
||||
```java
|
||||
import com.wordnik.client.api.*;
|
||||
import com.wordnik.client.model.*;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
class WordOfTheDayAsyncTask extends AsyncTask<Void, Void, WordOfTheDay> {
|
||||
@Override
|
||||
protected WordOfTheDay doInBackground(Void... params) {
|
||||
WordsApi api = new WordsApi();
|
||||
api.addHeader("api_key", "YOUR_API_KEY");
|
||||
try {
|
||||
return api.getWordOfTheDay("2014-02-19");
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.d("WordOfTheDayAsyncTask", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(WordOfTheDay d) {
|
||||
Log.d("WordOfTheDayAsyncTask", d.toString());
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can now invoke the async task anywhere in your app. Of course you'll want to do
|
||||
something more in your `onPostExecute` function.
|
||||
|
||||
```java
|
||||
new WordOfTheDayAsyncTask().execute();
|
||||
```
|
||||
|
||||
This project was built with the following minimum requirements:
|
||||
|
||||
* Maven 3.0
|
||||
* Java JDK 6
|
@ -1,51 +1,20 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.sonatype.oss</groupId>
|
||||
<artifactId>oss-parent</artifactId>
|
||||
<version>5</version>
|
||||
</parent>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.wordnik</groupId>
|
||||
<artifactId>swagger-codegen_2.9.1</artifactId>
|
||||
<artifactId>wordnik-android-client</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>swagger-codegen</name>
|
||||
<version>2.0.2-SNAPSHOT</version>
|
||||
<name>wordnik-android-client</name>
|
||||
<version>4.0</version>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:wordnik/swagger-codegen.git</connection>
|
||||
<connection>scm:git:git@github.com:wordnik/swagger-mustache.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:wordnik/swagger-codegen.git</developerConnection>
|
||||
<url>https://github.com/wordnik/swagger-codegen</url>
|
||||
</scm>
|
||||
<prerequisites>
|
||||
<maven>2.2.0</maven>
|
||||
</prerequisites>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>rpidikiti</id>
|
||||
<name>Ramesh Pidikiti</name>
|
||||
<email>ramesh@wordnik.com</email>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>ayush</id>
|
||||
<name>Ayush Gupts</name>
|
||||
<email>ayush@glugbot.com</email>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>fehguy</id>
|
||||
<name>Tony Tam</name>
|
||||
<email>fehguy@gmail.com</email>
|
||||
</developer>
|
||||
</developers>
|
||||
<issueManagement>
|
||||
<system>github</system>
|
||||
<url>https://github.com/wordnik/swagger-codegen/issues</url>
|
||||
</issueManagement>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache License 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@ -78,6 +47,8 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- attach test jar -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
@ -93,6 +64,7 @@
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
@ -135,72 +107,41 @@
|
||||
<plugin>
|
||||
<groupId>net.alchim31.maven</groupId>
|
||||
<artifactId>scala-maven-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>${scala-maven-plugin-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>scala-compile-first</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>scala-test-compile</id>
|
||||
<phase>process-test-resources</phase>
|
||||
<goals>
|
||||
<goal>testCompile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<configuration>
|
||||
<recompileMode>incremental</recompileMode>
|
||||
</configuration>
|
||||
<jvmArgs>
|
||||
<jvmArg>-Xms128m</jvmArg>
|
||||
<jvmArg>-Xmx1500m</jvmArg>
|
||||
<jvmArg>-Xmx384m</jvmArg>
|
||||
</jvmArgs>
|
||||
<recompileMode>incremental</recompileMode>
|
||||
<args>
|
||||
<arg>-target:jvm-1.5</arg>
|
||||
<arg>-deprecation</arg>
|
||||
</args>
|
||||
<launchers>
|
||||
<launcher>
|
||||
<id>run-scalatest</id>
|
||||
<mainClass>org.scalatest.tools.Runner</mainClass>
|
||||
<args>
|
||||
<arg>-p</arg>
|
||||
<arg>${project.build.testOutputDirectory}</arg>
|
||||
</args>
|
||||
<jvmArgs>
|
||||
<jvmArg>-Xmx512m</jvmArg>
|
||||
</jvmArgs>
|
||||
</launcher>
|
||||
</launchers>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>net.alchim31.maven</groupId>
|
||||
<artifactId>scala-maven-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>doc-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.0</version>
|
||||
<configuration>
|
||||
<reportPlugins>
|
||||
<plugin>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>net.alchim31.maven</groupId>
|
||||
<artifactId>scala-maven-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<jvmArgs>
|
||||
<jvmArg>-Xms64m</jvmArg>
|
||||
<jvmArg>-Xmx1024m</jvmArg>
|
||||
</jvmArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</reportPlugins>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
<reporting>
|
||||
@ -208,33 +149,42 @@
|
||||
<plugin>
|
||||
<groupId>net.alchim31.maven</groupId>
|
||||
<artifactId>scala-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<scalaVersion>${scala-version}</scalaVersion>
|
||||
</configuration>
|
||||
<version>${scala-maven-plugin-version}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.3</version>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.fusesource.scalate</groupId>
|
||||
<artifactId>scalate-wikitext_2.9</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.fusesource.scalate</groupId>
|
||||
<artifactId>scalate-page_2.9</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>${httpclient-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.scala-lang</groupId>
|
||||
<artifactId>scala-library</artifactId>
|
||||
<version>${scala-version}</version>
|
||||
<scope>compile</scope>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.scalatest</groupId>
|
||||
@ -248,25 +198,17 @@
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json4s</groupId>
|
||||
<artifactId>json4s-jackson_2.9.1</artifactId>
|
||||
<version>${json4s-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json4s</groupId>
|
||||
<artifactId>json4s-native_2.9.1</artifactId>
|
||||
<version>${json4s-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<swagger-core-version>1.1.1-SNAPSHOT</swagger-core-version>
|
||||
<jackson-version>2.1.4</jackson-version>
|
||||
<scala-version>2.9.1-1</scala-version>
|
||||
<junit-version>4.8.1</junit-version>
|
||||
<maven-plugin.version>1.0.0</maven-plugin.version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<junit-version>4.8.1</junit-version>
|
||||
<scala-test-version>1.6.1</scala-test-version>
|
||||
<json4s-version>3.0.0</json4s-version>
|
||||
<httpclient-version>4.0</httpclient-version>
|
||||
<scala-maven-plugin-version>3.1.5</scala-maven-plugin-version>
|
||||
</properties>
|
||||
</project>
|
||||
|
@ -0,0 +1,192 @@
|
||||
package com.wordnik.client.api;
|
||||
|
||||
import com.wordnik.client.common.ApiException;
|
||||
import com.wordnik.client.common.ApiInvoker;
|
||||
import com.wordnik.client.model.User;
|
||||
import com.wordnik.client.model.WordList;
|
||||
import com.wordnik.client.model.ApiTokenStatus;
|
||||
import com.wordnik.client.model.AuthenticationToken;
|
||||
import java.util.*;
|
||||
|
||||
public class AccountApi {
|
||||
String basePath = "http://api.wordnik.com/v4";
|
||||
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
||||
|
||||
public void addHeader(String key, String value) {
|
||||
getInvoker().addDefaultHeader(key, value);
|
||||
}
|
||||
|
||||
public ApiInvoker getInvoker() {
|
||||
return apiInvoker;
|
||||
}
|
||||
|
||||
public void setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
public AuthenticationToken authenticate (String username, String password) throws ApiException {
|
||||
// verify required params are set
|
||||
if(username == null || password == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/account.{format}/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(password)))
|
||||
queryParams.put("password", String.valueOf(password));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (AuthenticationToken) ApiInvoker.deserialize(response, "", AuthenticationToken.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public AuthenticationToken authenticatePost (String username, String body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(username == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/account.{format}/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (AuthenticationToken) ApiInvoker.deserialize(response, "", AuthenticationToken.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<WordList> getWordListsForLoggedInUser (String auth_token, Integer skip, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/account.{format}/wordLists".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(skip)))
|
||||
queryParams.put("skip", String.valueOf(skip));
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
queryParams.put("limit", String.valueOf(limit));
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (List<WordList>) ApiInvoker.deserialize(response, "List", WordList.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public ApiTokenStatus getApiTokenStatus (String api_key) throws ApiException {
|
||||
// create path and map variables
|
||||
String path = "/account.{format}/apiTokenStatus".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
headerParams.put("api_key", api_key);
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (ApiTokenStatus) ApiInvoker.deserialize(response, "", ApiTokenStatus.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public User getLoggedInUser (String auth_token) throws ApiException {
|
||||
// verify required params are set
|
||||
if(auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/account.{format}/user".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (User) ApiInvoker.deserialize(response, "", User.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,475 @@
|
||||
package com.wordnik.client.api;
|
||||
|
||||
import com.wordnik.client.common.ApiException;
|
||||
import com.wordnik.client.common.ApiInvoker;
|
||||
import com.wordnik.client.model.FrequencySummary;
|
||||
import com.wordnik.client.model.Bigram;
|
||||
import com.wordnik.client.model.WordObject;
|
||||
import com.wordnik.client.model.ExampleSearchResults;
|
||||
import com.wordnik.client.model.Example;
|
||||
import com.wordnik.client.model.ScrabbleScoreResult;
|
||||
import com.wordnik.client.model.TextPron;
|
||||
import com.wordnik.client.model.Syllable;
|
||||
import com.wordnik.client.model.Related;
|
||||
import com.wordnik.client.model.Definition;
|
||||
import com.wordnik.client.model.AudioFile;
|
||||
import java.util.*;
|
||||
|
||||
public class WordApi {
|
||||
String basePath = "http://api.wordnik.com/v4";
|
||||
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
||||
|
||||
public void addHeader(String key, String value) {
|
||||
getInvoker().addDefaultHeader(key, value);
|
||||
}
|
||||
|
||||
public ApiInvoker getInvoker() {
|
||||
return apiInvoker;
|
||||
}
|
||||
|
||||
public void setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
public ExampleSearchResults getExamples (String word, String includeDuplicates, String useCanonical, Integer skip, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/examples".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(includeDuplicates)))
|
||||
queryParams.put("includeDuplicates", String.valueOf(includeDuplicates));
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
if(!"null".equals(String.valueOf(skip)))
|
||||
queryParams.put("skip", String.valueOf(skip));
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
queryParams.put("limit", String.valueOf(limit));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (ExampleSearchResults) ApiInvoker.deserialize(response, "", ExampleSearchResults.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public WordObject getWord (String word, String useCanonical, String includeSuggestions) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
if(!"null".equals(String.valueOf(includeSuggestions)))
|
||||
queryParams.put("includeSuggestions", String.valueOf(includeSuggestions));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (WordObject) ApiInvoker.deserialize(response, "", WordObject.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<Definition> getDefinitions (String word, String partOfSpeech, String sourceDictionaries, Integer limit, String includeRelated, String useCanonical, String includeTags) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/definitions".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
queryParams.put("limit", String.valueOf(limit));
|
||||
if(!"null".equals(String.valueOf(partOfSpeech)))
|
||||
queryParams.put("partOfSpeech", String.valueOf(partOfSpeech));
|
||||
if(!"null".equals(String.valueOf(includeRelated)))
|
||||
queryParams.put("includeRelated", String.valueOf(includeRelated));
|
||||
if(!"null".equals(String.valueOf(sourceDictionaries)))
|
||||
queryParams.put("sourceDictionaries", String.valueOf(sourceDictionaries));
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
if(!"null".equals(String.valueOf(includeTags)))
|
||||
queryParams.put("includeTags", String.valueOf(includeTags));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (List<Definition>) ApiInvoker.deserialize(response, "List", Definition.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public Example getTopExample (String word, String useCanonical) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/topExample".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (Example) ApiInvoker.deserialize(response, "", Example.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<Related> getRelatedWords (String word, String relationshipTypes, String useCanonical, Integer limitPerRelationshipType) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/relatedWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
if(!"null".equals(String.valueOf(relationshipTypes)))
|
||||
queryParams.put("relationshipTypes", String.valueOf(relationshipTypes));
|
||||
if(!"null".equals(String.valueOf(limitPerRelationshipType)))
|
||||
queryParams.put("limitPerRelationshipType", String.valueOf(limitPerRelationshipType));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (List<Related>) ApiInvoker.deserialize(response, "List", Related.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<TextPron> getTextPronunciations (String word, String sourceDictionary, String typeFormat, String useCanonical, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/pronunciations".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
if(!"null".equals(String.valueOf(sourceDictionary)))
|
||||
queryParams.put("sourceDictionary", String.valueOf(sourceDictionary));
|
||||
if(!"null".equals(String.valueOf(typeFormat)))
|
||||
queryParams.put("typeFormat", String.valueOf(typeFormat));
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
queryParams.put("limit", String.valueOf(limit));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (List<TextPron>) ApiInvoker.deserialize(response, "List", TextPron.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<Syllable> getHyphenation (String word, String sourceDictionary, String useCanonical, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/hyphenation".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
if(!"null".equals(String.valueOf(sourceDictionary)))
|
||||
queryParams.put("sourceDictionary", String.valueOf(sourceDictionary));
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
queryParams.put("limit", String.valueOf(limit));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (List<Syllable>) ApiInvoker.deserialize(response, "List", Syllable.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public FrequencySummary getWordFrequency (String word, String useCanonical, Integer startYear, Integer endYear) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/frequency".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
if(!"null".equals(String.valueOf(startYear)))
|
||||
queryParams.put("startYear", String.valueOf(startYear));
|
||||
if(!"null".equals(String.valueOf(endYear)))
|
||||
queryParams.put("endYear", String.valueOf(endYear));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (FrequencySummary) ApiInvoker.deserialize(response, "", FrequencySummary.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<Bigram> getPhrases (String word, Integer limit, Integer wlmi, String useCanonical) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/phrases".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
queryParams.put("limit", String.valueOf(limit));
|
||||
if(!"null".equals(String.valueOf(wlmi)))
|
||||
queryParams.put("wlmi", String.valueOf(wlmi));
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (List<Bigram>) ApiInvoker.deserialize(response, "List", Bigram.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<String> getEtymologies (String word, String useCanonical) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/etymologies".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (List<String>) ApiInvoker.deserialize(response, "List", String.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<AudioFile> getAudio (String word, String useCanonical, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/audio".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
queryParams.put("limit", String.valueOf(limit));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (List<AudioFile>) ApiInvoker.deserialize(response, "List", AudioFile.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public ScrabbleScoreResult getScrabbleScore (String word) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/scrabbleScore".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (ScrabbleScoreResult) ApiInvoker.deserialize(response, "", ScrabbleScoreResult.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,231 @@
|
||||
package com.wordnik.client.api;
|
||||
|
||||
import com.wordnik.client.common.ApiException;
|
||||
import com.wordnik.client.common.ApiInvoker;
|
||||
import com.wordnik.client.model.WordListWord;
|
||||
import com.wordnik.client.model.WordList;
|
||||
import com.wordnik.client.model.StringValue;
|
||||
import java.util.*;
|
||||
|
||||
public class WordListApi {
|
||||
String basePath = "http://api.wordnik.com/v4";
|
||||
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
||||
|
||||
public void addHeader(String key, String value) {
|
||||
getInvoker().addDefaultHeader(key, value);
|
||||
}
|
||||
|
||||
public ApiInvoker getInvoker() {
|
||||
return apiInvoker;
|
||||
}
|
||||
|
||||
public void setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
public void updateWordList (String permalink, WordList body, String auth_token) throws ApiException {
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void deleteWordList (String permalink, String auth_token) throws ApiException {
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public WordList getWordListByPermalink (String permalink, String auth_token) throws ApiException {
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (WordList) ApiInvoker.deserialize(response, "", WordList.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void addWordsToWordList (String permalink, List<StringValue> body, String auth_token) throws ApiException {
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/wordList.{format}/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<WordListWord> getWordListWords (String permalink, String auth_token, String sortBy, String sortOrder, Integer skip, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/wordList.{format}/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(sortBy)))
|
||||
queryParams.put("sortBy", String.valueOf(sortBy));
|
||||
if(!"null".equals(String.valueOf(sortOrder)))
|
||||
queryParams.put("sortOrder", String.valueOf(sortOrder));
|
||||
if(!"null".equals(String.valueOf(skip)))
|
||||
queryParams.put("skip", String.valueOf(skip));
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
queryParams.put("limit", String.valueOf(limit));
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (List<WordListWord>) ApiInvoker.deserialize(response, "List", WordListWord.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void deleteWordsFromWordList (String permalink, List<StringValue> body, String auth_token) throws ApiException {
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/wordList.{format}/{permalink}/deleteWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
return ;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return ;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
package com.wordnik.client.api;
|
||||
|
||||
import com.wordnik.client.common.ApiException;
|
||||
import com.wordnik.client.common.ApiInvoker;
|
||||
import com.wordnik.client.model.WordList;
|
||||
import java.util.*;
|
||||
|
||||
public class WordListsApi {
|
||||
String basePath = "http://api.wordnik.com/v4";
|
||||
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
||||
|
||||
public void addHeader(String key, String value) {
|
||||
getInvoker().addDefaultHeader(key, value);
|
||||
}
|
||||
|
||||
public ApiInvoker getInvoker() {
|
||||
return apiInvoker;
|
||||
}
|
||||
|
||||
public void setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
public WordList createWordList (WordList body, String auth_token) throws ApiException {
|
||||
// verify required params are set
|
||||
if(auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/wordLists.{format}".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (WordList) ApiInvoker.deserialize(response, "", WordList.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,273 @@
|
||||
package com.wordnik.client.api;
|
||||
|
||||
import com.wordnik.client.common.ApiException;
|
||||
import com.wordnik.client.common.ApiInvoker;
|
||||
import com.wordnik.client.model.DefinitionSearchResults;
|
||||
import com.wordnik.client.model.WordObject;
|
||||
import com.wordnik.client.model.WordOfTheDay;
|
||||
import com.wordnik.client.model.WordSearchResults;
|
||||
import java.util.*;
|
||||
|
||||
public class WordsApi {
|
||||
String basePath = "http://api.wordnik.com/v4";
|
||||
ApiInvoker apiInvoker = ApiInvoker.getInstance();
|
||||
|
||||
public void addHeader(String key, String value) {
|
||||
getInvoker().addDefaultHeader(key, value);
|
||||
}
|
||||
|
||||
public ApiInvoker getInvoker() {
|
||||
return apiInvoker;
|
||||
}
|
||||
|
||||
public void setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
public WordSearchResults searchWords (String query, String includePartOfSpeech, String excludePartOfSpeech, String caseSensitive, Integer minCorpusCount, Integer maxCorpusCount, Integer minDictionaryCount, Integer maxDictionaryCount, Integer minLength, Integer maxLength, Integer skip, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(query == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/words.{format}/search/{query}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "query" + "\\}", apiInvoker.escapeString(query.toString()));
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(caseSensitive)))
|
||||
queryParams.put("caseSensitive", String.valueOf(caseSensitive));
|
||||
if(!"null".equals(String.valueOf(includePartOfSpeech)))
|
||||
queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech));
|
||||
if(!"null".equals(String.valueOf(excludePartOfSpeech)))
|
||||
queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech));
|
||||
if(!"null".equals(String.valueOf(minCorpusCount)))
|
||||
queryParams.put("minCorpusCount", String.valueOf(minCorpusCount));
|
||||
if(!"null".equals(String.valueOf(maxCorpusCount)))
|
||||
queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount));
|
||||
if(!"null".equals(String.valueOf(minDictionaryCount)))
|
||||
queryParams.put("minDictionaryCount", String.valueOf(minDictionaryCount));
|
||||
if(!"null".equals(String.valueOf(maxDictionaryCount)))
|
||||
queryParams.put("maxDictionaryCount", String.valueOf(maxDictionaryCount));
|
||||
if(!"null".equals(String.valueOf(minLength)))
|
||||
queryParams.put("minLength", String.valueOf(minLength));
|
||||
if(!"null".equals(String.valueOf(maxLength)))
|
||||
queryParams.put("maxLength", String.valueOf(maxLength));
|
||||
if(!"null".equals(String.valueOf(skip)))
|
||||
queryParams.put("skip", String.valueOf(skip));
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
queryParams.put("limit", String.valueOf(limit));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (WordSearchResults) ApiInvoker.deserialize(response, "", WordSearchResults.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public WordOfTheDay getWordOfTheDay (String date) throws ApiException {
|
||||
// create path and map variables
|
||||
String path = "/words.{format}/wordOfTheDay".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(date)))
|
||||
queryParams.put("date", String.valueOf(date));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (WordOfTheDay) ApiInvoker.deserialize(response, "", WordOfTheDay.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public DefinitionSearchResults reverseDictionary (String query, String findSenseForWord, String includeSourceDictionaries, String excludeSourceDictionaries, String includePartOfSpeech, String excludePartOfSpeech, String expandTerms, String sortBy, String sortOrder, Integer minCorpusCount, Integer maxCorpusCount, Integer minLength, Integer maxLength, String includeTags, String skip, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(query == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/words.{format}/reverseDictionary".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(query)))
|
||||
queryParams.put("query", String.valueOf(query));
|
||||
if(!"null".equals(String.valueOf(findSenseForWord)))
|
||||
queryParams.put("findSenseForWord", String.valueOf(findSenseForWord));
|
||||
if(!"null".equals(String.valueOf(includeSourceDictionaries)))
|
||||
queryParams.put("includeSourceDictionaries", String.valueOf(includeSourceDictionaries));
|
||||
if(!"null".equals(String.valueOf(excludeSourceDictionaries)))
|
||||
queryParams.put("excludeSourceDictionaries", String.valueOf(excludeSourceDictionaries));
|
||||
if(!"null".equals(String.valueOf(includePartOfSpeech)))
|
||||
queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech));
|
||||
if(!"null".equals(String.valueOf(excludePartOfSpeech)))
|
||||
queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech));
|
||||
if(!"null".equals(String.valueOf(minCorpusCount)))
|
||||
queryParams.put("minCorpusCount", String.valueOf(minCorpusCount));
|
||||
if(!"null".equals(String.valueOf(maxCorpusCount)))
|
||||
queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount));
|
||||
if(!"null".equals(String.valueOf(minLength)))
|
||||
queryParams.put("minLength", String.valueOf(minLength));
|
||||
if(!"null".equals(String.valueOf(maxLength)))
|
||||
queryParams.put("maxLength", String.valueOf(maxLength));
|
||||
if(!"null".equals(String.valueOf(expandTerms)))
|
||||
queryParams.put("expandTerms", String.valueOf(expandTerms));
|
||||
if(!"null".equals(String.valueOf(includeTags)))
|
||||
queryParams.put("includeTags", String.valueOf(includeTags));
|
||||
if(!"null".equals(String.valueOf(sortBy)))
|
||||
queryParams.put("sortBy", String.valueOf(sortBy));
|
||||
if(!"null".equals(String.valueOf(sortOrder)))
|
||||
queryParams.put("sortOrder", String.valueOf(sortOrder));
|
||||
if(!"null".equals(String.valueOf(skip)))
|
||||
queryParams.put("skip", String.valueOf(skip));
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
queryParams.put("limit", String.valueOf(limit));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (DefinitionSearchResults) ApiInvoker.deserialize(response, "", DefinitionSearchResults.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<WordObject> getRandomWords (String includePartOfSpeech, String excludePartOfSpeech, String sortBy, String sortOrder, String hasDictionaryDef, Integer minCorpusCount, Integer maxCorpusCount, Integer minDictionaryCount, Integer maxDictionaryCount, Integer minLength, Integer maxLength, Integer limit) throws ApiException {
|
||||
// create path and map variables
|
||||
String path = "/words.{format}/randomWords".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(hasDictionaryDef)))
|
||||
queryParams.put("hasDictionaryDef", String.valueOf(hasDictionaryDef));
|
||||
if(!"null".equals(String.valueOf(includePartOfSpeech)))
|
||||
queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech));
|
||||
if(!"null".equals(String.valueOf(excludePartOfSpeech)))
|
||||
queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech));
|
||||
if(!"null".equals(String.valueOf(minCorpusCount)))
|
||||
queryParams.put("minCorpusCount", String.valueOf(minCorpusCount));
|
||||
if(!"null".equals(String.valueOf(maxCorpusCount)))
|
||||
queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount));
|
||||
if(!"null".equals(String.valueOf(minDictionaryCount)))
|
||||
queryParams.put("minDictionaryCount", String.valueOf(minDictionaryCount));
|
||||
if(!"null".equals(String.valueOf(maxDictionaryCount)))
|
||||
queryParams.put("maxDictionaryCount", String.valueOf(maxDictionaryCount));
|
||||
if(!"null".equals(String.valueOf(minLength)))
|
||||
queryParams.put("minLength", String.valueOf(minLength));
|
||||
if(!"null".equals(String.valueOf(maxLength)))
|
||||
queryParams.put("maxLength", String.valueOf(maxLength));
|
||||
if(!"null".equals(String.valueOf(sortBy)))
|
||||
queryParams.put("sortBy", String.valueOf(sortBy));
|
||||
if(!"null".equals(String.valueOf(sortOrder)))
|
||||
queryParams.put("sortOrder", String.valueOf(sortOrder));
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
queryParams.put("limit", String.valueOf(limit));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (List<WordObject>) ApiInvoker.deserialize(response, "List", WordObject.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
public WordObject getRandomWord (String includePartOfSpeech, String excludePartOfSpeech, String hasDictionaryDef, Integer minCorpusCount, Integer maxCorpusCount, Integer minDictionaryCount, Integer maxDictionaryCount, Integer minLength, Integer maxLength) throws ApiException {
|
||||
// create path and map variables
|
||||
String path = "/words.{format}/randomWord".replaceAll("\\{format\\}","json");
|
||||
|
||||
// query params
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
if(!"null".equals(String.valueOf(hasDictionaryDef)))
|
||||
queryParams.put("hasDictionaryDef", String.valueOf(hasDictionaryDef));
|
||||
if(!"null".equals(String.valueOf(includePartOfSpeech)))
|
||||
queryParams.put("includePartOfSpeech", String.valueOf(includePartOfSpeech));
|
||||
if(!"null".equals(String.valueOf(excludePartOfSpeech)))
|
||||
queryParams.put("excludePartOfSpeech", String.valueOf(excludePartOfSpeech));
|
||||
if(!"null".equals(String.valueOf(minCorpusCount)))
|
||||
queryParams.put("minCorpusCount", String.valueOf(minCorpusCount));
|
||||
if(!"null".equals(String.valueOf(maxCorpusCount)))
|
||||
queryParams.put("maxCorpusCount", String.valueOf(maxCorpusCount));
|
||||
if(!"null".equals(String.valueOf(minDictionaryCount)))
|
||||
queryParams.put("minDictionaryCount", String.valueOf(minDictionaryCount));
|
||||
if(!"null".equals(String.valueOf(maxDictionaryCount)))
|
||||
queryParams.put("maxDictionaryCount", String.valueOf(maxDictionaryCount));
|
||||
if(!"null".equals(String.valueOf(minLength)))
|
||||
queryParams.put("minLength", String.valueOf(minLength));
|
||||
if(!"null".equals(String.valueOf(maxLength)))
|
||||
queryParams.put("maxLength", String.valueOf(maxLength));
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
|
||||
if(response != null){
|
||||
return (WordObject) ApiInvoker.deserialize(response, "", WordObject.class);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
} catch (ApiException ex) {
|
||||
if(ex.getCode() == 404) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.wordnik.client.common;
|
||||
|
||||
public class ApiException extends Exception {
|
||||
int code = 0;
|
||||
String message = null;
|
||||
|
||||
public ApiException() {}
|
||||
|
||||
public ApiException(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
@ -0,0 +1,272 @@
|
||||
package com.wordnik.client.common;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator.Feature;
|
||||
import com.fasterxml.jackson.databind.*;
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
import org.apache.http.*;
|
||||
import org.apache.http.client.*;
|
||||
import org.apache.http.client.methods.*;
|
||||
import org.apache.http.conn.*;
|
||||
import org.apache.http.conn.scheme.*;
|
||||
import org.apache.http.conn.ssl.*;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.*;
|
||||
import org.apache.http.impl.conn.*;
|
||||
import org.apache.http.params.*;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.cert.*;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
public class ApiInvoker {
|
||||
private static ApiInvoker INSTANCE = new ApiInvoker();
|
||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||
|
||||
private HttpClient client = null;
|
||||
|
||||
private boolean ignoreSSLCertificates = false;
|
||||
|
||||
private ClientConnectionManager ignoreSSLConnectionManager;
|
||||
|
||||
public ApiInvoker() {
|
||||
initConnectionManager();
|
||||
}
|
||||
|
||||
public static ApiInvoker getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void ignoreSSLCertificates(boolean ignoreSSLCertificates) {
|
||||
this.ignoreSSLCertificates = ignoreSSLCertificates;
|
||||
}
|
||||
|
||||
public void addDefaultHeader(String key, String value) {
|
||||
defaultHeaderMap.put(key, value);
|
||||
}
|
||||
|
||||
public String escapeString(String str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {
|
||||
try{
|
||||
if("List".equals(containerType)) {
|
||||
JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructCollectionType(List.class, cls);
|
||||
List response = (List<?>) JsonUtil.getJsonMapper().readValue(json, typeInfo);
|
||||
return response;
|
||||
}
|
||||
else if(String.class.equals(cls)) {
|
||||
if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1)
|
||||
return json.substring(1, json.length() - 2);
|
||||
else
|
||||
return json;
|
||||
}
|
||||
else {
|
||||
return JsonUtil.getJsonMapper().readValue(json, cls);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new ApiException(500, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static String serialize(Object obj) throws ApiException {
|
||||
try {
|
||||
if (obj != null)
|
||||
return JsonUtil.getJsonMapper().writeValueAsString(obj);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new ApiException(500, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public String invokeAPI(String host, String path, String method, Map<String, String> queryParams, Object body, Map<String, String> headerParams, String contentType) throws ApiException {
|
||||
HttpClient client = getClient(host);
|
||||
|
||||
StringBuilder b = new StringBuilder();
|
||||
for(String key : queryParams.keySet()) {
|
||||
String value = queryParams.get(key);
|
||||
if (value != null){
|
||||
if(b.toString().length() == 0)
|
||||
b.append("?");
|
||||
else
|
||||
b.append("&");
|
||||
b.append(escapeString(key)).append("=").append(escapeString(value));
|
||||
}
|
||||
}
|
||||
String url = host + path + b.toString();
|
||||
|
||||
HashMap<String, String> headers = new HashMap<String, String>();
|
||||
|
||||
for(String key : headerParams.keySet()) {
|
||||
headers.put(key, headerParams.get(key));
|
||||
}
|
||||
|
||||
for(String key : defaultHeaderMap.keySet()) {
|
||||
if(!headerParams.containsKey(key)) {
|
||||
headers.put(key, defaultHeaderMap.get(key));
|
||||
}
|
||||
}
|
||||
headers.put("Accept", "application/json");
|
||||
|
||||
HttpResponse response = null;
|
||||
try{
|
||||
if("GET".equals(method)) {
|
||||
HttpGet get = new HttpGet(url);
|
||||
get.addHeader("Accept", "application/json");
|
||||
for(String key : headers.keySet()) {
|
||||
get.setHeader(key, headers.get(key));
|
||||
}
|
||||
response = client.execute(get);
|
||||
}
|
||||
else if ("POST".equals(method)) {
|
||||
HttpPost post = new HttpPost(url);
|
||||
|
||||
if (body != null) {
|
||||
post.setHeader("Content-Type", contentType);
|
||||
post.setEntity(new StringEntity(serialize(body), "UTF-8"));
|
||||
}
|
||||
for(String key : headers.keySet()) {
|
||||
post.setHeader(key, headers.get(key));
|
||||
}
|
||||
response = client.execute(post);
|
||||
}
|
||||
else if ("PUT".equals(method)) {
|
||||
HttpPut put = new HttpPut(url);
|
||||
if(body != null) {
|
||||
put.setHeader("Content-Type", contentType);
|
||||
put.setEntity(new StringEntity(serialize(body), "UTF-8"));
|
||||
}
|
||||
for(String key : headers.keySet()) {
|
||||
put.setHeader(key, headers.get(key));
|
||||
}
|
||||
response = client.execute(put);
|
||||
}
|
||||
else if ("DELETE".equals(method)) {
|
||||
HttpDelete delete = new HttpDelete(url);
|
||||
for(String key : headers.keySet()) {
|
||||
delete.setHeader(key, headers.get(key));
|
||||
}
|
||||
response = client.execute(delete);
|
||||
}
|
||||
|
||||
int code = response.getStatusLine().getStatusCode();
|
||||
String responseString = null;
|
||||
if(code == 204)
|
||||
responseString = "";
|
||||
else if(code >= 200 && code < 300) {
|
||||
if(response.getEntity() != null) {
|
||||
HttpEntity resEntity = response.getEntity();
|
||||
responseString = EntityUtils.toString(resEntity);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(response.getEntity() != null) {
|
||||
HttpEntity resEntity = response.getEntity();
|
||||
responseString = EntityUtils.toString(resEntity);
|
||||
}
|
||||
else
|
||||
responseString = "no data";
|
||||
throw new ApiException(code, responseString);
|
||||
}
|
||||
return responseString;
|
||||
}
|
||||
catch(IOException e) {
|
||||
throw new ApiException(500, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private HttpClient getClient(String host) {
|
||||
if (client == null) {
|
||||
if (ignoreSSLCertificates && ignoreSSLConnectionManager != null) {
|
||||
// Trust self signed certificates
|
||||
client = new DefaultHttpClient(ignoreSSLConnectionManager, new BasicHttpParams());
|
||||
} else {
|
||||
client = new DefaultHttpClient();
|
||||
}
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
private void initConnectionManager() {
|
||||
try {
|
||||
final SSLContext sslContext = SSLContext.getInstance("SSL");
|
||||
|
||||
// set up a TrustManager that trusts everything
|
||||
TrustManager[] trustManagers = new TrustManager[] {
|
||||
new X509TrustManager() {
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
public void checkClientTrusted(X509Certificate[] certs, String authType) {}
|
||||
public void checkServerTrusted(X509Certificate[] certs, String authType) {}
|
||||
}};
|
||||
|
||||
sslContext.init(null, trustManagers, new SecureRandom());
|
||||
|
||||
SSLSocketFactory sf = new SSLSocketFactory((KeyStore)null) {
|
||||
private javax.net.ssl.SSLSocketFactory sslFactory = sslContext.getSocketFactory();
|
||||
|
||||
public Socket createSocket(Socket socket, String host, int port, boolean autoClose)
|
||||
throws IOException, UnknownHostException {
|
||||
return sslFactory.createSocket(socket, host, port, autoClose);
|
||||
}
|
||||
|
||||
public Socket createSocket() throws IOException {
|
||||
return sslFactory.createSocket();
|
||||
}
|
||||
};
|
||||
|
||||
sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||
Scheme httpsScheme = new Scheme("https", sf, 443);
|
||||
SchemeRegistry schemeRegistry = new SchemeRegistry();
|
||||
schemeRegistry.register(httpsScheme);
|
||||
schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
|
||||
|
||||
ignoreSSLConnectionManager = new SingleClientConnManager(new BasicHttpParams(), schemeRegistry);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
// This will only be thrown if SSL isn't available for some reason.
|
||||
} catch (KeyManagementException e) {
|
||||
// This might be thrown when passing a key into init(), but no key is being passed.
|
||||
} catch (GeneralSecurityException e) {
|
||||
// This catches anything else that might go wrong.
|
||||
// If anything goes wrong we default to the standard connection manager.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.wordnik.client.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import com.fasterxml.jackson.databind.*;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.core.JsonGenerator.Feature;
|
||||
|
||||
public class JsonUtil {
|
||||
public static ObjectMapper mapper;
|
||||
|
||||
static {
|
||||
mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||
}
|
||||
|
||||
public static ObjectMapper getJsonMapper() {
|
||||
return mapper;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class ApiTokenStatus {
|
||||
@JsonProperty("valid")
|
||||
private Boolean valid = null;
|
||||
@JsonProperty("token")
|
||||
private String token = null;
|
||||
@JsonProperty("resetsInMillis")
|
||||
private Long resetsInMillis = null;
|
||||
@JsonProperty("remainingCalls")
|
||||
private Long remainingCalls = null;
|
||||
@JsonProperty("expiresInMillis")
|
||||
private Long expiresInMillis = null;
|
||||
@JsonProperty("totalRequests")
|
||||
private Long totalRequests = null;
|
||||
public Boolean getValid() {
|
||||
return valid;
|
||||
}
|
||||
public void setValid(Boolean valid) {
|
||||
this.valid = valid;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public Long getResetsInMillis() {
|
||||
return resetsInMillis;
|
||||
}
|
||||
public void setResetsInMillis(Long resetsInMillis) {
|
||||
this.resetsInMillis = resetsInMillis;
|
||||
}
|
||||
|
||||
public Long getRemainingCalls() {
|
||||
return remainingCalls;
|
||||
}
|
||||
public void setRemainingCalls(Long remainingCalls) {
|
||||
this.remainingCalls = remainingCalls;
|
||||
}
|
||||
|
||||
public Long getExpiresInMillis() {
|
||||
return expiresInMillis;
|
||||
}
|
||||
public void setExpiresInMillis(Long expiresInMillis) {
|
||||
this.expiresInMillis = expiresInMillis;
|
||||
}
|
||||
|
||||
public Long getTotalRequests() {
|
||||
return totalRequests;
|
||||
}
|
||||
public void setTotalRequests(Long totalRequests) {
|
||||
this.totalRequests = totalRequests;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ApiTokenStatus {\n");
|
||||
sb.append(" valid: ").append(valid).append("\n");
|
||||
sb.append(" token: ").append(token).append("\n");
|
||||
sb.append(" resetsInMillis: ").append(resetsInMillis).append("\n");
|
||||
sb.append(" remainingCalls: ").append(remainingCalls).append("\n");
|
||||
sb.append(" expiresInMillis: ").append(expiresInMillis).append("\n");
|
||||
sb.append(" totalRequests: ").append(totalRequests).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,155 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.Date;
|
||||
public class AudioFile {
|
||||
@JsonProperty("attributionUrl")
|
||||
private String attributionUrl = null;
|
||||
@JsonProperty("commentCount")
|
||||
private Integer commentCount = null;
|
||||
@JsonProperty("voteCount")
|
||||
private Integer voteCount = null;
|
||||
@JsonProperty("fileUrl")
|
||||
private String fileUrl = null;
|
||||
@JsonProperty("audioType")
|
||||
private String audioType = null;
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
@JsonProperty("duration")
|
||||
private Double duration = null;
|
||||
@JsonProperty("attributionText")
|
||||
private String attributionText = null;
|
||||
@JsonProperty("createdBy")
|
||||
private String createdBy = null;
|
||||
@JsonProperty("description")
|
||||
private String description = null;
|
||||
@JsonProperty("createdAt")
|
||||
private Date createdAt = null;
|
||||
@JsonProperty("voteWeightedAverage")
|
||||
private Float voteWeightedAverage = null;
|
||||
@JsonProperty("voteAverage")
|
||||
private Float voteAverage = null;
|
||||
@JsonProperty("word")
|
||||
private String word = null;
|
||||
public String getAttributionUrl() {
|
||||
return attributionUrl;
|
||||
}
|
||||
public void setAttributionUrl(String attributionUrl) {
|
||||
this.attributionUrl = attributionUrl;
|
||||
}
|
||||
|
||||
public Integer getCommentCount() {
|
||||
return commentCount;
|
||||
}
|
||||
public void setCommentCount(Integer commentCount) {
|
||||
this.commentCount = commentCount;
|
||||
}
|
||||
|
||||
public Integer getVoteCount() {
|
||||
return voteCount;
|
||||
}
|
||||
public void setVoteCount(Integer voteCount) {
|
||||
this.voteCount = voteCount;
|
||||
}
|
||||
|
||||
public String getFileUrl() {
|
||||
return fileUrl;
|
||||
}
|
||||
public void setFileUrl(String fileUrl) {
|
||||
this.fileUrl = fileUrl;
|
||||
}
|
||||
|
||||
public String getAudioType() {
|
||||
return audioType;
|
||||
}
|
||||
public void setAudioType(String audioType) {
|
||||
this.audioType = audioType;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Double getDuration() {
|
||||
return duration;
|
||||
}
|
||||
public void setDuration(Double duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public String getAttributionText() {
|
||||
return attributionText;
|
||||
}
|
||||
public void setAttributionText(String attributionText) {
|
||||
this.attributionText = attributionText;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
public void setCreatedAt(Date createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Float getVoteWeightedAverage() {
|
||||
return voteWeightedAverage;
|
||||
}
|
||||
public void setVoteWeightedAverage(Float voteWeightedAverage) {
|
||||
this.voteWeightedAverage = voteWeightedAverage;
|
||||
}
|
||||
|
||||
public Float getVoteAverage() {
|
||||
return voteAverage;
|
||||
}
|
||||
public void setVoteAverage(Float voteAverage) {
|
||||
this.voteAverage = voteAverage;
|
||||
}
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class AudioFile {\n");
|
||||
sb.append(" attributionUrl: ").append(attributionUrl).append("\n");
|
||||
sb.append(" commentCount: ").append(commentCount).append("\n");
|
||||
sb.append(" voteCount: ").append(voteCount).append("\n");
|
||||
sb.append(" fileUrl: ").append(fileUrl).append("\n");
|
||||
sb.append(" audioType: ").append(audioType).append("\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" duration: ").append(duration).append("\n");
|
||||
sb.append(" attributionText: ").append(attributionText).append("\n");
|
||||
sb.append(" createdBy: ").append(createdBy).append("\n");
|
||||
sb.append(" description: ").append(description).append("\n");
|
||||
sb.append(" createdAt: ").append(createdAt).append("\n");
|
||||
sb.append(" voteWeightedAverage: ").append(voteWeightedAverage).append("\n");
|
||||
sb.append(" voteAverage: ").append(voteAverage).append("\n");
|
||||
sb.append(" word: ").append(word).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class AuthenticationToken {
|
||||
@JsonProperty("token")
|
||||
private String token = null;
|
||||
@JsonProperty("userId")
|
||||
private Long userId = null;
|
||||
@JsonProperty("userSignature")
|
||||
private String userSignature = null;
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserSignature() {
|
||||
return userSignature;
|
||||
}
|
||||
public void setUserSignature(String userSignature) {
|
||||
this.userSignature = userSignature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class AuthenticationToken {\n");
|
||||
sb.append(" token: ").append(token).append("\n");
|
||||
sb.append(" userId: ").append(userId).append("\n");
|
||||
sb.append(" userSignature: ").append(userSignature).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,64 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class Bigram {
|
||||
@JsonProperty("count")
|
||||
private Long count = null;
|
||||
@JsonProperty("gram2")
|
||||
private String gram2 = null;
|
||||
@JsonProperty("gram1")
|
||||
private String gram1 = null;
|
||||
@JsonProperty("wlmi")
|
||||
private Double wlmi = null;
|
||||
@JsonProperty("mi")
|
||||
private Double mi = null;
|
||||
public Long getCount() {
|
||||
return count;
|
||||
}
|
||||
public void setCount(Long count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public String getGram2() {
|
||||
return gram2;
|
||||
}
|
||||
public void setGram2(String gram2) {
|
||||
this.gram2 = gram2;
|
||||
}
|
||||
|
||||
public String getGram1() {
|
||||
return gram1;
|
||||
}
|
||||
public void setGram1(String gram1) {
|
||||
this.gram1 = gram1;
|
||||
}
|
||||
|
||||
public Double getWlmi() {
|
||||
return wlmi;
|
||||
}
|
||||
public void setWlmi(Double wlmi) {
|
||||
this.wlmi = wlmi;
|
||||
}
|
||||
|
||||
public Double getMi() {
|
||||
return mi;
|
||||
}
|
||||
public void setMi(Double mi) {
|
||||
this.mi = mi;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Bigram {\n");
|
||||
sb.append(" count: ").append(count).append("\n");
|
||||
sb.append(" gram2: ").append(gram2).append("\n");
|
||||
sb.append(" gram1: ").append(gram1).append("\n");
|
||||
sb.append(" wlmi: ").append(wlmi).append("\n");
|
||||
sb.append(" mi: ").append(mi).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class Citation {
|
||||
@JsonProperty("cite")
|
||||
private String cite = null;
|
||||
@JsonProperty("source")
|
||||
private String source = null;
|
||||
public String getCite() {
|
||||
return cite;
|
||||
}
|
||||
public void setCite(String cite) {
|
||||
this.cite = cite;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Citation {\n");
|
||||
sb.append(" cite: ").append(cite).append("\n");
|
||||
sb.append(" source: ").append(source).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class ContentProvider {
|
||||
@JsonProperty("id")
|
||||
private Integer id = null;
|
||||
@JsonProperty("name")
|
||||
private String name = null;
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ContentProvider {\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" name: ").append(name).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,181 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.*;
|
||||
import com.wordnik.client.model.Label;
|
||||
import com.wordnik.client.model.ExampleUsage;
|
||||
import com.wordnik.client.model.TextPron;
|
||||
import com.wordnik.client.model.Citation;
|
||||
import com.wordnik.client.model.Related;
|
||||
import com.wordnik.client.model.Note;
|
||||
public class Definition {
|
||||
@JsonProperty("extendedText")
|
||||
private String extendedText = null;
|
||||
@JsonProperty("text")
|
||||
private String text = null;
|
||||
@JsonProperty("sourceDictionary")
|
||||
private String sourceDictionary = null;
|
||||
@JsonProperty("citations")
|
||||
private List<Citation> citations = new ArrayList<Citation>();
|
||||
@JsonProperty("labels")
|
||||
private List<Label> labels = new ArrayList<Label>();
|
||||
@JsonProperty("score")
|
||||
private Float score = null;
|
||||
@JsonProperty("exampleUses")
|
||||
private List<ExampleUsage> exampleUses = new ArrayList<ExampleUsage>();
|
||||
@JsonProperty("attributionUrl")
|
||||
private String attributionUrl = null;
|
||||
@JsonProperty("seqString")
|
||||
private String seqString = null;
|
||||
@JsonProperty("attributionText")
|
||||
private String attributionText = null;
|
||||
@JsonProperty("relatedWords")
|
||||
private List<Related> relatedWords = new ArrayList<Related>();
|
||||
@JsonProperty("sequence")
|
||||
private String sequence = null;
|
||||
@JsonProperty("word")
|
||||
private String word = null;
|
||||
@JsonProperty("notes")
|
||||
private List<Note> notes = new ArrayList<Note>();
|
||||
@JsonProperty("textProns")
|
||||
private List<TextPron> textProns = new ArrayList<TextPron>();
|
||||
@JsonProperty("partOfSpeech")
|
||||
private String partOfSpeech = null;
|
||||
public String getExtendedText() {
|
||||
return extendedText;
|
||||
}
|
||||
public void setExtendedText(String extendedText) {
|
||||
this.extendedText = extendedText;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getSourceDictionary() {
|
||||
return sourceDictionary;
|
||||
}
|
||||
public void setSourceDictionary(String sourceDictionary) {
|
||||
this.sourceDictionary = sourceDictionary;
|
||||
}
|
||||
|
||||
public List<Citation> getCitations() {
|
||||
return citations;
|
||||
}
|
||||
public void setCitations(List<Citation> citations) {
|
||||
this.citations = citations;
|
||||
}
|
||||
|
||||
public List<Label> getLabels() {
|
||||
return labels;
|
||||
}
|
||||
public void setLabels(List<Label> labels) {
|
||||
this.labels = labels;
|
||||
}
|
||||
|
||||
public Float getScore() {
|
||||
return score;
|
||||
}
|
||||
public void setScore(Float score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public List<ExampleUsage> getExampleUses() {
|
||||
return exampleUses;
|
||||
}
|
||||
public void setExampleUses(List<ExampleUsage> exampleUses) {
|
||||
this.exampleUses = exampleUses;
|
||||
}
|
||||
|
||||
public String getAttributionUrl() {
|
||||
return attributionUrl;
|
||||
}
|
||||
public void setAttributionUrl(String attributionUrl) {
|
||||
this.attributionUrl = attributionUrl;
|
||||
}
|
||||
|
||||
public String getSeqString() {
|
||||
return seqString;
|
||||
}
|
||||
public void setSeqString(String seqString) {
|
||||
this.seqString = seqString;
|
||||
}
|
||||
|
||||
public String getAttributionText() {
|
||||
return attributionText;
|
||||
}
|
||||
public void setAttributionText(String attributionText) {
|
||||
this.attributionText = attributionText;
|
||||
}
|
||||
|
||||
public List<Related> getRelatedWords() {
|
||||
return relatedWords;
|
||||
}
|
||||
public void setRelatedWords(List<Related> relatedWords) {
|
||||
this.relatedWords = relatedWords;
|
||||
}
|
||||
|
||||
public String getSequence() {
|
||||
return sequence;
|
||||
}
|
||||
public void setSequence(String sequence) {
|
||||
this.sequence = sequence;
|
||||
}
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
|
||||
public List<Note> getNotes() {
|
||||
return notes;
|
||||
}
|
||||
public void setNotes(List<Note> notes) {
|
||||
this.notes = notes;
|
||||
}
|
||||
|
||||
public List<TextPron> getTextProns() {
|
||||
return textProns;
|
||||
}
|
||||
public void setTextProns(List<TextPron> textProns) {
|
||||
this.textProns = textProns;
|
||||
}
|
||||
|
||||
public String getPartOfSpeech() {
|
||||
return partOfSpeech;
|
||||
}
|
||||
public void setPartOfSpeech(String partOfSpeech) {
|
||||
this.partOfSpeech = partOfSpeech;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Definition {\n");
|
||||
sb.append(" extendedText: ").append(extendedText).append("\n");
|
||||
sb.append(" text: ").append(text).append("\n");
|
||||
sb.append(" sourceDictionary: ").append(sourceDictionary).append("\n");
|
||||
sb.append(" citations: ").append(citations).append("\n");
|
||||
sb.append(" labels: ").append(labels).append("\n");
|
||||
sb.append(" score: ").append(score).append("\n");
|
||||
sb.append(" exampleUses: ").append(exampleUses).append("\n");
|
||||
sb.append(" attributionUrl: ").append(attributionUrl).append("\n");
|
||||
sb.append(" seqString: ").append(seqString).append("\n");
|
||||
sb.append(" attributionText: ").append(attributionText).append("\n");
|
||||
sb.append(" relatedWords: ").append(relatedWords).append("\n");
|
||||
sb.append(" sequence: ").append(sequence).append("\n");
|
||||
sb.append(" word: ").append(word).append("\n");
|
||||
sb.append(" notes: ").append(notes).append("\n");
|
||||
sb.append(" textProns: ").append(textProns).append("\n");
|
||||
sb.append(" partOfSpeech: ").append(partOfSpeech).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.*;
|
||||
import com.wordnik.client.model.Definition;
|
||||
public class DefinitionSearchResults {
|
||||
@JsonProperty("results")
|
||||
private List<Definition> results = new ArrayList<Definition>();
|
||||
@JsonProperty("totalResults")
|
||||
private Integer totalResults = null;
|
||||
public List<Definition> getResults() {
|
||||
return results;
|
||||
}
|
||||
public void setResults(List<Definition> results) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
public Integer getTotalResults() {
|
||||
return totalResults;
|
||||
}
|
||||
public void setTotalResults(Integer totalResults) {
|
||||
this.totalResults = totalResults;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class DefinitionSearchResults {\n");
|
||||
sb.append(" results: ").append(results).append("\n");
|
||||
sb.append(" totalResults: ").append(totalResults).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,137 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import com.wordnik.client.model.Sentence;
|
||||
import com.wordnik.client.model.ContentProvider;
|
||||
import com.wordnik.client.model.ScoredWord;
|
||||
public class Example {
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
@JsonProperty("exampleId")
|
||||
private Long exampleId = null;
|
||||
@JsonProperty("title")
|
||||
private String title = null;
|
||||
@JsonProperty("text")
|
||||
private String text = null;
|
||||
@JsonProperty("score")
|
||||
private ScoredWord score = null;
|
||||
@JsonProperty("sentence")
|
||||
private Sentence sentence = null;
|
||||
@JsonProperty("word")
|
||||
private String word = null;
|
||||
@JsonProperty("provider")
|
||||
private ContentProvider provider = null;
|
||||
@JsonProperty("year")
|
||||
private Integer year = null;
|
||||
@JsonProperty("rating")
|
||||
private Float rating = null;
|
||||
@JsonProperty("documentId")
|
||||
private Long documentId = null;
|
||||
@JsonProperty("url")
|
||||
private String url = null;
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getExampleId() {
|
||||
return exampleId;
|
||||
}
|
||||
public void setExampleId(Long exampleId) {
|
||||
this.exampleId = exampleId;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public ScoredWord getScore() {
|
||||
return score;
|
||||
}
|
||||
public void setScore(ScoredWord score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public Sentence getSentence() {
|
||||
return sentence;
|
||||
}
|
||||
public void setSentence(Sentence sentence) {
|
||||
this.sentence = sentence;
|
||||
}
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
|
||||
public ContentProvider getProvider() {
|
||||
return provider;
|
||||
}
|
||||
public void setProvider(ContentProvider provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
public Integer getYear() {
|
||||
return year;
|
||||
}
|
||||
public void setYear(Integer year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public Float getRating() {
|
||||
return rating;
|
||||
}
|
||||
public void setRating(Float rating) {
|
||||
this.rating = rating;
|
||||
}
|
||||
|
||||
public Long getDocumentId() {
|
||||
return documentId;
|
||||
}
|
||||
public void setDocumentId(Long documentId) {
|
||||
this.documentId = documentId;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Example {\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" exampleId: ").append(exampleId).append("\n");
|
||||
sb.append(" title: ").append(title).append("\n");
|
||||
sb.append(" text: ").append(text).append("\n");
|
||||
sb.append(" score: ").append(score).append("\n");
|
||||
sb.append(" sentence: ").append(sentence).append("\n");
|
||||
sb.append(" word: ").append(word).append("\n");
|
||||
sb.append(" provider: ").append(provider).append("\n");
|
||||
sb.append(" year: ").append(year).append("\n");
|
||||
sb.append(" rating: ").append(rating).append("\n");
|
||||
sb.append(" documentId: ").append(documentId).append("\n");
|
||||
sb.append(" url: ").append(url).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.*;
|
||||
import com.wordnik.client.model.Facet;
|
||||
import com.wordnik.client.model.Example;
|
||||
public class ExampleSearchResults {
|
||||
@JsonProperty("facets")
|
||||
private List<Facet> facets = new ArrayList<Facet>();
|
||||
@JsonProperty("examples")
|
||||
private List<Example> examples = new ArrayList<Example>();
|
||||
public List<Facet> getFacets() {
|
||||
return facets;
|
||||
}
|
||||
public void setFacets(List<Facet> facets) {
|
||||
this.facets = facets;
|
||||
}
|
||||
|
||||
public List<Example> getExamples() {
|
||||
return examples;
|
||||
}
|
||||
public void setExamples(List<Example> examples) {
|
||||
this.examples = examples;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ExampleSearchResults {\n");
|
||||
sb.append(" facets: ").append(facets).append("\n");
|
||||
sb.append(" examples: ").append(examples).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class ExampleUsage {
|
||||
@JsonProperty("text")
|
||||
private String text = null;
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ExampleUsage {\n");
|
||||
sb.append(" text: ").append(text).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.*;
|
||||
import com.wordnik.client.model.FacetValue;
|
||||
public class Facet {
|
||||
@JsonProperty("facetValues")
|
||||
private List<FacetValue> facetValues = new ArrayList<FacetValue>();
|
||||
@JsonProperty("name")
|
||||
private String name = null;
|
||||
public List<FacetValue> getFacetValues() {
|
||||
return facetValues;
|
||||
}
|
||||
public void setFacetValues(List<FacetValue> facetValues) {
|
||||
this.facetValues = facetValues;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Facet {\n");
|
||||
sb.append(" facetValues: ").append(facetValues).append("\n");
|
||||
sb.append(" name: ").append(name).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class FacetValue {
|
||||
@JsonProperty("count")
|
||||
private Long count = null;
|
||||
@JsonProperty("value")
|
||||
private String value = null;
|
||||
public Long getCount() {
|
||||
return count;
|
||||
}
|
||||
public void setCount(Long count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class FacetValue {\n");
|
||||
sb.append(" count: ").append(count).append("\n");
|
||||
sb.append(" value: ").append(value).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class Frequency {
|
||||
@JsonProperty("count")
|
||||
private Long count = null;
|
||||
@JsonProperty("year")
|
||||
private Integer year = null;
|
||||
public Long getCount() {
|
||||
return count;
|
||||
}
|
||||
public void setCount(Long count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public Integer getYear() {
|
||||
return year;
|
||||
}
|
||||
public void setYear(Integer year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Frequency {\n");
|
||||
sb.append(" count: ").append(count).append("\n");
|
||||
sb.append(" year: ").append(year).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,66 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.*;
|
||||
import com.wordnik.client.model.Frequency;
|
||||
public class FrequencySummary {
|
||||
@JsonProperty("unknownYearCount")
|
||||
private Integer unknownYearCount = null;
|
||||
@JsonProperty("totalCount")
|
||||
private Long totalCount = null;
|
||||
@JsonProperty("frequencyString")
|
||||
private String frequencyString = null;
|
||||
@JsonProperty("word")
|
||||
private String word = null;
|
||||
@JsonProperty("frequency")
|
||||
private List<Frequency> frequency = new ArrayList<Frequency>();
|
||||
public Integer getUnknownYearCount() {
|
||||
return unknownYearCount;
|
||||
}
|
||||
public void setUnknownYearCount(Integer unknownYearCount) {
|
||||
this.unknownYearCount = unknownYearCount;
|
||||
}
|
||||
|
||||
public Long getTotalCount() {
|
||||
return totalCount;
|
||||
}
|
||||
public void setTotalCount(Long totalCount) {
|
||||
this.totalCount = totalCount;
|
||||
}
|
||||
|
||||
public String getFrequencyString() {
|
||||
return frequencyString;
|
||||
}
|
||||
public void setFrequencyString(String frequencyString) {
|
||||
this.frequencyString = frequencyString;
|
||||
}
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
|
||||
public List<Frequency> getFrequency() {
|
||||
return frequency;
|
||||
}
|
||||
public void setFrequency(List<Frequency> frequency) {
|
||||
this.frequency = frequency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class FrequencySummary {\n");
|
||||
sb.append(" unknownYearCount: ").append(unknownYearCount).append("\n");
|
||||
sb.append(" totalCount: ").append(totalCount).append("\n");
|
||||
sb.append(" frequencyString: ").append(frequencyString).append("\n");
|
||||
sb.append(" word: ").append(word).append("\n");
|
||||
sb.append(" frequency: ").append(frequency).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class Label {
|
||||
@JsonProperty("text")
|
||||
private String text = null;
|
||||
@JsonProperty("type")
|
||||
private String type = null;
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Label {\n");
|
||||
sb.append(" text: ").append(text).append("\n");
|
||||
sb.append(" type: ").append(type).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.*;
|
||||
public class Note {
|
||||
@JsonProperty("noteType")
|
||||
private String noteType = null;
|
||||
@JsonProperty("appliesTo")
|
||||
private List<String> appliesTo = new ArrayList<String>();
|
||||
@JsonProperty("value")
|
||||
private String value = null;
|
||||
@JsonProperty("pos")
|
||||
private Integer pos = null;
|
||||
public String getNoteType() {
|
||||
return noteType;
|
||||
}
|
||||
public void setNoteType(String noteType) {
|
||||
this.noteType = noteType;
|
||||
}
|
||||
|
||||
public List<String> getAppliesTo() {
|
||||
return appliesTo;
|
||||
}
|
||||
public void setAppliesTo(List<String> appliesTo) {
|
||||
this.appliesTo = appliesTo;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getPos() {
|
||||
return pos;
|
||||
}
|
||||
public void setPos(Integer pos) {
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Note {\n");
|
||||
sb.append(" noteType: ").append(noteType).append("\n");
|
||||
sb.append(" appliesTo: ").append(appliesTo).append("\n");
|
||||
sb.append(" value: ").append(value).append("\n");
|
||||
sb.append(" pos: ").append(pos).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,85 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.*;
|
||||
public class Related {
|
||||
@JsonProperty("label1")
|
||||
private String label1 = null;
|
||||
@JsonProperty("relationshipType")
|
||||
private String relationshipType = null;
|
||||
@JsonProperty("label2")
|
||||
private String label2 = null;
|
||||
@JsonProperty("label3")
|
||||
private String label3 = null;
|
||||
@JsonProperty("words")
|
||||
private List<String> words = new ArrayList<String>();
|
||||
@JsonProperty("gram")
|
||||
private String gram = null;
|
||||
@JsonProperty("label4")
|
||||
private String label4 = null;
|
||||
public String getLabel1() {
|
||||
return label1;
|
||||
}
|
||||
public void setLabel1(String label1) {
|
||||
this.label1 = label1;
|
||||
}
|
||||
|
||||
public String getRelationshipType() {
|
||||
return relationshipType;
|
||||
}
|
||||
public void setRelationshipType(String relationshipType) {
|
||||
this.relationshipType = relationshipType;
|
||||
}
|
||||
|
||||
public String getLabel2() {
|
||||
return label2;
|
||||
}
|
||||
public void setLabel2(String label2) {
|
||||
this.label2 = label2;
|
||||
}
|
||||
|
||||
public String getLabel3() {
|
||||
return label3;
|
||||
}
|
||||
public void setLabel3(String label3) {
|
||||
this.label3 = label3;
|
||||
}
|
||||
|
||||
public List<String> getWords() {
|
||||
return words;
|
||||
}
|
||||
public void setWords(List<String> words) {
|
||||
this.words = words;
|
||||
}
|
||||
|
||||
public String getGram() {
|
||||
return gram;
|
||||
}
|
||||
public void setGram(String gram) {
|
||||
this.gram = gram;
|
||||
}
|
||||
|
||||
public String getLabel4() {
|
||||
return label4;
|
||||
}
|
||||
public void setLabel4(String label4) {
|
||||
this.label4 = label4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Related {\n");
|
||||
sb.append(" label1: ").append(label1).append("\n");
|
||||
sb.append(" relationshipType: ").append(relationshipType).append("\n");
|
||||
sb.append(" label2: ").append(label2).append("\n");
|
||||
sb.append(" label3: ").append(label3).append("\n");
|
||||
sb.append(" words: ").append(words).append("\n");
|
||||
sb.append(" gram: ").append(gram).append("\n");
|
||||
sb.append(" label4: ").append(label4).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,124 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class ScoredWord {
|
||||
@JsonProperty("position")
|
||||
private Integer position = null;
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
@JsonProperty("docTermCount")
|
||||
private Integer docTermCount = null;
|
||||
@JsonProperty("lemma")
|
||||
private String lemma = null;
|
||||
@JsonProperty("wordType")
|
||||
private String wordType = null;
|
||||
@JsonProperty("score")
|
||||
private Float score = null;
|
||||
@JsonProperty("sentenceId")
|
||||
private Long sentenceId = null;
|
||||
@JsonProperty("word")
|
||||
private String word = null;
|
||||
@JsonProperty("stopword")
|
||||
private Boolean stopword = null;
|
||||
@JsonProperty("baseWordScore")
|
||||
private Double baseWordScore = null;
|
||||
@JsonProperty("partOfSpeech")
|
||||
private String partOfSpeech = null;
|
||||
public Integer getPosition() {
|
||||
return position;
|
||||
}
|
||||
public void setPosition(Integer position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getDocTermCount() {
|
||||
return docTermCount;
|
||||
}
|
||||
public void setDocTermCount(Integer docTermCount) {
|
||||
this.docTermCount = docTermCount;
|
||||
}
|
||||
|
||||
public String getLemma() {
|
||||
return lemma;
|
||||
}
|
||||
public void setLemma(String lemma) {
|
||||
this.lemma = lemma;
|
||||
}
|
||||
|
||||
public String getWordType() {
|
||||
return wordType;
|
||||
}
|
||||
public void setWordType(String wordType) {
|
||||
this.wordType = wordType;
|
||||
}
|
||||
|
||||
public Float getScore() {
|
||||
return score;
|
||||
}
|
||||
public void setScore(Float score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public Long getSentenceId() {
|
||||
return sentenceId;
|
||||
}
|
||||
public void setSentenceId(Long sentenceId) {
|
||||
this.sentenceId = sentenceId;
|
||||
}
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
|
||||
public Boolean getStopword() {
|
||||
return stopword;
|
||||
}
|
||||
public void setStopword(Boolean stopword) {
|
||||
this.stopword = stopword;
|
||||
}
|
||||
|
||||
public Double getBaseWordScore() {
|
||||
return baseWordScore;
|
||||
}
|
||||
public void setBaseWordScore(Double baseWordScore) {
|
||||
this.baseWordScore = baseWordScore;
|
||||
}
|
||||
|
||||
public String getPartOfSpeech() {
|
||||
return partOfSpeech;
|
||||
}
|
||||
public void setPartOfSpeech(String partOfSpeech) {
|
||||
this.partOfSpeech = partOfSpeech;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ScoredWord {\n");
|
||||
sb.append(" position: ").append(position).append("\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" docTermCount: ").append(docTermCount).append("\n");
|
||||
sb.append(" lemma: ").append(lemma).append("\n");
|
||||
sb.append(" wordType: ").append(wordType).append("\n");
|
||||
sb.append(" score: ").append(score).append("\n");
|
||||
sb.append(" sentenceId: ").append(sentenceId).append("\n");
|
||||
sb.append(" word: ").append(word).append("\n");
|
||||
sb.append(" stopword: ").append(stopword).append("\n");
|
||||
sb.append(" baseWordScore: ").append(baseWordScore).append("\n");
|
||||
sb.append(" partOfSpeech: ").append(partOfSpeech).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class ScrabbleScoreResult {
|
||||
@JsonProperty("value")
|
||||
private Integer value = null;
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
public void setValue(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ScrabbleScoreResult {\n");
|
||||
sb.append(" value: ").append(value).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,76 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.*;
|
||||
import com.wordnik.client.model.ScoredWord;
|
||||
public class Sentence {
|
||||
@JsonProperty("hasScoredWords")
|
||||
private Boolean hasScoredWords = null;
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
@JsonProperty("scoredWords")
|
||||
private List<ScoredWord> scoredWords = new ArrayList<ScoredWord>();
|
||||
@JsonProperty("display")
|
||||
private String display = null;
|
||||
@JsonProperty("rating")
|
||||
private Integer rating = null;
|
||||
@JsonProperty("documentMetadataId")
|
||||
private Long documentMetadataId = null;
|
||||
public Boolean getHasScoredWords() {
|
||||
return hasScoredWords;
|
||||
}
|
||||
public void setHasScoredWords(Boolean hasScoredWords) {
|
||||
this.hasScoredWords = hasScoredWords;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public List<ScoredWord> getScoredWords() {
|
||||
return scoredWords;
|
||||
}
|
||||
public void setScoredWords(List<ScoredWord> scoredWords) {
|
||||
this.scoredWords = scoredWords;
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
return display;
|
||||
}
|
||||
public void setDisplay(String display) {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public Integer getRating() {
|
||||
return rating;
|
||||
}
|
||||
public void setRating(Integer rating) {
|
||||
this.rating = rating;
|
||||
}
|
||||
|
||||
public Long getDocumentMetadataId() {
|
||||
return documentMetadataId;
|
||||
}
|
||||
public void setDocumentMetadataId(Long documentMetadataId) {
|
||||
this.documentMetadataId = documentMetadataId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Sentence {\n");
|
||||
sb.append(" hasScoredWords: ").append(hasScoredWords).append("\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" scoredWords: ").append(scoredWords).append("\n");
|
||||
sb.append(" display: ").append(display).append("\n");
|
||||
sb.append(" rating: ").append(rating).append("\n");
|
||||
sb.append(" documentMetadataId: ").append(documentMetadataId).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class SimpleDefinition {
|
||||
@JsonProperty("text")
|
||||
private String text = null;
|
||||
@JsonProperty("source")
|
||||
private String source = null;
|
||||
@JsonProperty("note")
|
||||
private String note = null;
|
||||
@JsonProperty("partOfSpeech")
|
||||
private String partOfSpeech = null;
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public String getPartOfSpeech() {
|
||||
return partOfSpeech;
|
||||
}
|
||||
public void setPartOfSpeech(String partOfSpeech) {
|
||||
this.partOfSpeech = partOfSpeech;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class SimpleDefinition {\n");
|
||||
sb.append(" text: ").append(text).append("\n");
|
||||
sb.append(" source: ").append(source).append("\n");
|
||||
sb.append(" note: ").append(note).append("\n");
|
||||
sb.append(" partOfSpeech: ").append(partOfSpeech).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class SimpleExample {
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
@JsonProperty("title")
|
||||
private String title = null;
|
||||
@JsonProperty("text")
|
||||
private String text = null;
|
||||
@JsonProperty("url")
|
||||
private String url = null;
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class SimpleExample {\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" title: ").append(title).append("\n");
|
||||
sb.append(" text: ").append(text).append("\n");
|
||||
sb.append(" url: ").append(url).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class StringValue {
|
||||
@JsonProperty("word")
|
||||
private String word = null;
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class StringValue {\n");
|
||||
sb.append(" word: ").append(word).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class Syllable {
|
||||
@JsonProperty("text")
|
||||
private String text = null;
|
||||
@JsonProperty("seq")
|
||||
private Integer seq = null;
|
||||
@JsonProperty("type")
|
||||
private String type = null;
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Integer getSeq() {
|
||||
return seq;
|
||||
}
|
||||
public void setSeq(Integer seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Syllable {\n");
|
||||
sb.append(" text: ").append(text).append("\n");
|
||||
sb.append(" seq: ").append(seq).append("\n");
|
||||
sb.append(" type: ").append(type).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class TextPron {
|
||||
@JsonProperty("raw")
|
||||
private String raw = null;
|
||||
@JsonProperty("seq")
|
||||
private Integer seq = null;
|
||||
@JsonProperty("rawType")
|
||||
private String rawType = null;
|
||||
public String getRaw() {
|
||||
return raw;
|
||||
}
|
||||
public void setRaw(String raw) {
|
||||
this.raw = raw;
|
||||
}
|
||||
|
||||
public Integer getSeq() {
|
||||
return seq;
|
||||
}
|
||||
public void setSeq(Integer seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public String getRawType() {
|
||||
return rawType;
|
||||
}
|
||||
public void setRawType(String rawType) {
|
||||
this.rawType = rawType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class TextPron {\n");
|
||||
sb.append(" raw: ").append(raw).append("\n");
|
||||
sb.append(" seq: ").append(seq).append("\n");
|
||||
sb.append(" rawType: ").append(rawType).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,94 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class User {
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
@JsonProperty("username")
|
||||
private String username = null;
|
||||
@JsonProperty("email")
|
||||
private String email = null;
|
||||
@JsonProperty("status")
|
||||
private Integer status = null;
|
||||
@JsonProperty("faceBookId")
|
||||
private String faceBookId = null;
|
||||
@JsonProperty("userName")
|
||||
private String userName = null;
|
||||
@JsonProperty("displayName")
|
||||
private String displayName = null;
|
||||
@JsonProperty("password")
|
||||
private String password = null;
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getFaceBookId() {
|
||||
return faceBookId;
|
||||
}
|
||||
public void setFaceBookId(String faceBookId) {
|
||||
this.faceBookId = faceBookId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class User {\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" username: ").append(username).append("\n");
|
||||
sb.append(" email: ").append(email).append("\n");
|
||||
sb.append(" status: ").append(status).append("\n");
|
||||
sb.append(" faceBookId: ").append(faceBookId).append("\n");
|
||||
sb.append(" userName: ").append(userName).append("\n");
|
||||
sb.append(" displayName: ").append(displayName).append("\n");
|
||||
sb.append(" password: ").append(password).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,125 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.Date;
|
||||
public class WordList {
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
@JsonProperty("permalink")
|
||||
private String permalink = null;
|
||||
@JsonProperty("name")
|
||||
private String name = null;
|
||||
@JsonProperty("createdAt")
|
||||
private Date createdAt = null;
|
||||
@JsonProperty("updatedAt")
|
||||
private Date updatedAt = null;
|
||||
@JsonProperty("lastActivityAt")
|
||||
private Date lastActivityAt = null;
|
||||
@JsonProperty("username")
|
||||
private String username = null;
|
||||
@JsonProperty("userId")
|
||||
private Long userId = null;
|
||||
@JsonProperty("description")
|
||||
private String description = null;
|
||||
@JsonProperty("numberWordsInList")
|
||||
private Long numberWordsInList = null;
|
||||
@JsonProperty("type")
|
||||
private String type = null;
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPermalink() {
|
||||
return permalink;
|
||||
}
|
||||
public void setPermalink(String permalink) {
|
||||
this.permalink = permalink;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
public void setCreatedAt(Date createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Date getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
public void setUpdatedAt(Date updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public Date getLastActivityAt() {
|
||||
return lastActivityAt;
|
||||
}
|
||||
public void setLastActivityAt(Date lastActivityAt) {
|
||||
this.lastActivityAt = lastActivityAt;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Long getNumberWordsInList() {
|
||||
return numberWordsInList;
|
||||
}
|
||||
public void setNumberWordsInList(Long numberWordsInList) {
|
||||
this.numberWordsInList = numberWordsInList;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class WordList {\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" permalink: ").append(permalink).append("\n");
|
||||
sb.append(" name: ").append(name).append("\n");
|
||||
sb.append(" createdAt: ").append(createdAt).append("\n");
|
||||
sb.append(" updatedAt: ").append(updatedAt).append("\n");
|
||||
sb.append(" lastActivityAt: ").append(lastActivityAt).append("\n");
|
||||
sb.append(" username: ").append(username).append("\n");
|
||||
sb.append(" userId: ").append(userId).append("\n");
|
||||
sb.append(" description: ").append(description).append("\n");
|
||||
sb.append(" numberWordsInList: ").append(numberWordsInList).append("\n");
|
||||
sb.append(" type: ").append(type).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,85 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.Date;
|
||||
public class WordListWord {
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
@JsonProperty("word")
|
||||
private String word = null;
|
||||
@JsonProperty("username")
|
||||
private String username = null;
|
||||
@JsonProperty("userId")
|
||||
private Long userId = null;
|
||||
@JsonProperty("createdAt")
|
||||
private Date createdAt = null;
|
||||
@JsonProperty("numberCommentsOnWord")
|
||||
private Long numberCommentsOnWord = null;
|
||||
@JsonProperty("numberLists")
|
||||
private Long numberLists = null;
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
public void setCreatedAt(Date createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Long getNumberCommentsOnWord() {
|
||||
return numberCommentsOnWord;
|
||||
}
|
||||
public void setNumberCommentsOnWord(Long numberCommentsOnWord) {
|
||||
this.numberCommentsOnWord = numberCommentsOnWord;
|
||||
}
|
||||
|
||||
public Long getNumberLists() {
|
||||
return numberLists;
|
||||
}
|
||||
public void setNumberLists(Long numberLists) {
|
||||
this.numberLists = numberLists;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class WordListWord {\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" word: ").append(word).append("\n");
|
||||
sb.append(" username: ").append(username).append("\n");
|
||||
sb.append(" userId: ").append(userId).append("\n");
|
||||
sb.append(" createdAt: ").append(createdAt).append("\n");
|
||||
sb.append(" numberCommentsOnWord: ").append(numberCommentsOnWord).append("\n");
|
||||
sb.append(" numberLists: ").append(numberLists).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,75 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.*;
|
||||
public class WordObject {
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
@JsonProperty("word")
|
||||
private String word = null;
|
||||
@JsonProperty("originalWord")
|
||||
private String originalWord = null;
|
||||
@JsonProperty("suggestions")
|
||||
private List<String> suggestions = new ArrayList<String>();
|
||||
@JsonProperty("canonicalForm")
|
||||
private String canonicalForm = null;
|
||||
@JsonProperty("vulgar")
|
||||
private String vulgar = null;
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
|
||||
public String getOriginalWord() {
|
||||
return originalWord;
|
||||
}
|
||||
public void setOriginalWord(String originalWord) {
|
||||
this.originalWord = originalWord;
|
||||
}
|
||||
|
||||
public List<String> getSuggestions() {
|
||||
return suggestions;
|
||||
}
|
||||
public void setSuggestions(List<String> suggestions) {
|
||||
this.suggestions = suggestions;
|
||||
}
|
||||
|
||||
public String getCanonicalForm() {
|
||||
return canonicalForm;
|
||||
}
|
||||
public void setCanonicalForm(String canonicalForm) {
|
||||
this.canonicalForm = canonicalForm;
|
||||
}
|
||||
|
||||
public String getVulgar() {
|
||||
return vulgar;
|
||||
}
|
||||
public void setVulgar(String vulgar) {
|
||||
this.vulgar = vulgar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class WordObject {\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" word: ").append(word).append("\n");
|
||||
sb.append(" originalWord: ").append(originalWord).append("\n");
|
||||
sb.append(" suggestions: ").append(suggestions).append("\n");
|
||||
sb.append(" canonicalForm: ").append(canonicalForm).append("\n");
|
||||
sb.append(" vulgar: ").append(vulgar).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,139 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.*;
|
||||
import com.wordnik.client.model.SimpleExample;
|
||||
import com.wordnik.client.model.SimpleDefinition;
|
||||
import com.wordnik.client.model.ContentProvider;
|
||||
public class WordOfTheDay {
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
@JsonProperty("parentId")
|
||||
private String parentId = null;
|
||||
@JsonProperty("category")
|
||||
private String category = null;
|
||||
@JsonProperty("createdBy")
|
||||
private String createdBy = null;
|
||||
@JsonProperty("createdAt")
|
||||
private Date createdAt = null;
|
||||
@JsonProperty("contentProvider")
|
||||
private ContentProvider contentProvider = null;
|
||||
@JsonProperty("htmlExtra")
|
||||
private String htmlExtra = null;
|
||||
@JsonProperty("word")
|
||||
private String word = null;
|
||||
@JsonProperty("definitions")
|
||||
private List<SimpleDefinition> definitions = new ArrayList<SimpleDefinition>();
|
||||
@JsonProperty("examples")
|
||||
private List<SimpleExample> examples = new ArrayList<SimpleExample>();
|
||||
@JsonProperty("note")
|
||||
private String note = null;
|
||||
@JsonProperty("publishDate")
|
||||
private Date publishDate = null;
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
public void setCreatedAt(Date createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public ContentProvider getContentProvider() {
|
||||
return contentProvider;
|
||||
}
|
||||
public void setContentProvider(ContentProvider contentProvider) {
|
||||
this.contentProvider = contentProvider;
|
||||
}
|
||||
|
||||
public String getHtmlExtra() {
|
||||
return htmlExtra;
|
||||
}
|
||||
public void setHtmlExtra(String htmlExtra) {
|
||||
this.htmlExtra = htmlExtra;
|
||||
}
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
|
||||
public List<SimpleDefinition> getDefinitions() {
|
||||
return definitions;
|
||||
}
|
||||
public void setDefinitions(List<SimpleDefinition> definitions) {
|
||||
this.definitions = definitions;
|
||||
}
|
||||
|
||||
public List<SimpleExample> getExamples() {
|
||||
return examples;
|
||||
}
|
||||
public void setExamples(List<SimpleExample> examples) {
|
||||
this.examples = examples;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public Date getPublishDate() {
|
||||
return publishDate;
|
||||
}
|
||||
public void setPublishDate(Date publishDate) {
|
||||
this.publishDate = publishDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class WordOfTheDay {\n");
|
||||
sb.append(" id: ").append(id).append("\n");
|
||||
sb.append(" parentId: ").append(parentId).append("\n");
|
||||
sb.append(" category: ").append(category).append("\n");
|
||||
sb.append(" createdBy: ").append(createdBy).append("\n");
|
||||
sb.append(" createdAt: ").append(createdAt).append("\n");
|
||||
sb.append(" contentProvider: ").append(contentProvider).append("\n");
|
||||
sb.append(" htmlExtra: ").append(htmlExtra).append("\n");
|
||||
sb.append(" word: ").append(word).append("\n");
|
||||
sb.append(" definitions: ").append(definitions).append("\n");
|
||||
sb.append(" examples: ").append(examples).append("\n");
|
||||
sb.append(" note: ").append(note).append("\n");
|
||||
sb.append(" publishDate: ").append(publishDate).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class WordSearchResult {
|
||||
@JsonProperty("count")
|
||||
private Long count = null;
|
||||
@JsonProperty("lexicality")
|
||||
private Double lexicality = null;
|
||||
@JsonProperty("word")
|
||||
private String word = null;
|
||||
public Long getCount() {
|
||||
return count;
|
||||
}
|
||||
public void setCount(Long count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public Double getLexicality() {
|
||||
return lexicality;
|
||||
}
|
||||
public void setLexicality(Double lexicality) {
|
||||
this.lexicality = lexicality;
|
||||
}
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class WordSearchResult {\n");
|
||||
sb.append(" count: ").append(count).append("\n");
|
||||
sb.append(" lexicality: ").append(lexicality).append("\n");
|
||||
sb.append(" word: ").append(word).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
package com.wordnik.client.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.*;
|
||||
import com.wordnik.client.model.WordSearchResult;
|
||||
public class WordSearchResults {
|
||||
@JsonProperty("searchResults")
|
||||
private List<WordSearchResult> searchResults = new ArrayList<WordSearchResult>();
|
||||
@JsonProperty("totalResults")
|
||||
private Integer totalResults = null;
|
||||
public List<WordSearchResult> getSearchResults() {
|
||||
return searchResults;
|
||||
}
|
||||
public void setSearchResults(List<WordSearchResult> searchResults) {
|
||||
this.searchResults = searchResults;
|
||||
}
|
||||
|
||||
public Integer getTotalResults() {
|
||||
return totalResults;
|
||||
}
|
||||
public void setTotalResults(Integer totalResults) {
|
||||
this.totalResults = totalResults;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class WordSearchResults {\n");
|
||||
sb.append(" searchResults: ").append(searchResults).append("\n");
|
||||
sb.append(" totalResults: ").append(totalResults).append("\n");
|
||||
sb.append("}\n");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,16 @@ This library is built using the Wordnik [Swagger](http://swagger.wordnik.com) cl
|
||||
can re-generate this library by running ./bin/java-wordnik-api.sh from the swagger-codegen project
|
||||
|
||||
## Usage
|
||||
Generate the client library with Maven:
|
||||
You can use maven central to add this library to your current project:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.wordnik</groupId>
|
||||
<artifactId>wordnik-java-client</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
```
|
||||
or you can pull the source and re-generate the client library with Maven:
|
||||
|
||||
```
|
||||
mvn package
|
||||
|
@ -25,6 +25,10 @@ public class AccountApi {
|
||||
}
|
||||
|
||||
public AuthenticationToken authenticate (String username, String password) throws ApiException {
|
||||
// verify required params are set
|
||||
if(username == null || password == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/account.{format}/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
|
||||
|
||||
@ -32,10 +36,6 @@ public class AccountApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(username == null || password == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(password)))
|
||||
queryParams.put("password", String.valueOf(password));
|
||||
String contentType = "application/json";
|
||||
@ -58,6 +58,10 @@ public class AccountApi {
|
||||
}
|
||||
}
|
||||
public AuthenticationToken authenticatePost (String username, String body) throws ApiException {
|
||||
// verify required params are set
|
||||
if(username == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/account.{format}/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
|
||||
|
||||
@ -65,10 +69,6 @@ public class AccountApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(username == null || body == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
@ -89,6 +89,10 @@ public class AccountApi {
|
||||
}
|
||||
}
|
||||
public List<WordList> getWordListsForLoggedInUser (String auth_token, Integer skip, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/account.{format}/wordLists".replaceAll("\\{format\\}","json");
|
||||
|
||||
@ -96,10 +100,6 @@ public class AccountApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(skip)))
|
||||
queryParams.put("skip", String.valueOf(skip));
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
@ -153,6 +153,10 @@ public class AccountApi {
|
||||
}
|
||||
}
|
||||
public User getLoggedInUser (String auth_token) throws ApiException {
|
||||
// verify required params are set
|
||||
if(auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/account.{format}/user".replaceAll("\\{format\\}","json");
|
||||
|
||||
@ -160,10 +164,6 @@ public class AccountApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
|
@ -32,6 +32,10 @@ public class WordApi {
|
||||
}
|
||||
|
||||
public ExampleSearchResults getExamples (String word, String includeDuplicates, String useCanonical, Integer skip, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/examples".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
@ -39,10 +43,6 @@ public class WordApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(includeDuplicates)))
|
||||
queryParams.put("includeDuplicates", String.valueOf(includeDuplicates));
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
@ -71,6 +71,10 @@ public class WordApi {
|
||||
}
|
||||
}
|
||||
public WordObject getWord (String word, String useCanonical, String includeSuggestions) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
@ -78,10 +82,6 @@ public class WordApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
if(!"null".equals(String.valueOf(includeSuggestions)))
|
||||
@ -106,6 +106,10 @@ public class WordApi {
|
||||
}
|
||||
}
|
||||
public List<Definition> getDefinitions (String word, String partOfSpeech, String sourceDictionaries, Integer limit, String includeRelated, String useCanonical, String includeTags) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/definitions".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
@ -113,10 +117,6 @@ public class WordApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
queryParams.put("limit", String.valueOf(limit));
|
||||
if(!"null".equals(String.valueOf(partOfSpeech)))
|
||||
@ -149,6 +149,10 @@ public class WordApi {
|
||||
}
|
||||
}
|
||||
public Example getTopExample (String word, String useCanonical) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/topExample".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
@ -156,10 +160,6 @@ public class WordApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
String contentType = "application/json";
|
||||
@ -182,6 +182,10 @@ public class WordApi {
|
||||
}
|
||||
}
|
||||
public List<Related> getRelatedWords (String word, String relationshipTypes, String useCanonical, Integer limitPerRelationshipType) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/relatedWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
@ -189,10 +193,6 @@ public class WordApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
if(!"null".equals(String.valueOf(relationshipTypes)))
|
||||
@ -219,6 +219,10 @@ public class WordApi {
|
||||
}
|
||||
}
|
||||
public List<TextPron> getTextPronunciations (String word, String sourceDictionary, String typeFormat, String useCanonical, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/pronunciations".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
@ -226,10 +230,6 @@ public class WordApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
if(!"null".equals(String.valueOf(sourceDictionary)))
|
||||
@ -258,6 +258,10 @@ public class WordApi {
|
||||
}
|
||||
}
|
||||
public List<Syllable> getHyphenation (String word, String sourceDictionary, String useCanonical, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/hyphenation".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
@ -265,10 +269,6 @@ public class WordApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
if(!"null".equals(String.valueOf(sourceDictionary)))
|
||||
@ -295,6 +295,10 @@ public class WordApi {
|
||||
}
|
||||
}
|
||||
public FrequencySummary getWordFrequency (String word, String useCanonical, Integer startYear, Integer endYear) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/frequency".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
@ -302,10 +306,6 @@ public class WordApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
if(!"null".equals(String.valueOf(startYear)))
|
||||
@ -332,6 +332,10 @@ public class WordApi {
|
||||
}
|
||||
}
|
||||
public List<Bigram> getPhrases (String word, Integer limit, Integer wlmi, String useCanonical) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/phrases".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
@ -339,10 +343,6 @@ public class WordApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
queryParams.put("limit", String.valueOf(limit));
|
||||
if(!"null".equals(String.valueOf(wlmi)))
|
||||
@ -369,6 +369,10 @@ public class WordApi {
|
||||
}
|
||||
}
|
||||
public List<String> getEtymologies (String word, String useCanonical) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/etymologies".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
@ -376,10 +380,6 @@ public class WordApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
String contentType = "application/json";
|
||||
@ -402,6 +402,10 @@ public class WordApi {
|
||||
}
|
||||
}
|
||||
public List<AudioFile> getAudio (String word, String useCanonical, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/audio".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
@ -409,10 +413,6 @@ public class WordApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(useCanonical)))
|
||||
queryParams.put("useCanonical", String.valueOf(useCanonical));
|
||||
if(!"null".equals(String.valueOf(limit)))
|
||||
@ -437,6 +437,10 @@ public class WordApi {
|
||||
}
|
||||
}
|
||||
public ScrabbleScoreResult getScrabbleScore (String word) throws ApiException {
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/word.{format}/{word}/scrabbleScore".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
|
||||
|
||||
@ -444,10 +448,6 @@ public class WordApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(word == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
String contentType = "application/json";
|
||||
|
||||
try {
|
||||
|
@ -24,6 +24,10 @@ public class WordListApi {
|
||||
}
|
||||
|
||||
public void updateWordList (String permalink, WordList body, String auth_token) throws ApiException {
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
|
||||
|
||||
@ -31,10 +35,6 @@ public class WordListApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
@ -56,6 +56,10 @@ public class WordListApi {
|
||||
}
|
||||
}
|
||||
public void deleteWordList (String permalink, String auth_token) throws ApiException {
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
|
||||
|
||||
@ -63,10 +67,6 @@ public class WordListApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
@ -88,6 +88,10 @@ public class WordListApi {
|
||||
}
|
||||
}
|
||||
public WordList getWordListByPermalink (String permalink, String auth_token) throws ApiException {
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
|
||||
|
||||
@ -95,10 +99,6 @@ public class WordListApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
@ -120,6 +120,10 @@ public class WordListApi {
|
||||
}
|
||||
}
|
||||
public void addWordsToWordList (String permalink, List<StringValue> body, String auth_token) throws ApiException {
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/wordList.{format}/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
|
||||
|
||||
@ -127,10 +131,6 @@ public class WordListApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
@ -152,6 +152,10 @@ public class WordListApi {
|
||||
}
|
||||
}
|
||||
public List<WordListWord> getWordListWords (String permalink, String auth_token, String sortBy, String sortOrder, Integer skip, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/wordList.{format}/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
|
||||
|
||||
@ -159,10 +163,6 @@ public class WordListApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(sortBy)))
|
||||
queryParams.put("sortBy", String.valueOf(sortBy));
|
||||
if(!"null".equals(String.valueOf(sortOrder)))
|
||||
@ -192,6 +192,10 @@ public class WordListApi {
|
||||
}
|
||||
}
|
||||
public void deleteWordsFromWordList (String permalink, List<StringValue> body, String auth_token) throws ApiException {
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/wordList.{format}/{permalink}/deleteWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString()));
|
||||
|
||||
@ -199,10 +203,6 @@ public class WordListApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(permalink == null || auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
|
@ -22,6 +22,10 @@ public class WordListsApi {
|
||||
}
|
||||
|
||||
public WordList createWordList (WordList body, String auth_token) throws ApiException {
|
||||
// verify required params are set
|
||||
if(auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/wordLists.{format}".replaceAll("\\{format\\}","json");
|
||||
|
||||
@ -29,10 +33,6 @@ public class WordListsApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(auth_token == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
headerParams.put("auth_token", auth_token);
|
||||
String contentType = "application/json";
|
||||
|
||||
|
@ -25,6 +25,10 @@ public class WordsApi {
|
||||
}
|
||||
|
||||
public WordSearchResults searchWords (String query, String includePartOfSpeech, String excludePartOfSpeech, String caseSensitive, Integer minCorpusCount, Integer maxCorpusCount, Integer minDictionaryCount, Integer maxDictionaryCount, Integer minLength, Integer maxLength, Integer skip, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(query == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/words.{format}/search/{query}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "query" + "\\}", apiInvoker.escapeString(query.toString()));
|
||||
|
||||
@ -32,10 +36,6 @@ public class WordsApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(query == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(caseSensitive)))
|
||||
queryParams.put("caseSensitive", String.valueOf(caseSensitive));
|
||||
if(!"null".equals(String.valueOf(includePartOfSpeech)))
|
||||
@ -107,6 +107,10 @@ public class WordsApi {
|
||||
}
|
||||
}
|
||||
public DefinitionSearchResults reverseDictionary (String query, String findSenseForWord, String includeSourceDictionaries, String excludeSourceDictionaries, String includePartOfSpeech, String excludePartOfSpeech, String expandTerms, String sortBy, String sortOrder, Integer minCorpusCount, Integer maxCorpusCount, Integer minLength, Integer maxLength, String includeTags, String skip, Integer limit) throws ApiException {
|
||||
// verify required params are set
|
||||
if(query == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
// create path and map variables
|
||||
String path = "/words.{format}/reverseDictionary".replaceAll("\\{format\\}","json");
|
||||
|
||||
@ -114,10 +118,6 @@ public class WordsApi {
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
|
||||
// verify required params are set
|
||||
if(query == null ) {
|
||||
throw new ApiException(400, "missing required params");
|
||||
}
|
||||
if(!"null".equals(String.valueOf(query)))
|
||||
queryParams.put("query", String.valueOf(query));
|
||||
if(!"null".equals(String.valueOf(findSenseForWord)))
|
||||
|
@ -12,6 +12,7 @@ import com.sun.jersey.api.client.config.DefaultClientConfig;
|
||||
import com.sun.jersey.api.client.filter.LoggingFilter;
|
||||
import com.sun.jersey.api.client.WebResource.Builder;
|
||||
|
||||
import javax.ws.rs.core.Response.Status.Family;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import java.util.Map;
|
||||
@ -123,7 +124,7 @@ public class ApiInvoker {
|
||||
else {
|
||||
throw new ApiException(500, "unknown method type " + method);
|
||||
}
|
||||
if(response.getClientResponseStatus() == ClientResponse.Status.OK) {
|
||||
if(response.getClientResponseStatus().getFamily() == Family.SUCCESSFUL) {
|
||||
return (String) response.getEntity(String.class);
|
||||
}
|
||||
else {
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.wordnik.client.api
|
||||
|
||||
import com.wordnik.client.model.ApiTokenStatus
|
||||
import com.wordnik.client.model.WordList
|
||||
import com.wordnik.client.model.User
|
||||
import com.wordnik.client.model.WordList
|
||||
import com.wordnik.client.model.ApiTokenStatus
|
||||
import com.wordnik.client.model.AuthenticationToken
|
||||
import com.wordnik.client.common.ApiInvoker
|
||||
import com.wordnik.client.common.ApiException
|
||||
|
@ -1,16 +1,16 @@
|
||||
package com.wordnik.client.api
|
||||
|
||||
import com.wordnik.client.model.Definition
|
||||
import com.wordnik.client.model.FrequencySummary
|
||||
import com.wordnik.client.model.Bigram
|
||||
import com.wordnik.client.model.WordObject
|
||||
import com.wordnik.client.model.ExampleSearchResults
|
||||
import com.wordnik.client.model.Example
|
||||
import com.wordnik.client.model.ScrabbleScoreResult
|
||||
import com.wordnik.client.model.TextPron
|
||||
import com.wordnik.client.model.Example
|
||||
import com.wordnik.client.model.Syllable
|
||||
import com.wordnik.client.model.AudioFile
|
||||
import com.wordnik.client.model.ExampleSearchResults
|
||||
import com.wordnik.client.model.WordObject
|
||||
import com.wordnik.client.model.Bigram
|
||||
import com.wordnik.client.model.Related
|
||||
import com.wordnik.client.model.FrequencySummary
|
||||
import com.wordnik.client.model.Definition
|
||||
import com.wordnik.client.model.AudioFile
|
||||
import com.wordnik.client.common.ApiInvoker
|
||||
import com.wordnik.client.common.ApiException
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.wordnik.client.api
|
||||
|
||||
import com.wordnik.client.model.WordListWord
|
||||
import com.wordnik.client.model.WordList
|
||||
import com.wordnik.client.model.StringValue
|
||||
import com.wordnik.client.model.WordListWord
|
||||
import com.wordnik.client.common.ApiInvoker
|
||||
import com.wordnik.client.common.ApiException
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.wordnik.client.api
|
||||
|
||||
import com.wordnik.client.model.WordObject
|
||||
import com.wordnik.client.model.DefinitionSearchResults
|
||||
import com.wordnik.client.model.WordObject
|
||||
import com.wordnik.client.model.WordOfTheDay
|
||||
import com.wordnik.client.model.WordSearchResults
|
||||
import com.wordnik.client.common.ApiInvoker
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.wordnik.client.model
|
||||
|
||||
import com.wordnik.client.model.ExampleUsage
|
||||
import com.wordnik.client.model.Note
|
||||
import com.wordnik.client.model.Citation
|
||||
import com.wordnik.client.model.TextPron
|
||||
import com.wordnik.client.model.Label
|
||||
import com.wordnik.client.model.ExampleUsage
|
||||
import com.wordnik.client.model.TextPron
|
||||
import com.wordnik.client.model.Citation
|
||||
import com.wordnik.client.model.Related
|
||||
import com.wordnik.client.model.Note
|
||||
case class Definition (
|
||||
extendedText: String,
|
||||
text: String,
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.wordnik.client.model
|
||||
|
||||
import com.wordnik.client.model.Sentence
|
||||
import com.wordnik.client.model.ScoredWord
|
||||
import com.wordnik.client.model.ContentProvider
|
||||
import com.wordnik.client.model.ScoredWord
|
||||
case class Example (
|
||||
id: Long,
|
||||
exampleId: Long,
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.wordnik.client.model
|
||||
|
||||
import java.util.Date
|
||||
import com.wordnik.client.model.SimpleDefinition
|
||||
import com.wordnik.client.model.SimpleExample
|
||||
import com.wordnik.client.model.SimpleDefinition
|
||||
import com.wordnik.client.model.ContentProvider
|
||||
case class WordOfTheDay (
|
||||
id: Long,
|
||||
|
@ -72,4 +72,4 @@ $(function(){
|
||||
$(window).bind('hashchange', function() {
|
||||
choose(window.location.href.toString());
|
||||
});
|
||||
});
|
||||
});
|
@ -31,66 +31,66 @@
|
||||
</div>
|
||||
<div class="section-box">
|
||||
<div class="section-header">
|
||||
<a href="/#!/WordListsApi">WordListsApi</a>
|
||||
<a href="#!/WordListsApi">WordListsApi</a>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="/#!/WordListsApi#createWordList">createWordList</a></li>
|
||||
<li><a href="#!/WordListsApi#createWordList">createWordList</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section-box">
|
||||
<div class="section-header">
|
||||
<a href="/#!/WordsApi">WordsApi</a>
|
||||
<a href="#!/AccountApi">AccountApi</a>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="/#!/WordsApi#searchWords">searchWords</a></li>
|
||||
<li><a href="/#!/WordsApi#getWordOfTheDay">getWordOfTheDay</a></li>
|
||||
<li><a href="/#!/WordsApi#reverseDictionary">reverseDictionary</a></li>
|
||||
<li><a href="/#!/WordsApi#getRandomWords">getRandomWords</a></li>
|
||||
<li><a href="/#!/WordsApi#getRandomWord">getRandomWord</a></li>
|
||||
<li><a href="#!/AccountApi#authenticate">authenticate</a></li>
|
||||
<li><a href="#!/AccountApi#authenticatePost">authenticatePost</a></li>
|
||||
<li><a href="#!/AccountApi#getWordListsForLoggedInUser">getWordListsForLoggedInUser</a></li>
|
||||
<li><a href="#!/AccountApi#getApiTokenStatus">getApiTokenStatus</a></li>
|
||||
<li><a href="#!/AccountApi#getLoggedInUser">getLoggedInUser</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section-box">
|
||||
<div class="section-header">
|
||||
<a href="/#!/AccountApi">AccountApi</a>
|
||||
<a href="#!/WordListApi">WordListApi</a>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="/#!/AccountApi#authenticate">authenticate</a></li>
|
||||
<li><a href="/#!/AccountApi#authenticatePost">authenticatePost</a></li>
|
||||
<li><a href="/#!/AccountApi#getWordListsForLoggedInUser">getWordListsForLoggedInUser</a></li>
|
||||
<li><a href="/#!/AccountApi#getApiTokenStatus">getApiTokenStatus</a></li>
|
||||
<li><a href="/#!/AccountApi#getLoggedInUser">getLoggedInUser</a></li>
|
||||
<li><a href="#!/WordListApi#updateWordList">updateWordList</a></li>
|
||||
<li><a href="#!/WordListApi#deleteWordList">deleteWordList</a></li>
|
||||
<li><a href="#!/WordListApi#getWordListByPermalink">getWordListByPermalink</a></li>
|
||||
<li><a href="#!/WordListApi#addWordsToWordList">addWordsToWordList</a></li>
|
||||
<li><a href="#!/WordListApi#getWordListWords">getWordListWords</a></li>
|
||||
<li><a href="#!/WordListApi#deleteWordsFromWordList">deleteWordsFromWordList</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section-box">
|
||||
<div class="section-header">
|
||||
<a href="/#!/WordListApi">WordListApi</a>
|
||||
<a href="#!/WordApi">WordApi</a>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="/#!/WordListApi#updateWordList">updateWordList</a></li>
|
||||
<li><a href="/#!/WordListApi#deleteWordList">deleteWordList</a></li>
|
||||
<li><a href="/#!/WordListApi#getWordListByPermalink">getWordListByPermalink</a></li>
|
||||
<li><a href="/#!/WordListApi#addWordsToWordList">addWordsToWordList</a></li>
|
||||
<li><a href="/#!/WordListApi#getWordListWords">getWordListWords</a></li>
|
||||
<li><a href="/#!/WordListApi#deleteWordsFromWordList">deleteWordsFromWordList</a></li>
|
||||
<li><a href="#!/WordApi#getExamples">getExamples</a></li>
|
||||
<li><a href="#!/WordApi#getWord">getWord</a></li>
|
||||
<li><a href="#!/WordApi#getDefinitions">getDefinitions</a></li>
|
||||
<li><a href="#!/WordApi#getTopExample">getTopExample</a></li>
|
||||
<li><a href="#!/WordApi#getRelatedWords">getRelatedWords</a></li>
|
||||
<li><a href="#!/WordApi#getTextPronunciations">getTextPronunciations</a></li>
|
||||
<li><a href="#!/WordApi#getHyphenation">getHyphenation</a></li>
|
||||
<li><a href="#!/WordApi#getWordFrequency">getWordFrequency</a></li>
|
||||
<li><a href="#!/WordApi#getPhrases">getPhrases</a></li>
|
||||
<li><a href="#!/WordApi#getEtymologies">getEtymologies</a></li>
|
||||
<li><a href="#!/WordApi#getAudio">getAudio</a></li>
|
||||
<li><a href="#!/WordApi#getScrabbleScore">getScrabbleScore</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section-box">
|
||||
<div class="section-header">
|
||||
<a href="/#!/WordApi">WordApi</a>
|
||||
<a href="#!/WordsApi">WordsApi</a>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="/#!/WordApi#getExamples">getExamples</a></li>
|
||||
<li><a href="/#!/WordApi#getWord">getWord</a></li>
|
||||
<li><a href="/#!/WordApi#getDefinitions">getDefinitions</a></li>
|
||||
<li><a href="/#!/WordApi#getTopExample">getTopExample</a></li>
|
||||
<li><a href="/#!/WordApi#getRelatedWords">getRelatedWords</a></li>
|
||||
<li><a href="/#!/WordApi#getTextPronunciations">getTextPronunciations</a></li>
|
||||
<li><a href="/#!/WordApi#getHyphenation">getHyphenation</a></li>
|
||||
<li><a href="/#!/WordApi#getWordFrequency">getWordFrequency</a></li>
|
||||
<li><a href="/#!/WordApi#getPhrases">getPhrases</a></li>
|
||||
<li><a href="/#!/WordApi#getEtymologies">getEtymologies</a></li>
|
||||
<li><a href="/#!/WordApi#getAudio">getAudio</a></li>
|
||||
<li><a href="/#!/WordApi#getScrabbleScore">getScrabbleScore</a></li>
|
||||
<li><a href="#!/WordsApi#searchWords">searchWords</a></li>
|
||||
<li><a href="#!/WordsApi#getWordOfTheDay">getWordOfTheDay</a></li>
|
||||
<li><a href="#!/WordsApi#reverseDictionary">reverseDictionary</a></li>
|
||||
<li><a href="#!/WordsApi#getRandomWords">getRandomWords</a></li>
|
||||
<li><a href="#!/WordsApi#getRandomWord">getRandomWord</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,32 +1,32 @@
|
||||
<h2>ApiTokenStatus</h2>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">valid : boolean
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">valid : boolean
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">token : string
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">token : string
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">resetsInMillis : long
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">resetsInMillis : long
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">remainingCalls : long
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">remainingCalls : long
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">expiresInMillis : long
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">expiresInMillis : long
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">totalRequests : long
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">totalRequests : long
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -1,72 +1,72 @@
|
||||
<h2>AudioFile</h2>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">attributionUrl : string
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">attributionUrl : string
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">commentCount : int
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">commentCount : int
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">voteCount : int
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">voteCount : int
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">fileUrl : string
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">fileUrl : string
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">audioType : string
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">audioType : string
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-true">id : long
|
||||
<div class="param-description"></div>
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">duration : double
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">duration : double
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">attributionText : string
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">attributionText : string
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">createdBy : string
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">createdBy : string
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">description : string
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">description : string
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">createdAt : Date
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">createdAt : Date
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">voteWeightedAverage : float
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">voteWeightedAverage : float
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">voteAverage : float
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">voteAverage : float
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">word : string
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">word : string
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
<h2>AuthenticationToken</h2>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">token : string
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">token : string
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">userId : long
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">userId : long
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="parameter">
|
||||
<li class="param-required-false">userSignature : string
|
||||
<div class="param-description"></div>
|
||||
<li class="param-required-">userSignature : string
|
||||
<br/>{description}}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
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