diff --git a/bin/scala-wordnik-api.sh b/bin/scala-wordnik-api.sh
new file mode 100755
index 00000000000..068cb4f6ac1
--- /dev/null
+++ b/bin/scala-wordnik-api.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
+export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files"
+scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" samples/client/wordnik-api/scala/ScalaWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json
diff --git a/samples/client/wordnik-api/scala/ScalaWordnikApiCodegen.scala b/samples/client/wordnik-api/scala/ScalaWordnikApiCodegen.scala
new file mode 100644
index 00000000000..6c4c758176e
--- /dev/null
+++ b/samples/client/wordnik-api/scala/ScalaWordnikApiCodegen.scala
@@ -0,0 +1,26 @@
+import com.wordnik.swagger.codegen.BasicScalaGenerator
+
+import com.wordnik.swagger.core._
+
+object ScalaWordnikApiCodegen extends BasicScalaGenerator {
+ def main(args: Array[String]) = generateClient(args)
+
+ def destinationRoot = "samples/client/wordnik-api/scala"
+
+ // where to write generated code
+ override def destinationDir = destinationRoot + "/src/main/scala"
+
+ // package for api invoker
+ 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")
+
+ // supporting classes
+ override def supportingFiles = List(
+ ("apiInvoker.mustache", destinationDir + "/" + invokerPackage.get.replaceAll("\\.", java.io.File.separator), "ApiInvoker.scala"),
+ ("pom.mustache", destinationRoot, "pom.xml"))
+}
\ No newline at end of file
diff --git a/samples/client/wordnik-api/scala/pom.xml b/samples/client/wordnik-api/scala/pom.xml
new file mode 100644
index 00000000000..348463168ef
--- /dev/null
+++ b/samples/client/wordnik-api/scala/pom.xml
@@ -0,0 +1,200 @@
+
+ 4.0.0
+ com.wordnik
+ swagger-client
+ jar
+ swagger-client
+ 1.0
+
+ 2.2.0
+
+
+
+
+ scala-tools.org
+ Scala-Tools Maven2 Repository
+ http://scala-tools.org/repo-releases
+
+
+ maven-mongodb-plugin-repo
+ maven mongodb plugin repository
+ http://maven-mongodb-plugin.googlecode.com/svn/maven/repo
+ default
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.12
+
+
+
+ loggerPath
+ conf/log4j.properties
+
+
+ -Xms512m -Xmx1500m
+ methods
+ pertest
+
+
+
+ maven-dependency-plugin
+
+
+ package
+
+ copy-dependencies
+
+
+ ${project.build.directory}/lib
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.2
+
+
+
+ jar
+ test-jar
+
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+
+
+ add_sources
+ generate-sources
+
+ add-source
+
+
+
+ src/main/java
+
+
+
+
+ add_test_sources
+ generate-test-sources
+
+ add-test-source
+
+
+
+ src/test/java
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 2.3.2
+
+ 1.6
+ 1.6
+
+
+
+ org.scala-tools
+ maven-scala-plugin
+ 2.15.2
+
+
+ scala-compile-first
+ process-resources
+
+ add-source
+ compile
+
+
+
+ scala-test-compile
+ process-test-resources
+
+ testCompile
+
+
+
+
+
+ -Xms128m
+ -Xmx1500m
+
+
+
+
+
+
+
+
+ org.scala-tools
+ maven-scala-plugin
+
+ ${scala-version}
+
+
+
+
+
+
+ com.sun.jersey
+ jersey-client
+ ${jersey-version}
+ compile
+
+
+ org.scala-lang
+ scala-library
+ ${scala-version}
+ compile
+
+
+ com.wordnik
+ swagger-core_2.9.1
+ ${swagger-core-version}
+ compile
+
+
+ org.scalatest
+ scalatest_2.9.1
+ ${scala-test-version}
+ test
+
+
+ junit
+ junit
+ ${junit-version}
+ test
+
+
+
+ 1.7
+ 1.1.0
+ 2.9.1-1
+ 4.8.1
+ 1.0.0
+ 1.6.1
+ 4.8.1
+ 1.6.1
+
+
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/AccountApi.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/AccountApi.scala
new file mode 100644
index 00000000000..a745c4024d9
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/AccountApi.scala
@@ -0,0 +1,133 @@
+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.AuthenticationToken
+import com.wordnik.client.common.ApiInvoker
+import com.wordnik.client.common.ApiException
+import scala.collection.mutable.HashMap
+
+class AccountApi {
+ var basePath: String = "http://api.wordnik.com/v4"
+ var apiInvoker = ApiInvoker
+
+ def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
+
+ def authenticate (username: String, password: String) : Option[AuthenticationToken]= {
+ // create path and map variables
+ val path = "/account.{format}/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escapeString(username))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(username, password) - null).size match {
+ case 2 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(password) != "null") queryParams += "password" -> password.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "", classOf[AuthenticationToken]).asInstanceOf[AuthenticationToken])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def authenticatePost (username: String, body: String) : Option[AuthenticationToken]= {
+ // create path and map variables
+ val path = "/account.{format}/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escapeString(username))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(username, body) - null).size match {
+ case 2 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ try {
+ apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "", classOf[AuthenticationToken]).asInstanceOf[AuthenticationToken])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getWordListsForLoggedInUser (auth_token: String, skip: Int, limit: Int) : Option[List[WordList]]= {
+ // create path and map variables
+ val path = "/account.{format}/wordLists".replaceAll("\\{format\\}","json")// query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(auth_token) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(skip) != "null") queryParams += "skip" -> skip.toString
+ if(String.valueOf(limit) != "null") queryParams += "limit" -> limit.toString
+ headerParams += "auth_token" -> auth_token
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "List", classOf[WordList]).asInstanceOf[List[WordList]])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getApiTokenStatus (api_key: String) : Option[ApiTokenStatus]= {
+ // create path and map variables
+ val path = "/account.{format}/apiTokenStatus".replaceAll("\\{format\\}","json")// query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ headerParams += "api_key" -> api_key
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "", classOf[ApiTokenStatus]).asInstanceOf[ApiTokenStatus])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getLoggedInUser (auth_token: String) : Option[User]= {
+ // create path and map variables
+ val path = "/account.{format}/user".replaceAll("\\{format\\}","json")// query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(auth_token) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ headerParams += "auth_token" -> auth_token
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "", classOf[User]).asInstanceOf[User])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ }
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/WordApi.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/WordApi.scala
new file mode 100644
index 00000000000..102c69ffe1c
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/WordApi.scala
@@ -0,0 +1,320 @@
+package com.wordnik.client.api
+
+import com.wordnik.client.model.Definition
+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.common.ApiInvoker
+import com.wordnik.client.common.ApiException
+import scala.collection.mutable.HashMap
+
+class WordApi {
+ var basePath: String = "http://api.wordnik.com/v4"
+ var apiInvoker = ApiInvoker
+
+ def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
+
+ def getExamples (word: String, skip: Int, limit: Int, includeDuplicates: String= "false", useCanonical: String= "false") : Option[ExampleSearchResults]= {
+ // create path and map variables
+ val path = "/word.{format}/{word}/examples".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escapeString(word))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(word) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(includeDuplicates) != "null") queryParams += "includeDuplicates" -> includeDuplicates.toString
+ if(String.valueOf(useCanonical) != "null") queryParams += "useCanonical" -> useCanonical.toString
+ if(String.valueOf(skip) != "null") queryParams += "skip" -> skip.toString
+ if(String.valueOf(limit) != "null") queryParams += "limit" -> limit.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "", classOf[ExampleSearchResults]).asInstanceOf[ExampleSearchResults])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getWord (word: String, useCanonical: String= "false", includeSuggestions: String= "true") : Option[WordObject]= {
+ // create path and map variables
+ val path = "/word.{format}/{word}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escapeString(word))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(word) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(useCanonical) != "null") queryParams += "useCanonical" -> useCanonical.toString
+ if(String.valueOf(includeSuggestions) != "null") queryParams += "includeSuggestions" -> includeSuggestions.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "", classOf[WordObject]).asInstanceOf[WordObject])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getDefinitions (word: String, limit: Int, partOfSpeech: String, sourceDictionaries: String, includeRelated: String= "false", useCanonical: String= "false", includeTags: String= "false") : Option[List[Definition]]= {
+ // create path and map variables
+ val path = "/word.{format}/{word}/definitions".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escapeString(word))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(word) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(limit) != "null") queryParams += "limit" -> limit.toString
+ if(String.valueOf(partOfSpeech) != "null") queryParams += "partOfSpeech" -> partOfSpeech.toString
+ if(String.valueOf(includeRelated) != "null") queryParams += "includeRelated" -> includeRelated.toString
+ if(String.valueOf(sourceDictionaries) != "null") queryParams += "sourceDictionaries" -> sourceDictionaries.toString
+ if(String.valueOf(useCanonical) != "null") queryParams += "useCanonical" -> useCanonical.toString
+ if(String.valueOf(includeTags) != "null") queryParams += "includeTags" -> includeTags.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "List", classOf[Definition]).asInstanceOf[List[Definition]])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getTopExample (word: String, useCanonical: String= "false") : Option[Example]= {
+ // create path and map variables
+ val path = "/word.{format}/{word}/topExample".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escapeString(word))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(word) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(useCanonical) != "null") queryParams += "useCanonical" -> useCanonical.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "", classOf[Example]).asInstanceOf[Example])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getRelatedWords (word: String, relationshipTypes: String, limitPerRelationshipType: Int, useCanonical: String= "false") : Option[List[Related]]= {
+ // create path and map variables
+ val path = "/word.{format}/{word}/relatedWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escapeString(word))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(word) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(useCanonical) != "null") queryParams += "useCanonical" -> useCanonical.toString
+ if(String.valueOf(relationshipTypes) != "null") queryParams += "relationshipTypes" -> relationshipTypes.toString
+ if(String.valueOf(limitPerRelationshipType) != "null") queryParams += "limitPerRelationshipType" -> limitPerRelationshipType.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "List", classOf[Related]).asInstanceOf[List[Related]])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getTextPronunciations (word: String, sourceDictionary: String, typeFormat: String, limit: Int, useCanonical: String= "false") : Option[List[TextPron]]= {
+ // create path and map variables
+ val path = "/word.{format}/{word}/pronunciations".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escapeString(word))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(word) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(useCanonical) != "null") queryParams += "useCanonical" -> useCanonical.toString
+ if(String.valueOf(sourceDictionary) != "null") queryParams += "sourceDictionary" -> sourceDictionary.toString
+ if(String.valueOf(typeFormat) != "null") queryParams += "typeFormat" -> typeFormat.toString
+ if(String.valueOf(limit) != "null") queryParams += "limit" -> limit.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "List", classOf[TextPron]).asInstanceOf[List[TextPron]])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getHyphenation (word: String, sourceDictionary: String, limit: Int, useCanonical: String= "false") : Option[List[Syllable]]= {
+ // create path and map variables
+ val path = "/word.{format}/{word}/hyphenation".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escapeString(word))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(word) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(useCanonical) != "null") queryParams += "useCanonical" -> useCanonical.toString
+ if(String.valueOf(sourceDictionary) != "null") queryParams += "sourceDictionary" -> sourceDictionary.toString
+ if(String.valueOf(limit) != "null") queryParams += "limit" -> limit.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "List", classOf[Syllable]).asInstanceOf[List[Syllable]])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getWordFrequency (word: String, startYear: Int, endYear: Int, useCanonical: String= "false") : Option[FrequencySummary]= {
+ // create path and map variables
+ val path = "/word.{format}/{word}/frequency".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escapeString(word))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(word) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(useCanonical) != "null") queryParams += "useCanonical" -> useCanonical.toString
+ if(String.valueOf(startYear) != "null") queryParams += "startYear" -> startYear.toString
+ if(String.valueOf(endYear) != "null") queryParams += "endYear" -> endYear.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "", classOf[FrequencySummary]).asInstanceOf[FrequencySummary])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getPhrases (word: String, limit: Int, wlmi: Int, useCanonical: String= "false") : Option[List[Bigram]]= {
+ // create path and map variables
+ val path = "/word.{format}/{word}/phrases".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escapeString(word))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(word) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(limit) != "null") queryParams += "limit" -> limit.toString
+ if(String.valueOf(wlmi) != "null") queryParams += "wlmi" -> wlmi.toString
+ if(String.valueOf(useCanonical) != "null") queryParams += "useCanonical" -> useCanonical.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "List", classOf[Bigram]).asInstanceOf[List[Bigram]])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getEtymologies (word: String, useCanonical: String) : Option[List[String]]= {
+ // create path and map variables
+ val path = "/word.{format}/{word}/etymologies".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escapeString(word))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(word) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(useCanonical) != "null") queryParams += "useCanonical" -> useCanonical.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "List", classOf[String]).asInstanceOf[List[String]])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getAudio (word: String, limit: Int, useCanonical: String= "false") : Option[List[AudioFile]]= {
+ // create path and map variables
+ val path = "/word.{format}/{word}/audio".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escapeString(word))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(word) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(useCanonical) != "null") queryParams += "useCanonical" -> useCanonical.toString
+ if(String.valueOf(limit) != "null") queryParams += "limit" -> limit.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "List", classOf[AudioFile]).asInstanceOf[List[AudioFile]])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ }
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/WordListApi.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/WordListApi.scala
new file mode 100644
index 00000000000..2165fae3c51
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/WordListApi.scala
@@ -0,0 +1,167 @@
+package com.wordnik.client.api
+
+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
+import scala.collection.mutable.HashMap
+
+class WordListApi {
+ var basePath: String = "http://api.wordnik.com/v4"
+ var apiInvoker = ApiInvoker
+
+ def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
+
+ def updateWordList (permalink: String, body: WordList, auth_token: String) = {
+ // create path and map variables
+ val path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}",apiInvoker.escapeString(permalink))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(permalink, auth_token) - null).size match {
+ case 2 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ headerParams += "auth_token" -> auth_token
+ try {
+ apiInvoker.invokeApi(basePath, path, "PUT", queryParams.toMap, body, headerParams.toMap) match {
+ case s: String =>
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def deleteWordList (permalink: String, auth_token: String) = {
+ // create path and map variables
+ val path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}",apiInvoker.escapeString(permalink))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(permalink, auth_token) - null).size match {
+ case 2 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ headerParams += "auth_token" -> auth_token
+ try {
+ apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getWordListByPermalink (permalink: String, auth_token: String) : Option[WordList]= {
+ // create path and map variables
+ val path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}",apiInvoker.escapeString(permalink))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(permalink, auth_token) - null).size match {
+ case 2 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ headerParams += "auth_token" -> auth_token
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "", classOf[WordList]).asInstanceOf[WordList])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def addWordsToWordList (permalink: String, body: Array[StringValue], auth_token: String) = {
+ // create path and map variables
+ val path = "/wordList.{format}/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}",apiInvoker.escapeString(permalink))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(permalink, auth_token) - null).size match {
+ case 2 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ headerParams += "auth_token" -> auth_token
+ try {
+ apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap) match {
+ case s: String =>
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getWordListWords (permalink: String, skip: Int, limit: Int, auth_token: String, sortBy: String= "createDate", sortOrder: String= "desc") : Option[List[WordListWord]]= {
+ // create path and map variables
+ val path = "/wordList.{format}/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}",apiInvoker.escapeString(permalink))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(permalink, auth_token) - null).size match {
+ case 2 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(sortBy) != "null") queryParams += "sortBy" -> sortBy.toString
+ if(String.valueOf(sortOrder) != "null") queryParams += "sortOrder" -> sortOrder.toString
+ if(String.valueOf(skip) != "null") queryParams += "skip" -> skip.toString
+ if(String.valueOf(limit) != "null") queryParams += "limit" -> limit.toString
+ headerParams += "auth_token" -> auth_token
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "List", classOf[WordListWord]).asInstanceOf[List[WordListWord]])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def deleteWordsFromWordList (permalink: String, body: Array[StringValue], auth_token: String) = {
+ // create path and map variables
+ val path = "/wordList.{format}/{permalink}/deleteWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}",apiInvoker.escapeString(permalink))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(permalink, auth_token) - null).size match {
+ case 2 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ headerParams += "auth_token" -> auth_token
+ try {
+ apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap) match {
+ case s: String =>
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ }
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/WordListsApi.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/WordListsApi.scala
new file mode 100644
index 00000000000..8a3236c59f4
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/WordListsApi.scala
@@ -0,0 +1,38 @@
+package com.wordnik.client.api
+
+import com.wordnik.client.model.WordList
+import com.wordnik.client.common.ApiInvoker
+import com.wordnik.client.common.ApiException
+import scala.collection.mutable.HashMap
+
+class WordListsApi {
+ var basePath: String = "http://api.wordnik.com/v4"
+ var apiInvoker = ApiInvoker
+
+ def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
+
+ def createWordList (body: WordList, auth_token: String) : Option[WordList]= {
+ // create path and map variables
+ val path = "/wordLists.{format}".replaceAll("\\{format\\}","json")// query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(auth_token) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ headerParams += "auth_token" -> auth_token
+ try {
+ apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "", classOf[WordList]).asInstanceOf[WordList])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ }
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/WordsApi.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/WordsApi.scala
new file mode 100644
index 00000000000..30756f9a404
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/api/WordsApi.scala
@@ -0,0 +1,164 @@
+package com.wordnik.client.api
+
+import com.wordnik.client.model.WordObject
+import com.wordnik.client.model.DefinitionSearchResults
+import com.wordnik.client.model.WordOfTheDay
+import com.wordnik.client.model.WordSearchResults
+import com.wordnik.client.common.ApiInvoker
+import com.wordnik.client.common.ApiException
+import scala.collection.mutable.HashMap
+
+class WordsApi {
+ var basePath: String = "http://api.wordnik.com/v4"
+ var apiInvoker = ApiInvoker
+
+ def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
+
+ def searchWords (query: String, includePartOfSpeech: String, excludePartOfSpeech: String, minCorpusCount: Int, maxCorpusCount: Int, minDictionaryCount: Int, maxDictionaryCount: Int, minLength: Int, maxLength: Int, skip: Int, limit: Int, caseSensitive: String= "true") : Option[WordSearchResults]= {
+ // create path and map variables
+ val path = "/words.{format}/search/{query}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "query" + "\\}",apiInvoker.escapeString(query))
+
+ // query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(query) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(caseSensitive) != "null") queryParams += "caseSensitive" -> caseSensitive.toString
+ if(String.valueOf(includePartOfSpeech) != "null") queryParams += "includePartOfSpeech" -> includePartOfSpeech.toString
+ if(String.valueOf(excludePartOfSpeech) != "null") queryParams += "excludePartOfSpeech" -> excludePartOfSpeech.toString
+ if(String.valueOf(minCorpusCount) != "null") queryParams += "minCorpusCount" -> minCorpusCount.toString
+ if(String.valueOf(maxCorpusCount) != "null") queryParams += "maxCorpusCount" -> maxCorpusCount.toString
+ if(String.valueOf(minDictionaryCount) != "null") queryParams += "minDictionaryCount" -> minDictionaryCount.toString
+ if(String.valueOf(maxDictionaryCount) != "null") queryParams += "maxDictionaryCount" -> maxDictionaryCount.toString
+ if(String.valueOf(minLength) != "null") queryParams += "minLength" -> minLength.toString
+ if(String.valueOf(maxLength) != "null") queryParams += "maxLength" -> maxLength.toString
+ if(String.valueOf(skip) != "null") queryParams += "skip" -> skip.toString
+ if(String.valueOf(limit) != "null") queryParams += "limit" -> limit.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "", classOf[WordSearchResults]).asInstanceOf[WordSearchResults])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getWordOfTheDay (date: String) : Option[WordOfTheDay]= {
+ // create path and map variables
+ val path = "/words.{format}/wordOfTheDay".replaceAll("\\{format\\}","json")// query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ if(String.valueOf(date) != "null") queryParams += "date" -> date.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "", classOf[WordOfTheDay]).asInstanceOf[WordOfTheDay])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def reverseDictionary (query: String, findSenseForWord: String, includeSourceDictionaries: String, excludeSourceDictionaries: String, includePartOfSpeech: String, excludePartOfSpeech: String, minCorpusCount: Int, maxCorpusCount: Int, minLength: Int, maxLength: Int, expandTerms: String, sortBy: String, sortOrder: String, limit: Int, includeTags: String= "false", skip: String= "0") : Option[DefinitionSearchResults]= {
+ // create path and map variables
+ val path = "/words.{format}/reverseDictionary".replaceAll("\\{format\\}","json")// query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ // verify required params are set
+ (Set(query) - null).size match {
+ case 1 => // all required values set
+ case _ => throw new Exception("missing required params")
+ }
+ if(String.valueOf(query) != "null") queryParams += "query" -> query.toString
+ if(String.valueOf(findSenseForWord) != "null") queryParams += "findSenseForWord" -> findSenseForWord.toString
+ if(String.valueOf(includeSourceDictionaries) != "null") queryParams += "includeSourceDictionaries" -> includeSourceDictionaries.toString
+ if(String.valueOf(excludeSourceDictionaries) != "null") queryParams += "excludeSourceDictionaries" -> excludeSourceDictionaries.toString
+ if(String.valueOf(includePartOfSpeech) != "null") queryParams += "includePartOfSpeech" -> includePartOfSpeech.toString
+ if(String.valueOf(excludePartOfSpeech) != "null") queryParams += "excludePartOfSpeech" -> excludePartOfSpeech.toString
+ if(String.valueOf(minCorpusCount) != "null") queryParams += "minCorpusCount" -> minCorpusCount.toString
+ if(String.valueOf(maxCorpusCount) != "null") queryParams += "maxCorpusCount" -> maxCorpusCount.toString
+ if(String.valueOf(minLength) != "null") queryParams += "minLength" -> minLength.toString
+ if(String.valueOf(maxLength) != "null") queryParams += "maxLength" -> maxLength.toString
+ if(String.valueOf(expandTerms) != "null") queryParams += "expandTerms" -> expandTerms.toString
+ if(String.valueOf(includeTags) != "null") queryParams += "includeTags" -> includeTags.toString
+ if(String.valueOf(sortBy) != "null") queryParams += "sortBy" -> sortBy.toString
+ if(String.valueOf(sortOrder) != "null") queryParams += "sortOrder" -> sortOrder.toString
+ if(String.valueOf(skip) != "null") queryParams += "skip" -> skip.toString
+ if(String.valueOf(limit) != "null") queryParams += "limit" -> limit.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "", classOf[DefinitionSearchResults]).asInstanceOf[DefinitionSearchResults])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getRandomWords (includePartOfSpeech: String, excludePartOfSpeech: String, minCorpusCount: Int, maxCorpusCount: Int, minDictionaryCount: Int, maxDictionaryCount: Int, minLength: Int, maxLength: Int, sortBy: String, sortOrder: String, limit: Int, hasDictionaryDef: String= "true") : Option[List[WordObject]]= {
+ // create path and map variables
+ val path = "/words.{format}/randomWords".replaceAll("\\{format\\}","json")// query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ if(String.valueOf(hasDictionaryDef) != "null") queryParams += "hasDictionaryDef" -> hasDictionaryDef.toString
+ if(String.valueOf(includePartOfSpeech) != "null") queryParams += "includePartOfSpeech" -> includePartOfSpeech.toString
+ if(String.valueOf(excludePartOfSpeech) != "null") queryParams += "excludePartOfSpeech" -> excludePartOfSpeech.toString
+ if(String.valueOf(minCorpusCount) != "null") queryParams += "minCorpusCount" -> minCorpusCount.toString
+ if(String.valueOf(maxCorpusCount) != "null") queryParams += "maxCorpusCount" -> maxCorpusCount.toString
+ if(String.valueOf(minDictionaryCount) != "null") queryParams += "minDictionaryCount" -> minDictionaryCount.toString
+ if(String.valueOf(maxDictionaryCount) != "null") queryParams += "maxDictionaryCount" -> maxDictionaryCount.toString
+ if(String.valueOf(minLength) != "null") queryParams += "minLength" -> minLength.toString
+ if(String.valueOf(maxLength) != "null") queryParams += "maxLength" -> maxLength.toString
+ if(String.valueOf(sortBy) != "null") queryParams += "sortBy" -> sortBy.toString
+ if(String.valueOf(sortOrder) != "null") queryParams += "sortOrder" -> sortOrder.toString
+ if(String.valueOf(limit) != "null") queryParams += "limit" -> limit.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "List", classOf[WordObject]).asInstanceOf[List[WordObject]])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ def getRandomWord (includePartOfSpeech: String, excludePartOfSpeech: String, minCorpusCount: Int, maxCorpusCount: Int, minDictionaryCount: Int, maxDictionaryCount: Int, minLength: Int, maxLength: Int, hasDictionaryDef: String= "true") : Option[WordObject]= {
+ // create path and map variables
+ val path = "/words.{format}/randomWord".replaceAll("\\{format\\}","json")// query params
+ val queryParams = new HashMap[String, String]
+ val headerParams = new HashMap[String, String]
+
+ if(String.valueOf(hasDictionaryDef) != "null") queryParams += "hasDictionaryDef" -> hasDictionaryDef.toString
+ if(String.valueOf(includePartOfSpeech) != "null") queryParams += "includePartOfSpeech" -> includePartOfSpeech.toString
+ if(String.valueOf(excludePartOfSpeech) != "null") queryParams += "excludePartOfSpeech" -> excludePartOfSpeech.toString
+ if(String.valueOf(minCorpusCount) != "null") queryParams += "minCorpusCount" -> minCorpusCount.toString
+ if(String.valueOf(maxCorpusCount) != "null") queryParams += "maxCorpusCount" -> maxCorpusCount.toString
+ if(String.valueOf(minDictionaryCount) != "null") queryParams += "minDictionaryCount" -> minDictionaryCount.toString
+ if(String.valueOf(maxDictionaryCount) != "null") queryParams += "maxDictionaryCount" -> maxDictionaryCount.toString
+ if(String.valueOf(minLength) != "null") queryParams += "minLength" -> minLength.toString
+ if(String.valueOf(maxLength) != "null") queryParams += "maxLength" -> maxLength.toString
+ try {
+ apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap) match {
+ case s: String =>
+ Some(ApiInvoker.deserialize(s, "", classOf[WordObject]).asInstanceOf[WordObject])
+ case _ => None
+ }
+ } catch {
+ case ex: ApiException if ex.code == 404 => None
+ case ex: ApiException => throw ex
+ }
+ }
+ }
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/common/ApiInvoker.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/common/ApiInvoker.scala
new file mode 100644
index 00000000000..875ed04ebb3
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/common/ApiInvoker.scala
@@ -0,0 +1,137 @@
+package com.wordnik.client.common
+
+import com.sun.jersey.api.client.Client
+import com.sun.jersey.api.client.ClientResponse
+import com.sun.jersey.api.client.config.ClientConfig
+import com.sun.jersey.api.client.config.DefaultClientConfig
+import com.sun.jersey.api.client.filter.LoggingFilter
+
+import java.net.URLEncoder
+import javax.ws.rs.core.MediaType
+
+import scala.collection.JavaConverters._
+import scala.collection.mutable.HashMap
+
+import com.fasterxml.jackson.module.scala.DefaultScalaModule
+import com.fasterxml.jackson.core.JsonGenerator.Feature
+import com.fasterxml.jackson.databind._
+import com.fasterxml.jackson.annotation._
+import com.fasterxml.jackson.databind.annotation.JsonSerialize
+
+object ScalaJsonUtil {
+ def getJsonMapper = {
+ val mapper = new ObjectMapper()
+ mapper.registerModule(new DefaultScalaModule())
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT)
+ mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
+ mapper
+ }
+}
+
+object ApiInvoker {
+ val mapper = ScalaJsonUtil.getJsonMapper
+ val defaultHeaders: HashMap[String, String] = HashMap()
+ val hostMap: HashMap[String, Client] = HashMap()
+
+ def escapeString(value: String): String = {
+ URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20")
+ }
+
+ def deserialize(json: String, containerType: String, cls: Class[_]) = {
+ if (cls == classOf[String]) {
+ json match {
+ case s: String => {
+ if (s.startsWith("\"") && s.endsWith("\"") && s.length > 1) s.substring(1, s.length - 2)
+ else s
+ }
+ case _ => null
+ }
+ } else {
+ containerType match {
+ case "List" => {
+ val typeInfo = mapper.getTypeFactory().constructCollectionType(classOf[java.util.List[_]], cls)
+ val response = mapper.readValue(json, typeInfo).asInstanceOf[java.util.List[_]]
+ response.asScala.toList
+ }
+ case _ => {
+ json match {
+ case e: String if ("\"\"" == e) => null
+ case _ => mapper.readValue(json, cls)
+ }
+ }
+ }
+ }
+ }
+
+ def serialize(obj: AnyRef): String = {
+ if (obj != null) {
+ obj match {
+ case e: List[_] => mapper.writeValueAsString(obj.asInstanceOf[List[_]].asJava)
+ case _ => mapper.writeValueAsString(obj)
+ }
+ } else null
+ }
+
+ def invokeApi(host: String, path: String, method: String, queryParams: Map[String, String], body: AnyRef, headerParams: Map[String, String]) = {
+ val client = getClient(host)
+
+ val querystring = queryParams.filter(k => k._2 != null).map(k => (escapeString(k._1) + "=" + escapeString(k._2))).mkString("?", "&", "")
+ val builder = client.resource(host + path + querystring).`type`("application/json")
+
+ headerParams.map(p => builder.header(p._1, p._2))
+ defaultHeaders.map(p => {
+ headerParams.contains(p._1) match {
+ case true => // override default with supplied header
+ case false => if (p._2 != null) builder.header(p._1, p._2)
+ }
+ })
+
+ val response: ClientResponse = method match {
+ case "GET" => {
+ builder.get(classOf[ClientResponse]).asInstanceOf[ClientResponse]
+ }
+ case "POST" => {
+ builder.post(classOf[ClientResponse], serialize(body))
+ }
+ case "PUT" => {
+ builder.put(classOf[ClientResponse], serialize(body))
+ }
+ case "DELETE" => {
+ builder.delete(classOf[ClientResponse])
+ }
+ case _ => null
+ }
+ response.getClientResponseStatus() match {
+ case ClientResponse.Status.OK => response.getEntity(classOf[String])
+ case _ => {
+ throw new ApiException(
+ response.getClientResponseStatus().getStatusCode(),
+ response.getEntity(classOf[String]))
+ }
+ }
+ }
+
+ def getClient(host: String): Client = {
+ hostMap.contains(host) match {
+ case true => hostMap(host)
+ case false => {
+ val client = Client.create()
+ // client.addFilter(new LoggingFilter())
+ hostMap += host -> client
+ client
+ }
+ }
+ }
+}
+
+class ApiException extends Exception {
+ var code = 0
+
+ def this(code: Int, msg: String) = {
+ this()
+ }
+}
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ApiTokenStatus.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ApiTokenStatus.scala
new file mode 100644
index 00000000000..703bca4a522
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ApiTokenStatus.scala
@@ -0,0 +1,10 @@
+package com.wordnik.client.model
+
+case class ApiTokenStatus (
+ valid: Boolean,
+ token: String,
+ resetsInMillis: Long,
+ remainingCalls: Long,
+ expiresInMillis: Long,
+ totalRequests: Long)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/AudioFile.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/AudioFile.scala
new file mode 100644
index 00000000000..150c78b9474
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/AudioFile.scala
@@ -0,0 +1,19 @@
+package com.wordnik.client.model
+
+import java.util.Date
+case class AudioFile (
+ attributionUrl: String,
+ commentCount: Int,
+ voteCount: Int,
+ fileUrl: String,
+ audioType: String,
+ id: Long,
+ duration: Double,
+ attributionText: String,
+ createdBy: String,
+ description: String,
+ createdAt: Date,
+ voteWeightedAverage: Float,
+ voteAverage: Float,
+ word: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/AuthenticationToken.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/AuthenticationToken.scala
new file mode 100644
index 00000000000..7c6699935c3
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/AuthenticationToken.scala
@@ -0,0 +1,7 @@
+package com.wordnik.client.model
+
+case class AuthenticationToken (
+ token: String,
+ userId: Long,
+ userSignature: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Bigram.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Bigram.scala
new file mode 100644
index 00000000000..c9027bfd47c
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Bigram.scala
@@ -0,0 +1,9 @@
+package com.wordnik.client.model
+
+case class Bigram (
+ count: Long,
+ gram2: String,
+ gram1: String,
+ wlmi: Double,
+ mi: Double)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Citation.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Citation.scala
new file mode 100644
index 00000000000..1a058e4c898
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Citation.scala
@@ -0,0 +1,6 @@
+package com.wordnik.client.model
+
+case class Citation (
+ cite: String,
+ source: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ContentProvider.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ContentProvider.scala
new file mode 100644
index 00000000000..9457347444e
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ContentProvider.scala
@@ -0,0 +1,6 @@
+package com.wordnik.client.model
+
+case class ContentProvider (
+ id: Int,
+ name: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Definition.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Definition.scala
new file mode 100644
index 00000000000..6b931bac89e
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Definition.scala
@@ -0,0 +1,26 @@
+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.Related
+case class Definition (
+ extendedText: String,
+ text: String,
+ sourceDictionary: String,
+ citations: List[Citation],
+ labels: List[Label],
+ score: Float,
+ exampleUses: List[ExampleUsage],
+ attributionUrl: String,
+ seqString: String,
+ attributionText: String,
+ relatedWords: List[Related],
+ sequence: String,
+ word: String,
+ textProns: List[TextPron],
+ notes: List[Note],
+ partOfSpeech: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/DefinitionSearchResults.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/DefinitionSearchResults.scala
new file mode 100644
index 00000000000..07be3a68b41
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/DefinitionSearchResults.scala
@@ -0,0 +1,7 @@
+package com.wordnik.client.model
+
+import com.wordnik.client.model.Definition
+case class DefinitionSearchResults (
+ results: List[Definition],
+ totalResults: Int)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Example.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Example.scala
new file mode 100644
index 00000000000..1c7096c0311
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Example.scala
@@ -0,0 +1,19 @@
+package com.wordnik.client.model
+
+import com.wordnik.client.model.Sentence
+import com.wordnik.client.model.ScoredWord
+import com.wordnik.client.model.ContentProvider
+case class Example (
+ id: Long,
+ text: String,
+ title: String,
+ exampleId: Long,
+ score: ScoredWord,
+ sentence: Sentence,
+ year: Int,
+ provider: ContentProvider,
+ word: String,
+ rating: Float,
+ url: String,
+ documentId: Long)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ExampleSearchResults.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ExampleSearchResults.scala
new file mode 100644
index 00000000000..a6e4e8f9e0f
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ExampleSearchResults.scala
@@ -0,0 +1,8 @@
+package com.wordnik.client.model
+
+import com.wordnik.client.model.Facet
+import com.wordnik.client.model.Example
+case class ExampleSearchResults (
+ facets: List[Facet],
+ examples: List[Example])
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ExampleUsage.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ExampleUsage.scala
new file mode 100644
index 00000000000..0d783b1554f
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ExampleUsage.scala
@@ -0,0 +1,5 @@
+package com.wordnik.client.model
+
+case class ExampleUsage (
+ text: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Facet.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Facet.scala
new file mode 100644
index 00000000000..e6c1fb012f3
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Facet.scala
@@ -0,0 +1,7 @@
+package com.wordnik.client.model
+
+import com.wordnik.client.model.FacetValue
+case class Facet (
+ facetValues: List[FacetValue],
+ name: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/FacetValue.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/FacetValue.scala
new file mode 100644
index 00000000000..1dd18da0200
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/FacetValue.scala
@@ -0,0 +1,6 @@
+package com.wordnik.client.model
+
+case class FacetValue (
+ count: Long,
+ value: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Frequency.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Frequency.scala
new file mode 100644
index 00000000000..e84fd1edf1f
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Frequency.scala
@@ -0,0 +1,6 @@
+package com.wordnik.client.model
+
+case class Frequency (
+ count: Long,
+ year: Int)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/FrequencySummary.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/FrequencySummary.scala
new file mode 100644
index 00000000000..96592ee792a
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/FrequencySummary.scala
@@ -0,0 +1,10 @@
+package com.wordnik.client.model
+
+import com.wordnik.client.model.Frequency
+case class FrequencySummary (
+ unknownYearCount: Int,
+ totalCount: Long,
+ frequencyString: String,
+ word: String,
+ frequency: List[Frequency])
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Label.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Label.scala
new file mode 100644
index 00000000000..e55183a7e40
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Label.scala
@@ -0,0 +1,6 @@
+package com.wordnik.client.model
+
+case class Label (
+ text: String,
+ `type`: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Note.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Note.scala
new file mode 100644
index 00000000000..f137b631f94
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Note.scala
@@ -0,0 +1,8 @@
+package com.wordnik.client.model
+
+case class Note (
+ noteType: String,
+ appliesTo: List[String],
+ value: String,
+ pos: Int)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Related.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Related.scala
new file mode 100644
index 00000000000..1f7eb97bb31
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Related.scala
@@ -0,0 +1,11 @@
+package com.wordnik.client.model
+
+case class Related (
+ label1: String,
+ label2: String,
+ relationshipType: String,
+ label3: String,
+ words: List[String],
+ label4: String,
+ gram: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ScoredWord.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ScoredWord.scala
new file mode 100644
index 00000000000..444d85e26a5
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/ScoredWord.scala
@@ -0,0 +1,15 @@
+package com.wordnik.client.model
+
+case class ScoredWord (
+ id: Long,
+ position: Int,
+ lemma: String,
+ docTermCount: Int,
+ wordType: String,
+ score: Float,
+ word: String,
+ sentenceId: Long,
+ stopword: Boolean,
+ baseWordScore: Double,
+ partOfSpeech: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Sentence.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Sentence.scala
new file mode 100644
index 00000000000..9c699f26d20
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Sentence.scala
@@ -0,0 +1,11 @@
+package com.wordnik.client.model
+
+import com.wordnik.client.model.ScoredWord
+case class Sentence (
+ id: Long,
+ hasScoredWords: Boolean,
+ scoredWords: List[ScoredWord],
+ display: String,
+ rating: Int,
+ documentMetadataId: Long)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/SimpleDefinition.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/SimpleDefinition.scala
new file mode 100644
index 00000000000..541c13d1fe9
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/SimpleDefinition.scala
@@ -0,0 +1,8 @@
+package com.wordnik.client.model
+
+case class SimpleDefinition (
+ text: String,
+ source: String,
+ note: String,
+ partOfSpeech: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/SimpleExample.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/SimpleExample.scala
new file mode 100644
index 00000000000..2eadd7f0dda
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/SimpleExample.scala
@@ -0,0 +1,8 @@
+package com.wordnik.client.model
+
+case class SimpleExample (
+ id: Long,
+ text: String,
+ title: String,
+ url: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/StringValue.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/StringValue.scala
new file mode 100644
index 00000000000..01cc387df78
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/StringValue.scala
@@ -0,0 +1,5 @@
+package com.wordnik.client.model
+
+case class StringValue (
+ word: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Syllable.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Syllable.scala
new file mode 100644
index 00000000000..9175ecff9c3
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/Syllable.scala
@@ -0,0 +1,7 @@
+package com.wordnik.client.model
+
+case class Syllable (
+ text: String,
+ seq: Int,
+ `type`: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/TextPron.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/TextPron.scala
new file mode 100644
index 00000000000..dc637f4001d
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/TextPron.scala
@@ -0,0 +1,7 @@
+package com.wordnik.client.model
+
+case class TextPron (
+ raw: String,
+ seq: Int,
+ rawType: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/User.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/User.scala
new file mode 100644
index 00000000000..18b888d6036
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/User.scala
@@ -0,0 +1,12 @@
+package com.wordnik.client.model
+
+case class User (
+ id: Long,
+ username: String,
+ status: Int,
+ email: String,
+ faceBookId: String,
+ userName: String,
+ displayName: String,
+ password: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordList.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordList.scala
new file mode 100644
index 00000000000..92a0af7dbc3
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordList.scala
@@ -0,0 +1,16 @@
+package com.wordnik.client.model
+
+import java.util.Date
+case class WordList (
+ id: Long,
+ updatedAt: Date,
+ username: String,
+ permalink: String,
+ description: String,
+ createdAt: Date,
+ lastActivityAt: Date,
+ name: String,
+ userId: Long,
+ numberWordsInList: Long,
+ `type`: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordListWord.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordListWord.scala
new file mode 100644
index 00000000000..21fc453823e
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordListWord.scala
@@ -0,0 +1,12 @@
+package com.wordnik.client.model
+
+import java.util.Date
+case class WordListWord (
+ id: Long,
+ username: String,
+ createdAt: Date,
+ userId: Long,
+ numberCommentsOnWord: Long,
+ word: String,
+ numberLists: Long)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordObject.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordObject.scala
new file mode 100644
index 00000000000..5e42f90e8da
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordObject.scala
@@ -0,0 +1,10 @@
+package com.wordnik.client.model
+
+case class WordObject (
+ id: Long,
+ originalWord: String,
+ word: String,
+ suggestions: List[String],
+ canonicalForm: String,
+ vulgar: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordOfTheDay.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordOfTheDay.scala
new file mode 100644
index 00000000000..94788f0f565
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordOfTheDay.scala
@@ -0,0 +1,20 @@
+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.ContentProvider
+case class WordOfTheDay (
+ id: Long,
+ parentId: String,
+ category: String,
+ createdBy: String,
+ createdAt: Date,
+ contentProvider: ContentProvider,
+ word: String,
+ htmlExtra: String,
+ definitions: List[SimpleDefinition],
+ examples: List[SimpleExample],
+ publishDate: Date,
+ note: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordSearchResult.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordSearchResult.scala
new file mode 100644
index 00000000000..1c590beee52
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordSearchResult.scala
@@ -0,0 +1,7 @@
+package com.wordnik.client.model
+
+case class WordSearchResult (
+ count: Long,
+ lexicality: Double,
+ word: String)
+
diff --git a/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordSearchResults.scala b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordSearchResults.scala
new file mode 100644
index 00000000000..7a0624f109c
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/main/scala/com/wordnik/client/model/WordSearchResults.scala
@@ -0,0 +1,7 @@
+package com.wordnik.client.model
+
+import com.wordnik.client.model.WordSearchResult
+case class WordSearchResults (
+ totalResults: Int,
+ searchResults: List[WordSearchResult])
+
diff --git a/samples/client/wordnik-api/scala/src/test/scala/WordApiTest.scala b/samples/client/wordnik-api/scala/src/test/scala/WordApiTest.scala
new file mode 100644
index 00000000000..929346c8f09
--- /dev/null
+++ b/samples/client/wordnik-api/scala/src/test/scala/WordApiTest.scala
@@ -0,0 +1,147 @@
+import com.wordnik.client.api._
+import com.wordnik.client.model._
+
+import com.wordnik.swagger.core._
+import com.wordnik.swagger.core.util.JsonUtil
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+import org.scalatest.FlatSpec
+import org.scalatest.matchers.ShouldMatchers
+
+import scala.collection.mutable.{ ListBuffer, HashMap }
+import scala.collection.JavaConversions._
+import scala.reflect.BeanProperty
+
+import scala.io.Source
+
+@RunWith(classOf[JUnitRunner])
+class WordApiTest extends FlatSpec with ShouldMatchers with BaseApiTest {
+ behavior of "WordApi"
+ val api = new WordApi
+
+ api.addHeader("api_key", API_KEY)
+
+ it should "verify the word apis" in {
+ val json = Source.fromURL("http://api.wordnik.com/v4/word.json").mkString
+ val doc = JsonUtil.getJsonMapper.readValue(json, classOf[Documentation])
+ assert(doc.getApis.size === 11)
+ }
+
+ it should "fetch a word" in {
+ api.getWord("cat") match {
+ case Some(word) => {
+ println(word)
+ word.word should be("cat")
+ word should not be (null)
+ }
+ case None => println("didn't find word cat")
+ }
+ }
+
+ it should "fetch a word with suggestions" in {
+ api.getWord("cAt", "false", "true") match {
+ case Some(word) => {
+ word.word should be("cAt")
+ word.suggestions.size should be (1)
+ word.suggestions(0) should be ("cat")
+ word should not be (null)
+ }
+ case None => fail("didn't find word cAt")
+ }
+ }
+
+ it should "fetch a word with canonical form" in {
+ api.getWord("cAt", "true") match {
+ case Some(word) => {
+ word.word should be("cat")
+ word should not be (null)
+ }
+ case None => fail("didn't find word cat")
+ }
+ }
+
+ it should "fetch definitions for a word" in {
+ api.getDefinitions("cat", 10, null, null) match {
+ case Some(definitions) => {
+ definitions.size should be(10)
+ }
+ case None => fail("didn't find definitions for cat")
+ }
+ }
+
+ it should "fetch examples for a word" in {
+ api.getExamples("cat", 0, 5) match {
+ case Some(examples) => {
+ examples.examples.size should be(5)
+ }
+ case None => fail("didn't find examples for cat")
+ }
+ }
+
+ it should "fetch a top example for a word" in {
+ api.getTopExample("cat") match {
+ case Some(example) => {
+ example.word should be("cat")
+ }
+ case None => fail("didn't find examples for cat")
+ }
+ }
+
+ it should "get text pronunciations for a word" in {
+ api.getTextPronunciations("cat", null, null, 2) match {
+ case Some(prons) => {
+ prons.size should be(2)
+ }
+ case None => fail("didn't find prons for cat")
+ }
+ }
+
+ it should "get hyphenation for a word" in {
+ api.getHyphenation("catalog", null, 1) match {
+ case Some(hyphenation) => {
+ hyphenation.size should be(1)
+ }
+ case None => fail("didn't find hyphenation for catalog")
+ }
+ }
+
+ it should "get word frequency for a word" in {
+ api.getWordFrequency("cat",0, 2012) match {
+ case Some(frequency) => {
+ frequency.totalCount should not be (0)
+ }
+ case None => fail("didn't find frequency for cat")
+ }
+ }
+
+ it should "get word phrases for a word" in {
+ api.getPhrases("money", 10, 0) match {
+ case Some(phrases) => {
+ phrases.size should not be (0)
+ }
+ case None => fail("didn't find phrases for money")
+ }
+ }
+
+ it should "get related words" in {
+ api.getRelatedWords("cat", null, 10) match {
+ case Some(relateds) => {
+ var count = 0
+ relateds.foreach(related =>{
+ related.words.size should (be <= 10)
+ })
+ }
+ case None => fail("didn't find related words")
+ }
+ }
+
+ it should "get audio for a word" in {
+ api.getAudio("cat", 2) match {
+ case Some(audio) => {
+ audio.size should be(2)
+ }
+ case None => fail("didn't find audio")
+ }
+ }
+}
diff --git a/samples/client/wordnik-api/spec-files/account.json b/samples/client/wordnik-api/spec-files/account.json
new file mode 100644
index 00000000000..3763ecdae89
--- /dev/null
+++ b/samples/client/wordnik-api/spec-files/account.json
@@ -0,0 +1,303 @@
+{
+ "resourcePath":"/account",
+ "apis":[
+ {
+ "path":"/account.{format}/authenticate/{username}",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"username",
+ "description":"A confirmed Wordnik username",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"password",
+ "description":"The user's password",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Authenticates a User",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Account not available.",
+ "code":403
+ },
+ {
+ "reason":"User not found.",
+ "code":404
+ }
+ ],
+ "nickname":"authenticate",
+ "responseClass":"AuthenticationToken"
+ },
+ {
+ "parameters":[
+ {
+ "name":"username",
+ "description":"A confirmed Wordnik username",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "description":"The user's password",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"body"
+ }
+ ],
+ "summary":"Authenticates a user",
+ "httpMethod":"POST",
+ "errorResponses":[
+ {
+ "reason":"Account not available.",
+ "code":403
+ },
+ {
+ "reason":"User not found.",
+ "code":404
+ }
+ ],
+ "nickname":"authenticatePost",
+ "responseClass":"AuthenticationToken"
+ }
+ ]
+ },
+ {
+ "path":"/account.{format}/wordLists",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"auth_token",
+ "description":"auth_token of logged-in user",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"header"
+ },
+ {
+ "name":"skip",
+ "defaultValue":"0",
+ "description":"Results to skip",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"limit",
+ "defaultValue":"50",
+ "description":"Maximum number of results to return",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Fetches WordList objects for the logged-in user.",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Not authenticated.",
+ "code":403
+ },
+ {
+ "reason":"User account not found.",
+ "code":404
+ }
+ ],
+ "nickname":"getWordListsForLoggedInUser",
+ "responseClass":"List[WordList]"
+ }
+ ]
+ },
+ {
+ "path":"/account.{format}/apiTokenStatus",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"api_key",
+ "description":"Wordnik authentication token",
+ "required":false,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"header"
+ }
+ ],
+ "summary":"Returns usage statistics for the API account.",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"No token supplied.",
+ "code":400
+ },
+ {
+ "reason":"No API account with supplied token.",
+ "code":404
+ }
+ ],
+ "nickname":"getApiTokenStatus",
+ "responseClass":"ApiTokenStatus"
+ }
+ ]
+ },
+ {
+ "path":"/account.{format}/user",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"auth_token",
+ "description":"The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"header"
+ }
+ ],
+ "summary":"Returns the logged-in User",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Not logged in.",
+ "code":403
+ },
+ {
+ "reason":"User not found.",
+ "code":404
+ }
+ ],
+ "nickname":"getLoggedInUser",
+ "responseClass":"User",
+ "notes":"Requires a valid auth_token to be set."
+ }
+ ]
+ }
+ ],
+ "apiVersion":"4.0",
+ "swaggerVersion":"1.0",
+ "basePath":"http://api.wordnik.com/v4",
+ "models":{
+ "User":{
+ "properties":{
+ "id":{
+ "type":"long"
+ },
+ "username":{
+ "type":"string"
+ },
+ "email":{
+ "type":"string"
+ },
+ "status":{
+ "type":"int"
+ },
+ "faceBookId":{
+ "type":"string"
+ },
+ "userName":{
+ "type":"string"
+ },
+ "displayName":{
+ "type":"string"
+ },
+ "password":{
+ "type":"string"
+ }
+ },
+ "id":"User"
+ },
+ "ApiTokenStatus":{
+ "properties":{
+ "valid":{
+ "type":"boolean"
+ },
+ "token":{
+ "type":"string"
+ },
+ "resetsInMillis":{
+ "type":"long"
+ },
+ "remainingCalls":{
+ "type":"long"
+ },
+ "expiresInMillis":{
+ "type":"long"
+ },
+ "totalRequests":{
+ "type":"long"
+ }
+ },
+ "id":"ApiTokenStatus"
+ },
+ "AuthenticationToken":{
+ "properties":{
+ "token":{
+ "type":"string"
+ },
+ "userId":{
+ "type":"long"
+ },
+ "userSignature":{
+ "type":"string"
+ }
+ },
+ "id":"AuthenticationToken"
+ },
+ "WordList":{
+ "properties":{
+ "updatedAt":{
+ "type":"Date"
+ },
+ "id":{
+ "type":"long",
+ "required":true
+ },
+ "username":{
+ "type":"string"
+ },
+ "permalink":{
+ "type":"string"
+ },
+ "lastActivityAt":{
+ "type":"Date"
+ },
+ "createdAt":{
+ "type":"Date"
+ },
+ "description":{
+ "type":"string"
+ },
+ "userId":{
+ "type":"long"
+ },
+ "name":{
+ "type":"string"
+ },
+ "numberWordsInList":{
+ "type":"long"
+ },
+ "type":{
+ "type":"string"
+ }
+ },
+ "id":"WordList"
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/client/wordnik-api/spec-files/resources.json b/samples/client/wordnik-api/spec-files/resources.json
new file mode 100644
index 00000000000..4a3f067f4ef
--- /dev/null
+++ b/samples/client/wordnik-api/spec-files/resources.json
@@ -0,0 +1,27 @@
+{
+ "apis":[
+ {
+ "path":"/word.{format}",
+ "description":""
+ },
+ {
+ "path":"/words.{format}",
+ "description":""
+ },
+ {
+ "path":"/wordList.{format}",
+ "description":""
+ },
+ {
+ "path":"/wordLists.{format}",
+ "description":""
+ },
+ {
+ "path":"/account.{format}",
+ "description":""
+ }
+ ],
+ "apiVersion":"4.0",
+ "swaggerVersion":"1.1",
+ "basePath":"http://api.wordnik.com/v4"
+}
\ No newline at end of file
diff --git a/samples/client/wordnik-api/spec-files/word.json b/samples/client/wordnik-api/spec-files/word.json
new file mode 100644
index 00000000000..f3e02005612
--- /dev/null
+++ b/samples/client/wordnik-api/spec-files/word.json
@@ -0,0 +1,1314 @@
+{
+ "resourcePath":"/word",
+ "apis":[
+ {
+ "path":"/word.{format}/{word}/examples",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"word",
+ "description":"Word to return examples for",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"includeDuplicates",
+ "defaultValue":"false",
+ "description":"Show duplicate examples from different sources",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "false",
+ "true"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"useCanonical",
+ "defaultValue":"false",
+ "description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "false",
+ "true"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"skip",
+ "defaultValue":"0",
+ "description":"Results to skip",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"limit",
+ "defaultValue":"5",
+ "description":"Maximum number of results to return",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Returns examples for a word",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid word supplied.",
+ "code":400
+ }
+ ],
+ "nickname":"getExamples",
+ "responseClass":"ExampleSearchResults"
+ }
+ ]
+ },
+ {
+ "path":"/word.{format}/{word}",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"word",
+ "description":"String value of WordObject to return",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"useCanonical",
+ "defaultValue":"false",
+ "description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "false",
+ "true"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"includeSuggestions",
+ "defaultValue":"true",
+ "description":"Return suggestions (for correct spelling, case variants, etc.)",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "false",
+ "true"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Given a word as a string, returns the WordObject that represents it",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid word supplied.",
+ "code":400
+ }
+ ],
+ "nickname":"getWord",
+ "responseClass":"WordObject"
+ }
+ ]
+ },
+ {
+ "path":"/word.{format}/{word}/definitions",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"word",
+ "description":"Word to return definitions for",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"limit",
+ "defaultValue":"200",
+ "description":"Maximum number of results to return",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"partOfSpeech",
+ "description":"CSV list of part-of-speech types",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "noun",
+ "adjective",
+ "verb",
+ "adverb",
+ "interjection",
+ "pronoun",
+ "preposition",
+ "abbreviation",
+ "affix",
+ "article",
+ "auxiliary-verb",
+ "conjunction",
+ "definite-article",
+ "family-name",
+ "given-name",
+ "idiom",
+ "imperative",
+ "noun-plural",
+ "noun-posessive",
+ "past-participle",
+ "phrasal-prefix",
+ "proper-noun",
+ "proper-noun-plural",
+ "proper-noun-posessive",
+ "suffix",
+ "verb-intransitive",
+ "verb-transitive"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"includeRelated",
+ "defaultValue":"false",
+ "description":"Return related words with definitions",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "true",
+ "false"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"sourceDictionaries",
+ "description":"Source dictionary to return definitions from. If 'all' is received, results are returned from all sources. If multiple values are received (e.g. 'century,wiktionary'), results are returned from the first specified dictionary that has definitions. If left blank, results are returned from the first dictionary that has definitions. By default, dictionaries are searched in this order: ahd, wiktionary, webster, century, wordnet",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "all",
+ "ahd",
+ "century",
+ "wiktionary",
+ "webster",
+ "wordnet"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":true,
+ "paramType":"query"
+ },
+ {
+ "name":"useCanonical",
+ "defaultValue":"false",
+ "description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "false",
+ "true"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"includeTags",
+ "defaultValue":"false",
+ "description":"Return a closed set of XML tags in response",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "false",
+ "true"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Return definitions for a word",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid word supplied.",
+ "code":400
+ },
+ {
+ "reason":"No definitions found.",
+ "code":404
+ }
+ ],
+ "nickname":"getDefinitions",
+ "responseClass":"List[Definition]"
+ }
+ ]
+ },
+ {
+ "path":"/word.{format}/{word}/topExample",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"word",
+ "description":"Word to fetch examples for",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"useCanonical",
+ "defaultValue":"false",
+ "description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "false",
+ "true"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Returns a top example for a word",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid word supplied.",
+ "code":400
+ }
+ ],
+ "nickname":"getTopExample",
+ "responseClass":"Example"
+ }
+ ]
+ },
+ {
+ "path":"/word.{format}/{word}/relatedWords",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"word",
+ "description":"Word to fetch relationships for",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"useCanonical",
+ "defaultValue":"false",
+ "description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "false",
+ "true"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"relationshipTypes",
+ "description":"Limits the total results per type of relationship type",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "synonym",
+ "antonym",
+ "variant",
+ "equivalent",
+ "cross-reference",
+ "related-word",
+ "rhyme",
+ "form",
+ "etymologically-related-term",
+ "hypernym",
+ "hyponym",
+ "inflected-form",
+ "primary",
+ "same-context",
+ "verb-form",
+ "verb-stem"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"limitPerRelationshipType",
+ "defaultValue":"10",
+ "description":"Restrict to the supplied relatinship types",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":"Infinity",
+ "min":1.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Given a word as a string, returns relationships from the Word Graph",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid word supplied.",
+ "code":400
+ }
+ ],
+ "nickname":"getRelatedWords",
+ "responseClass":"List[Related]"
+ }
+ ]
+ },
+ {
+ "path":"/word.{format}/{word}/pronunciations",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"word",
+ "description":"Word to get pronunciations for",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"useCanonical",
+ "defaultValue":"false",
+ "description":"If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "false",
+ "true"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"sourceDictionary",
+ "description":"Get from a single dictionary",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "ahd",
+ "century",
+ "cmu",
+ "macmillan",
+ "wiktionary",
+ "webster",
+ "wordnet"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"typeFormat",
+ "description":"Text pronunciation type",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "ahd",
+ "arpabet",
+ "gcide-diacritical",
+ "IPA"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"limit",
+ "defaultValue":"50",
+ "description":"Maximum number of results to return",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Returns text pronunciations for a given word",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid word supplied.",
+ "code":400
+ }
+ ],
+ "nickname":"getTextPronunciations",
+ "responseClass":"List[TextPron]"
+ }
+ ]
+ },
+ {
+ "path":"/word.{format}/{word}/hyphenation",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"word",
+ "description":"Word to get syllables for",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"useCanonical",
+ "defaultValue":"false",
+ "description":"If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.",
+ "required":false,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"sourceDictionary",
+ "description":"Get from a single dictionary. Valid options: ahd, century, wiktionary, webster, and wordnet.",
+ "required":false,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"limit",
+ "defaultValue":"50",
+ "description":"Maximum number of results to return",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Returns syllable information for a word",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid word supplied.",
+ "code":400
+ }
+ ],
+ "nickname":"getHyphenation",
+ "responseClass":"List[Syllable]"
+ }
+ ]
+ },
+ {
+ "path":"/word.{format}/{word}/frequency",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"word",
+ "description":"Word to return",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"useCanonical",
+ "defaultValue":"false",
+ "description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.",
+ "required":false,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"startYear",
+ "defaultValue":"1800",
+ "description":"Starting Year",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"endYear",
+ "defaultValue":"2012",
+ "description":"Ending Year",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Returns word usage over time",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid word supplied.",
+ "code":400
+ },
+ {
+ "reason":"No results.",
+ "code":404
+ }
+ ],
+ "nickname":"getWordFrequency",
+ "responseClass":"FrequencySummary"
+ }
+ ]
+ },
+ {
+ "path":"/word.{format}/{word}/phrases",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"word",
+ "description":"Word to fetch phrases for",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"limit",
+ "defaultValue":"5",
+ "description":"Maximum number of results to return",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"wlmi",
+ "defaultValue":"0",
+ "description":"Minimum WLMI for the phrase",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"useCanonical",
+ "defaultValue":"false",
+ "description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "false",
+ "true"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Fetches bi-gram phrases for a word",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid word supplied.",
+ "code":400
+ }
+ ],
+ "nickname":"getPhrases",
+ "responseClass":"List[Bigram]"
+ }
+ ]
+ },
+ {
+ "path":"/word.{format}/{word}/etymologies",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"word",
+ "description":"Word to return",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"useCanonical",
+ "description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "false",
+ "true"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Fetches etymology data",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid word supplied.",
+ "code":400
+ },
+ {
+ "reason":"No definitions found.",
+ "code":404
+ }
+ ],
+ "nickname":"getEtymologies",
+ "responseClass":"List[string]"
+ }
+ ]
+ },
+ {
+ "path":"/word.{format}/{word}/audio",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"word",
+ "description":"Word to get audio for.",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"useCanonical",
+ "defaultValue":"false",
+ "description":"Use the canonical form of the word",
+ "required":false,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"limit",
+ "defaultValue":"50",
+ "description":"Maximum number of results to return",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Fetches audio metadata for a word.",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid word supplied.",
+ "code":400
+ }
+ ],
+ "nickname":"getAudio",
+ "responseClass":"List[AudioFile]",
+ "notes":"The metadata includes a time-expiring fileUrl which allows reading the audio file directly from the API. Currently only audio pronunciations from the American Heritage Dictionary in mp3 format are supported."
+ }
+ ]
+ }
+ ],
+ "apiVersion":"4.0",
+ "swaggerVersion":"1.0",
+ "basePath":"http://api.wordnik.com/v4",
+ "models":{
+ "Syllable":{
+ "properties":{
+ "text":{
+ "type":"string"
+ },
+ "seq":{
+ "type":"int"
+ },
+ "type":{
+ "type":"string"
+ }
+ },
+ "id":"Syllable"
+ },
+ "AudioType":{
+ "properties":{
+ "id":{
+ "type":"int"
+ },
+ "name":{
+ "type":"string"
+ }
+ },
+ "id":"AudioType"
+ },
+ "Facet":{
+ "properties":{
+ "facetValues":{
+ "type":"Array",
+ "items":{
+ "$ref":"FacetValue"
+ }
+ },
+ "name":{
+ "type":"string"
+ }
+ },
+ "id":"Facet"
+ },
+ "FacetValue":{
+ "properties":{
+ "count":{
+ "type":"long"
+ },
+ "value":{
+ "type":"string"
+ }
+ },
+ "id":"FacetValue"
+ },
+ "Note":{
+ "properties":{
+ "noteType":{
+ "type":"string"
+ },
+ "appliesTo":{
+ "type":"Array",
+ "items":{
+ "type":"string"
+ }
+ },
+ "value":{
+ "type":"string"
+ },
+ "pos":{
+ "type":"int"
+ }
+ },
+ "id":"Note"
+ },
+ "FacetValue":{
+ "properties":{
+ "count":{
+ "type":"long"
+ },
+ "value":{
+ "type":"string"
+ }
+ },
+ "id":"FacetValue"
+ },
+ "Related":{
+ "properties":{
+ "label1":{
+ "type":"string"
+ },
+ "relationshipType":{
+ "type":"string"
+ },
+ "label2":{
+ "type":"string"
+ },
+ "label3":{
+ "type":"string"
+ },
+ "words":{
+ "type":"Array",
+ "items":{
+ "type":"string"
+ }
+ },
+ "gram":{
+ "type":"string"
+ },
+ "label4":{
+ "type":"string"
+ }
+ },
+ "id":"Related"
+ },
+ "WordObject":{
+ "properties":{
+ "id":{
+ "type":"long",
+ "required":true
+ },
+ "word":{
+ "type":"string"
+ },
+ "originalWord":{
+ "type":"string"
+ },
+ "suggestions":{
+ "type":"Array",
+ "items":{
+ "type":"string"
+ }
+ },
+ "canonicalForm":{
+ "type":"string"
+ },
+ "vulgar":{
+ "type":"string"
+ }
+ },
+ "id":"WordObject"
+ },
+ "ScoredWord":{
+ "properties":{
+ "position":{
+ "type":"int"
+ },
+ "id":{
+ "type":"long"
+ },
+ "docTermCount":{
+ "type":"int"
+ },
+ "lemma":{
+ "type":"string"
+ },
+ "wordType":{
+ "type":"string"
+ },
+ "score":{
+ "type":"float"
+ },
+ "sentenceId":{
+ "type":"long"
+ },
+ "word":{
+ "type":"string"
+ },
+ "stopword":{
+ "type":"boolean"
+ },
+ "baseWordScore":{
+ "type":"double"
+ },
+ "partOfSpeech":{
+ "type":"string"
+ }
+ },
+ "id":"ScoredWord"
+ },
+ "Citation":{
+ "properties":{
+ "cite":{
+ "type":"string"
+ },
+ "source":{
+ "type":"string"
+ }
+ },
+ "id":"Citation"
+ },
+ "ExampleSearchResults":{
+ "properties":{
+ "facets":{
+ "type":"Array",
+ "items":{
+ "$ref":"Facet"
+ }
+ },
+ "examples":{
+ "type":"Array",
+ "items":{
+ "$ref":"Example"
+ }
+ }
+ },
+ "id":"ExampleSearchResults"
+ },
+ "Example":{
+ "properties":{
+ "id":{
+ "type":"long"
+ },
+ "exampleId":{
+ "type":"long"
+ },
+ "title":{
+ "type":"string"
+ },
+ "text":{
+ "type":"string"
+ },
+ "score":{
+ "type":"ScoredWord"
+ },
+ "sentence":{
+ "type":"Sentence"
+ },
+ "word":{
+ "type":"string"
+ },
+ "provider":{
+ "type":"ContentProvider"
+ },
+ "year":{
+ "type":"int"
+ },
+ "rating":{
+ "type":"float"
+ },
+ "documentId":{
+ "type":"long"
+ },
+ "url":{
+ "type":"string"
+ }
+ },
+ "id":"Example"
+ },
+ "Sentence":{
+ "properties":{
+ "hasScoredWords":{
+ "type":"boolean"
+ },
+ "id":{
+ "type":"long"
+ },
+ "scoredWords":{
+ "type":"Array",
+ "items":{
+ "$ref":"ScoredWord"
+ }
+ },
+ "display":{
+ "type":"string"
+ },
+ "rating":{
+ "type":"int"
+ },
+ "documentMetadataId":{
+ "type":"long"
+ }
+ },
+ "id":"Sentence"
+ },
+ "ExampleUsage":{
+ "properties":{
+ "text":{
+ "type":"string"
+ }
+ },
+ "id":"ExampleUsage"
+ },
+ "ContentProvider":{
+ "properties":{
+ "id":{
+ "type":"int"
+ },
+ "name":{
+ "type":"string"
+ }
+ },
+ "id":"ContentProvider"
+ },
+ "AudioFile":{
+ "properties":{
+ "attributionUrl":{
+ "type":"string"
+ },
+ "commentCount":{
+ "type":"int"
+ },
+ "voteCount":{
+ "type":"int"
+ },
+ "fileUrl":{
+ "type":"string"
+ },
+ "audioType":{
+ "type":"string"
+ },
+ "id":{
+ "type":"long",
+ "required":true
+ },
+ "duration":{
+ "type":"double"
+ },
+ "attributionText":{
+ "type":"string"
+ },
+ "createdBy":{
+ "type":"string"
+ },
+ "description":{
+ "type":"string"
+ },
+ "createdAt":{
+ "type":"Date"
+ },
+ "voteWeightedAverage":{
+ "type":"float"
+ },
+ "voteAverage":{
+ "type":"float"
+ },
+ "word":{
+ "type":"string"
+ }
+ },
+ "id":"AudioFile"
+ },
+ "Bigram":{
+ "properties":{
+ "count":{
+ "type":"long"
+ },
+ "gram2":{
+ "type":"string"
+ },
+ "gram1":{
+ "type":"string"
+ },
+ "wlmi":{
+ "type":"double"
+ },
+ "mi":{
+ "type":"double"
+ }
+ },
+ "id":"Bigram"
+ },
+ "Label":{
+ "properties":{
+ "text":{
+ "type":"string"
+ },
+ "type":{
+ "type":"string"
+ }
+ },
+ "id":"Label"
+ },
+ "Frequency":{
+ "properties":{
+ "count":{
+ "type":"long"
+ },
+ "year":{
+ "type":"int"
+ }
+ },
+ "id":"Frequency"
+ },
+ "FrequencySummary":{
+ "properties":{
+ "unknownYearCount":{
+ "type":"int"
+ },
+ "totalCount":{
+ "type":"long"
+ },
+ "frequencyString":{
+ "type":"string"
+ },
+ "word":{
+ "type":"string"
+ },
+ "frequency":{
+ "type":"Array",
+ "items":{
+ "$ref":"Frequency"
+ }
+ }
+ },
+ "id":"FrequencySummary"
+ },
+ "Definition":{
+ "properties":{
+ "extendedText":{
+ "type":"string"
+ },
+ "text":{
+ "type":"string"
+ },
+ "sourceDictionary":{
+ "type":"string"
+ },
+ "citations":{
+ "type":"Array",
+ "items":{
+ "$ref":"Citation"
+ }
+ },
+ "labels":{
+ "type":"Array",
+ "items":{
+ "$ref":"Label"
+ }
+ },
+ "score":{
+ "type":"float"
+ },
+ "exampleUses":{
+ "type":"Array",
+ "items":{
+ "$ref":"ExampleUsage"
+ }
+ },
+ "attributionUrl":{
+ "type":"string"
+ },
+ "seqString":{
+ "type":"string"
+ },
+ "attributionText":{
+ "type":"string"
+ },
+ "relatedWords":{
+ "type":"Array",
+ "items":{
+ "$ref":"Related"
+ }
+ },
+ "sequence":{
+ "type":"string"
+ },
+ "word":{
+ "type":"string"
+ },
+ "notes":{
+ "type":"Array",
+ "items":{
+ "$ref":"Note"
+ }
+ },
+ "textProns":{
+ "type":"Array",
+ "items":{
+ "$ref":"TextPron"
+ }
+ },
+ "partOfSpeech":{
+ "type":"string"
+ }
+ },
+ "id":"Definition"
+ },
+ "PartOfSpeech":{
+ "properties":{
+ "roots":{
+ "type":"Array",
+ "items":{
+ "$ref":"root"
+ }
+ },
+ "storageAbbr":{
+ "type":"Array",
+ "items":{
+ "type":"string"
+ }
+ },
+ "allCategories":{
+ "type":"Array",
+ "items":{
+ "$ref":"category"
+ }
+ }
+ },
+ "id":"PartOfSpeech"
+ },
+ "TextPron":{
+ "properties":{
+ "raw":{
+ "type":"string"
+ },
+ "seq":{
+ "type":"int"
+ },
+ "rawType":{
+ "type":"string"
+ }
+ },
+ "id":"TextPron"
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/client/wordnik-api/spec-files/wordList.json b/samples/client/wordnik-api/spec-files/wordList.json
new file mode 100644
index 00000000000..d59821de8b3
--- /dev/null
+++ b/samples/client/wordnik-api/spec-files/wordList.json
@@ -0,0 +1,406 @@
+{
+ "resourcePath":"/wordList",
+ "apis":[
+ {
+ "path":"/wordList.{format}/{permalink}",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"permalink",
+ "description":"permalink of WordList to update",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "description":"Updated WordList",
+ "required":false,
+ "dataType":"WordList",
+ "valueTypeInternal":"com.wordnik.community.entity.WordList",
+ "allowMultiple":false,
+ "paramType":"body"
+ },
+ {
+ "name":"auth_token",
+ "description":"The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"header"
+ }
+ ],
+ "summary":"Updates an existing WordList",
+ "httpMethod":"PUT",
+ "errorResponses":[
+ {
+ "reason":"Invalid ID supplied",
+ "code":400
+ },
+ {
+ "reason":"Not Authorized to update WordList",
+ "code":403
+ },
+ {
+ "reason":"WordList not found",
+ "code":404
+ }
+ ],
+ "nickname":"updateWordList",
+ "responseClass":"void"
+ },
+ {
+ "parameters":[
+ {
+ "name":"permalink",
+ "description":"ID of WordList to delete",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"auth_token",
+ "description":"The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"header"
+ }
+ ],
+ "summary":"Deletes an existing WordList",
+ "httpMethod":"DELETE",
+ "errorResponses":[
+ {
+ "reason":"Invalid ID supplied",
+ "code":400
+ },
+ {
+ "reason":"Not Authorized to delete WordList",
+ "code":403
+ },
+ {
+ "reason":"WordList not found",
+ "code":404
+ }
+ ],
+ "nickname":"deleteWordList",
+ "responseClass":"void"
+ },
+ {
+ "parameters":[
+ {
+ "name":"permalink",
+ "description":"permalink of WordList to fetch",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"auth_token",
+ "description":"The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"header"
+ }
+ ],
+ "summary":"Fetches a WordList by ID",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid ID supplied",
+ "code":400
+ },
+ {
+ "reason":"Not Authorized to access WordList",
+ "code":403
+ },
+ {
+ "reason":"WordList not found",
+ "code":404
+ }
+ ],
+ "nickname":"getWordListByPermalink",
+ "responseClass":"WordList"
+ }
+ ]
+ },
+ {
+ "path":"/wordList.{format}/{permalink}/words",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"permalink",
+ "description":"permalink of WordList to user",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "description":"Array of words to add to WordList",
+ "required":false,
+ "dataType":"Array[StringValue]",
+ "valueTypeInternal":"com.wordnik.resource.StringValue",
+ "allowMultiple":false,
+ "paramType":"body"
+ },
+ {
+ "name":"auth_token",
+ "description":"The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"header"
+ }
+ ],
+ "summary":"Adds words to a WordList",
+ "httpMethod":"POST",
+ "errorResponses":[
+ {
+ "reason":"Invalid permalink supplied",
+ "code":400
+ },
+ {
+ "reason":"Not Authorized to access WordList",
+ "code":403
+ },
+ {
+ "reason":"WordList not found",
+ "code":404
+ }
+ ],
+ "nickname":"addWordsToWordList",
+ "responseClass":"void"
+ },
+ {
+ "parameters":[
+ {
+ "name":"permalink",
+ "description":"ID of WordList to use",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"sortBy",
+ "defaultValue":"createDate",
+ "description":"Field to sort by",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "createDate",
+ "alpha"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"sortOrder",
+ "defaultValue":"desc",
+ "description":"Direction to sort",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "asc",
+ "desc"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"skip",
+ "defaultValue":"0",
+ "description":"Results to skip",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"limit",
+ "defaultValue":"100",
+ "description":"Maximum number of results to return",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"auth_token",
+ "description":"The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"header"
+ }
+ ],
+ "summary":"Fetches words in a WordList",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid ID supplied",
+ "code":400
+ },
+ {
+ "reason":"Not Authorized to access WordList",
+ "code":403
+ },
+ {
+ "reason":"WordList not found",
+ "code":404
+ }
+ ],
+ "nickname":"getWordListWords",
+ "responseClass":"List[WordListWord]"
+ }
+ ]
+ },
+ {
+ "path":"/wordList.{format}/{permalink}/deleteWords",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"permalink",
+ "description":"permalink of WordList to use",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "description":"Words to remove from WordList",
+ "required":false,
+ "dataType":"Array[StringValue]",
+ "valueTypeInternal":"com.wordnik.resource.StringValue",
+ "allowMultiple":false,
+ "paramType":"body"
+ },
+ {
+ "name":"auth_token",
+ "description":"The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"header"
+ }
+ ],
+ "summary":"Removes words from a WordList",
+ "httpMethod":"POST",
+ "errorResponses":[
+ {
+ "reason":"Invalid permalink supplied",
+ "code":400
+ },
+ {
+ "reason":"Not Authorized to modify WordList",
+ "code":403
+ },
+ {
+ "reason":"WordList not found",
+ "code":404
+ }
+ ],
+ "nickname":"deleteWordsFromWordList",
+ "responseClass":"void"
+ }
+ ]
+ }
+ ],
+ "apiVersion":"4.0",
+ "swaggerVersion":"1.0",
+ "basePath":"http://api.wordnik.com/v4",
+ "models":{
+ "WordList":{
+ "properties":{
+ "updatedAt":{
+ "type":"Date"
+ },
+ "id":{
+ "type":"long",
+ "required":true
+ },
+ "username":{
+ "type":"string"
+ },
+ "permalink":{
+ "type":"string"
+ },
+ "lastActivityAt":{
+ "type":"Date"
+ },
+ "createdAt":{
+ "type":"Date"
+ },
+ "description":{
+ "type":"string"
+ },
+ "userId":{
+ "type":"long"
+ },
+ "name":{
+ "type":"string"
+ },
+ "numberWordsInList":{
+ "type":"long"
+ },
+ "type":{
+ "type":"string"
+ }
+ },
+ "id":"WordList"
+ },
+ "WordListWord":{
+ "properties":{
+ "id":{
+ "type":"long",
+ "required":true
+ },
+ "username":{
+ "type":"string"
+ },
+ "createdAt":{
+ "type":"Date"
+ },
+ "numberCommentsOnWord":{
+ "type":"long"
+ },
+ "userId":{
+ "type":"long"
+ },
+ "word":{
+ "type":"string"
+ },
+ "numberLists":{
+ "type":"long"
+ }
+ },
+ "id":"WordListWord"
+ },
+ "StringValue":{
+ "properties":{
+ "word":{
+ "type":"string"
+ }
+ },
+ "id":"StringValue"
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/client/wordnik-api/spec-files/wordLists.json b/samples/client/wordnik-api/spec-files/wordLists.json
new file mode 100644
index 00000000000..677053cc5b8
--- /dev/null
+++ b/samples/client/wordnik-api/spec-files/wordLists.json
@@ -0,0 +1,93 @@
+{
+ "resourcePath":"/wordLists",
+ "apis":[
+ {
+ "path":"/wordLists.{format}",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "description":"WordList to create",
+ "required":false,
+ "dataType":"WordList",
+ "valueTypeInternal":"com.wordnik.community.entity.WordList",
+ "allowMultiple":false,
+ "paramType":"body"
+ },
+ {
+ "name":"auth_token",
+ "description":"The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"header"
+ }
+ ],
+ "summary":"Creates a WordList.",
+ "httpMethod":"POST",
+ "errorResponses":[
+ {
+ "reason":"Invalid WordList supplied or mandatory fields are missing",
+ "code":400
+ },
+ {
+ "reason":"Not authenticated",
+ "code":403
+ },
+ {
+ "reason":"WordList owner not found",
+ "code":404
+ }
+ ],
+ "nickname":"createWordList",
+ "responseClass":"WordList"
+ }
+ ]
+ }
+ ],
+ "apiVersion":"4.0",
+ "swaggerVersion":"1.0",
+ "basePath":"http://api.wordnik.com/v4",
+ "models":{
+ "WordList":{
+ "properties":{
+ "updatedAt":{
+ "type":"Date"
+ },
+ "id":{
+ "type":"long",
+ "required":true
+ },
+ "username":{
+ "type":"string"
+ },
+ "permalink":{
+ "type":"string"
+ },
+ "lastActivityAt":{
+ "type":"Date"
+ },
+ "createdAt":{
+ "type":"Date"
+ },
+ "description":{
+ "type":"string"
+ },
+ "userId":{
+ "type":"long"
+ },
+ "name":{
+ "type":"string"
+ },
+ "numberWordsInList":{
+ "type":"long"
+ },
+ "type":{
+ "type":"string"
+ }
+ },
+ "id":"WordList"
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/client/wordnik-api/spec-files/words.json b/samples/client/wordnik-api/spec-files/words.json
new file mode 100644
index 00000000000..471e07cf4a4
--- /dev/null
+++ b/samples/client/wordnik-api/spec-files/words.json
@@ -0,0 +1,1262 @@
+{
+ "resourcePath":"/words",
+ "apis":[
+ {
+ "path":"/words.{format}/search/{query}",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"query",
+ "description":"Search query",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"path"
+ },
+ {
+ "name":"caseSensitive",
+ "defaultValue":"true",
+ "description":"Search case sensitive",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "true",
+ "false"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"includePartOfSpeech",
+ "description":"Only include these comma-delimited parts of speech",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "noun",
+ "adjective",
+ "verb",
+ "adverb",
+ "interjection",
+ "pronoun",
+ "preposition",
+ "abbreviation",
+ "affix",
+ "article",
+ "auxiliary-verb",
+ "conjunction",
+ "definite-article",
+ "family-name",
+ "given-name",
+ "idiom",
+ "imperative",
+ "noun-plural",
+ "noun-posessive",
+ "past-participle",
+ "phrasal-prefix",
+ "proper-noun",
+ "proper-noun-plural",
+ "proper-noun-posessive",
+ "suffix",
+ "verb-intransitive",
+ "verb-transitive"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"excludePartOfSpeech",
+ "description":"Exclude these comma-delimited parts of speech",
+ "required":false,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"minCorpusCount",
+ "defaultValue":"5",
+ "description":"Minimum corpus frequency for terms",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":"Infinity",
+ "min":0.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"maxCorpusCount",
+ "defaultValue":"-1",
+ "description":"Maximum corpus frequency for terms",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":"Infinity",
+ "min":0.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"minDictionaryCount",
+ "defaultValue":"1",
+ "description":"Minimum number of dictionary entries for words returned",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":"Infinity",
+ "min":0.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"maxDictionaryCount",
+ "defaultValue":"-1",
+ "description":"Maximum dictionary definition count",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":"Infinity",
+ "min":0.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"minLength",
+ "defaultValue":"1",
+ "description":"Minimum word length",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":1024.0,
+ "min":0.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"maxLength",
+ "defaultValue":"-1",
+ "description":"Maximum word length",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":1024.0,
+ "min":0.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"skip",
+ "defaultValue":"0",
+ "description":"Results to skip",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":1000.0,
+ "min":0.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"limit",
+ "defaultValue":"10",
+ "description":"Maximum number of results to return",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":1000.0,
+ "min":1.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Searches words",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid query supplied.",
+ "code":400
+ }
+ ],
+ "nickname":"searchWords",
+ "responseClass":"WordSearchResults"
+ }
+ ]
+ },
+ {
+ "path":"/words.{format}/wordOfTheDay",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"date",
+ "description":"Fetches by date in yyyy-MM-dd",
+ "required":false,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Returns a specific WordOfTheDay",
+ "httpMethod":"GET",
+ "nickname":"getWordOfTheDay",
+ "responseClass":"WordOfTheDay"
+ }
+ ]
+ },
+ {
+ "path":"/words.{format}/reverseDictionary",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"query",
+ "description":"Search term",
+ "required":true,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"findSenseForWord",
+ "description":"Restricts words and finds closest sense",
+ "required":false,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"includeSourceDictionaries",
+ "description":"Only include these comma-delimited source dictionaries",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "ahd",
+ " century",
+ " wiktionary",
+ " webster",
+ " wordnet"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"excludeSourceDictionaries",
+ "description":"Exclude these comma-delimited source dictionaries",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "ahd",
+ " century",
+ " wiktionary",
+ " webster",
+ " wordnet"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"includePartOfSpeech",
+ "description":"Only include these comma-delimited parts of speech",
+ "required":false,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"excludePartOfSpeech",
+ "description":"Exclude these comma-delimited parts of speech",
+ "required":false,
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"minCorpusCount",
+ "defaultValue":"5",
+ "description":"Minimum corpus frequency for terms",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":"Infinity",
+ "min":0.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"maxCorpusCount",
+ "defaultValue":"-1",
+ "description":"Maximum corpus frequency for terms",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":"Infinity",
+ "min":0.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"minLength",
+ "defaultValue":"1",
+ "description":"Minimum word length",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":1024.0,
+ "min":0.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"maxLength",
+ "defaultValue":"-1",
+ "description":"Maximum word length",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":1024.0,
+ "min":0.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"expandTerms",
+ "description":"Expand terms",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "synonym",
+ "hypernym"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"includeTags",
+ "defaultValue":"false",
+ "description":"Return a closed set of XML tags in response",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "false",
+ "true"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"sortBy",
+ "description":"Attribute to sort by",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "alpha",
+ "count",
+ "length"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"sortOrder",
+ "description":"Sort direction",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "asc",
+ "desc"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"skip",
+ "defaultValue":"0",
+ "description":"Results to skip",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":1000.0,
+ "min":0.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"limit",
+ "defaultValue":"10",
+ "description":"Maximum number of results to return",
+ "required":false,
+ "allowableValues":{
+ "valueType":"RANGE",
+ "max":1000.0,
+ "min":1.0,
+ "valueType":"RANGE"
+ },
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Reverse dictionary search",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid term supplied.",
+ "code":400
+ }
+ ],
+ "nickname":"reverseDictionary",
+ "responseClass":"DefinitionSearchResults"
+ }
+ ]
+ },
+ {
+ "path":"/words.{format}/randomWords",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"hasDictionaryDef",
+ "defaultValue":"true",
+ "description":"Only return words with dictionary definitions",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "false",
+ "true"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"includePartOfSpeech",
+ "description":"CSV part-of-speech values to include",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "noun",
+ "adjective",
+ "verb",
+ "adverb",
+ "interjection",
+ "pronoun",
+ "preposition",
+ "abbreviation",
+ "affix",
+ "article",
+ "auxiliary-verb",
+ "conjunction",
+ "definite-article",
+ "family-name",
+ "given-name",
+ "idiom",
+ "imperative",
+ "noun-plural",
+ "noun-posessive",
+ "past-participle",
+ "phrasal-prefix",
+ "proper-noun",
+ "proper-noun-plural",
+ "proper-noun-posessive",
+ "suffix",
+ "verb-intransitive",
+ "verb-transitive"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"excludePartOfSpeech",
+ "description":"CSV part-of-speech values to exclude",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "noun",
+ "adjective",
+ "verb",
+ "adverb",
+ "interjection",
+ "pronoun",
+ "preposition",
+ "abbreviation",
+ "affix",
+ "article",
+ "auxiliary-verb",
+ "conjunction",
+ "definite-article",
+ "family-name",
+ "given-name",
+ "idiom",
+ "imperative",
+ "noun-plural",
+ "noun-posessive",
+ "past-participle",
+ "phrasal-prefix",
+ "proper-noun",
+ "proper-noun-plural",
+ "proper-noun-posessive",
+ "suffix",
+ "verb-intransitive",
+ "verb-transitive"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"minCorpusCount",
+ "defaultValue":"0",
+ "description":"Minimum corpus frequency for terms",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"maxCorpusCount",
+ "defaultValue":"-1",
+ "description":"Maximum corpus frequency for terms",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"minDictionaryCount",
+ "defaultValue":"1",
+ "description":"Minimum dictionary count",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"maxDictionaryCount",
+ "defaultValue":"-1",
+ "description":"Maximum dictionary count",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"minLength",
+ "defaultValue":"5",
+ "description":"Minimum word length",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"maxLength",
+ "defaultValue":"-1",
+ "description":"Maximum word length",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"sortBy",
+ "description":"Attribute to sort by",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "alpha",
+ "count"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"sortOrder",
+ "description":"Sort direction",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "asc",
+ "desc"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"limit",
+ "defaultValue":"10",
+ "description":"Maximum number of results to return",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Returns an array of random WordObjects",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"Invalid term supplied.",
+ "code":400
+ },
+ {
+ "reason":"No results.",
+ "code":404
+ }
+ ],
+ "nickname":"getRandomWords",
+ "responseClass":"List[WordObject]"
+ }
+ ]
+ },
+ {
+ "path":"/words.{format}/randomWord",
+ "description":"",
+ "operations":[
+ {
+ "parameters":[
+ {
+ "name":"hasDictionaryDef",
+ "defaultValue":"true",
+ "description":"Only return words with dictionary definitions",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "false",
+ "true"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"includePartOfSpeech",
+ "description":"CSV part-of-speech values to include",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "noun",
+ "adjective",
+ "verb",
+ "adverb",
+ "interjection",
+ "pronoun",
+ "preposition",
+ "abbreviation",
+ "affix",
+ "article",
+ "auxiliary-verb",
+ "conjunction",
+ "definite-article",
+ "family-name",
+ "given-name",
+ "idiom",
+ "imperative",
+ "noun-plural",
+ "noun-posessive",
+ "past-participle",
+ "phrasal-prefix",
+ "proper-noun",
+ "proper-noun-plural",
+ "proper-noun-posessive",
+ "suffix",
+ "verb-intransitive",
+ "verb-transitive"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"excludePartOfSpeech",
+ "description":"CSV part-of-speech values to exclude",
+ "required":false,
+ "allowableValues":{
+ "valueType":"LIST",
+ "values":[
+ "noun",
+ "adjective",
+ "verb",
+ "adverb",
+ "interjection",
+ "pronoun",
+ "preposition",
+ "abbreviation",
+ "affix",
+ "article",
+ "auxiliary-verb",
+ "conjunction",
+ "definite-article",
+ "family-name",
+ "given-name",
+ "idiom",
+ "imperative",
+ "noun-plural",
+ "noun-posessive",
+ "past-participle",
+ "phrasal-prefix",
+ "proper-noun",
+ "proper-noun-plural",
+ "proper-noun-posessive",
+ "suffix",
+ "verb-intransitive",
+ "verb-transitive"
+ ],
+ "valueType":"LIST"
+ },
+ "dataType":"string",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"minCorpusCount",
+ "defaultValue":"0",
+ "description":"Minimum corpus frequency for terms",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"maxCorpusCount",
+ "defaultValue":"-1",
+ "description":"Maximum corpus frequency for terms",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"minDictionaryCount",
+ "defaultValue":"1",
+ "description":"Minimum dictionary count",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"maxDictionaryCount",
+ "defaultValue":"-1",
+ "description":"Maximum dictionary count",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"minLength",
+ "defaultValue":"5",
+ "description":"Minimum word length",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ },
+ {
+ "name":"maxLength",
+ "defaultValue":"-1",
+ "description":"Maximum word length",
+ "required":false,
+ "dataType":"int",
+ "allowMultiple":false,
+ "paramType":"query"
+ }
+ ],
+ "summary":"Returns a single random WordObject",
+ "httpMethod":"GET",
+ "errorResponses":[
+ {
+ "reason":"No word found.",
+ "code":404
+ }
+ ],
+ "nickname":"getRandomWord",
+ "responseClass":"WordObject"
+ }
+ ]
+ }
+ ],
+ "apiVersion":"4.0",
+ "swaggerVersion":"1.0",
+ "basePath":"http://api.wordnik.com/v4",
+ "models":{
+ "WordSearchResult":{
+ "properties":{
+ "count":{
+ "type":"long"
+ },
+ "lexicality":{
+ "type":"double"
+ },
+ "word":{
+ "type":"string"
+ }
+ },
+ "id":"WordSearchResult"
+ },
+ "WordOfTheDay":{
+ "properties":{
+ "id":{
+ "type":"long",
+ "required":true
+ },
+ "parentId":{
+ "type":"string"
+ },
+ "category":{
+ "type":"string"
+ },
+ "createdBy":{
+ "type":"string"
+ },
+ "createdAt":{
+ "type":"Date"
+ },
+ "contentProvider":{
+ "type":"ContentProvider"
+ },
+ "htmlExtra":{
+ "type":"string"
+ },
+ "word":{
+ "type":"string"
+ },
+ "definitions":{
+ "type":"Array",
+ "items":{
+ "$ref":"SimpleDefinition"
+ }
+ },
+ "examples":{
+ "type":"Array",
+ "items":{
+ "$ref":"SimpleExample"
+ }
+ },
+ "note":{
+ "type":"string"
+ },
+ "publishDate":{
+ "type":"Date"
+ }
+ },
+ "id":"WordOfTheDay"
+ },
+ "Note":{
+ "properties":{
+ "noteType":{
+ "type":"string"
+ },
+ "appliesTo":{
+ "type":"Array",
+ "items":{
+ "type":"string"
+ }
+ },
+ "value":{
+ "type":"string"
+ },
+ "pos":{
+ "type":"int"
+ }
+ },
+ "id":"Note"
+ },
+ "DefinitionSearchResults":{
+ "properties":{
+ "results":{
+ "type":"Array",
+ "items":{
+ "$ref":"Definition"
+ }
+ },
+ "totalResults":{
+ "type":"int"
+ }
+ },
+ "id":"DefinitionSearchResults"
+ },
+ "WordObject":{
+ "properties":{
+ "id":{
+ "type":"long",
+ "required":true
+ },
+ "word":{
+ "type":"string"
+ },
+ "originalWord":{
+ "type":"string"
+ },
+ "suggestions":{
+ "type":"Array",
+ "items":{
+ "type":"string"
+ }
+ },
+ "canonicalForm":{
+ "type":"string"
+ },
+ "vulgar":{
+ "type":"string"
+ }
+ },
+ "id":"WordObject"
+ },
+ "Related":{
+ "properties":{
+ "label1":{
+ "type":"string"
+ },
+ "relationshipType":{
+ "type":"string"
+ },
+ "label2":{
+ "type":"string"
+ },
+ "label3":{
+ "type":"string"
+ },
+ "words":{
+ "type":"Array",
+ "items":{
+ "type":"string"
+ }
+ },
+ "gram":{
+ "type":"string"
+ },
+ "label4":{
+ "type":"string"
+ }
+ },
+ "id":"Related"
+ },
+ "Citation":{
+ "properties":{
+ "cite":{
+ "type":"string"
+ },
+ "source":{
+ "type":"string"
+ }
+ },
+ "id":"Citation"
+ },
+ "WordSearchResults":{
+ "properties":{
+ "searchResults":{
+ "type":"Array",
+ "items":{
+ "$ref":"WordSearchResult"
+ }
+ },
+ "totalResults":{
+ "type":"int"
+ }
+ },
+ "id":"WordSearchResults"
+ },
+ "Category":{
+ "properties":{
+ "id":{
+ "type":"long",
+ "required":true
+ },
+ "name":{
+ "type":"string"
+ }
+ },
+ "id":"Category"
+ },
+ "SimpleDefinition":{
+ "properties":{
+ "text":{
+ "type":"string"
+ },
+ "source":{
+ "type":"string"
+ },
+ "note":{
+ "type":"string"
+ },
+ "partOfSpeech":{
+ "type":"string"
+ }
+ },
+ "id":"SimpleDefinition"
+ },
+ "Root":{
+ "properties":{
+ "id":{
+ "type":"long",
+ "required":true
+ },
+ "name":{
+ "type":"string"
+ },
+ "categories":{
+ "type":"Array",
+ "items":{
+ "$ref":"Category"
+ }
+ }
+ },
+ "id":"Root"
+ },
+ "ExampleUsage":{
+ "properties":{
+ "text":{
+ "type":"string"
+ }
+ },
+ "id":"ExampleUsage"
+ },
+ "ContentProvider":{
+ "properties":{
+ "id":{
+ "type":"int"
+ },
+ "name":{
+ "type":"string"
+ }
+ },
+ "id":"ContentProvider"
+ },
+ "Label":{
+ "properties":{
+ "text":{
+ "type":"string"
+ },
+ "type":{
+ "type":"string"
+ }
+ },
+ "id":"Label"
+ },
+ "SimpleExample":{
+ "properties":{
+ "id":{
+ "type":"long"
+ },
+ "title":{
+ "type":"string"
+ },
+ "text":{
+ "type":"string"
+ },
+ "url":{
+ "type":"string"
+ }
+ },
+ "id":"SimpleExample"
+ },
+ "Definition":{
+ "properties":{
+ "extendedText":{
+ "type":"string"
+ },
+ "text":{
+ "type":"string"
+ },
+ "sourceDictionary":{
+ "type":"string"
+ },
+ "citations":{
+ "type":"Array",
+ "items":{
+ "$ref":"Citation"
+ }
+ },
+ "labels":{
+ "type":"Array",
+ "items":{
+ "$ref":"Label"
+ }
+ },
+ "score":{
+ "type":"float"
+ },
+ "exampleUses":{
+ "type":"Array",
+ "items":{
+ "$ref":"ExampleUsage"
+ }
+ },
+ "attributionUrl":{
+ "type":"string"
+ },
+ "seqString":{
+ "type":"string"
+ },
+ "attributionText":{
+ "type":"string"
+ },
+ "relatedWords":{
+ "type":"Array",
+ "items":{
+ "$ref":"Related"
+ }
+ },
+ "sequence":{
+ "type":"string"
+ },
+ "word":{
+ "type":"string"
+ },
+ "notes":{
+ "type":"Array",
+ "items":{
+ "$ref":"Note"
+ }
+ },
+ "textProns":{
+ "type":"Array",
+ "items":{
+ "$ref":"TextPron"
+ }
+ },
+ "partOfSpeech":{
+ "type":"string"
+ }
+ },
+ "id":"Definition"
+ },
+ "PartOfSpeech":{
+ "properties":{
+ "roots":{
+ "type":"Array",
+ "items":{
+ "$ref":"Root"
+ }
+ },
+ "storageAbbr":{
+ "type":"Array",
+ "items":{
+ "type":"string"
+ }
+ },
+ "allCategories":{
+ "type":"Array",
+ "items":{
+ "$ref":"Category"
+ }
+ }
+ },
+ "id":"PartOfSpeech"
+ },
+ "TextPron":{
+ "properties":{
+ "raw":{
+ "type":"string"
+ },
+ "seq":{
+ "type":"int"
+ },
+ "rawType":{
+ "type":"string"
+ }
+ },
+ "id":"TextPron"
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/scala/apiInvoker.mustache b/src/main/resources/scala/apiInvoker.mustache
index a0e443dba00..21fd676f41e 100644
--- a/src/main/resources/scala/apiInvoker.mustache
+++ b/src/main/resources/scala/apiInvoker.mustache
@@ -1,4 +1,4 @@
-package {{package}}
+package {{invokerPackage}}
import com.sun.jersey.api.client.Client
import com.sun.jersey.api.client.ClientResponse
diff --git a/src/main/resources/scala/pom.mustache b/src/main/resources/scala/pom.mustache
index 907976e6a42..db4d42b573e 100644
--- a/src/main/resources/scala/pom.mustache
+++ b/src/main/resources/scala/pom.mustache
@@ -1,224 +1,199 @@
- 4.0.0
- com.wordnik
- swagger-client
- jar
- swagger-client
- 1.0
-
- scm:git:git@github.com:wordnik/swagger-mustache.git
- scm:git:git@github.com:wordnik/swagger-mustache.git
- https://github.com/wordnik/swagger-mustache
-
-
- 2.2.0
-
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ 4.0.0
+ com.wordnik
+ swagger-client
+ jar
+ swagger-client
+ 1.0
+
+ 2.2.0
+
-
-
- scala-tools.org
- Scala-Tools Maven2 Repository
- http://scala-tools.org/repo-releases
-
-
- maven-mongodb-plugin-repo
- maven mongodb plugin repository
- http://maven-mongodb-plugin.googlecode.com/svn/maven/repo
- default
-
-
+
+
+ scala-tools.org
+ Scala-Tools Maven2 Repository
+ http://scala-tools.org/repo-releases
+
+
+ maven-mongodb-plugin-repo
+ maven mongodb plugin repository
+ http://maven-mongodb-plugin.googlecode.com/svn/maven/repo
+ default
+
+
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.12
-
-
-
- loggerPath
- conf/log4j.properties
-
-
- -Xms512m -Xmx1500m
- methods
- pertest
-
-
-
- maven-dependency-plugin
-
-
- package
-
- copy-dependencies
-
-
- ${project.build.directory}/lib
-
-
-
-
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.12
+
+
+
+ loggerPath
+ conf/log4j.properties
+
+
+ -Xms512m -Xmx1500m
+ methods
+ pertest
+
+
+
+ maven-dependency-plugin
+
+
+ package
+
+ copy-dependencies
+
+
+ ${project.build.directory}/lib
+
+
+
+
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- 2.2
-
-
-
- jar
- test-jar
-
-
-
-
-
-
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.2
+
+
+
+ jar
+ test-jar
+
+
+
+
+
+
-
- org.codehaus.mojo
- build-helper-maven-plugin
-
-
- add_sources
- generate-sources
-
- add-source
-
-
-
- src/main/java
-
-
-
-
- add_test_sources
- generate-test-sources
-
- add-test-source
-
-
-
- src/test/java
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 2.3.2
-
- 1.6
- 1.6
-
-
-
- org.scala-tools
- maven-scala-plugin
- 2.15.2
-
-
- scala-compile-first
- process-resources
-
- add-source
- compile
-
-
-
- scala-test-compile
- process-test-resources
-
- testCompile
-
-
-
-
-
- -Xms128m
- -Xmx1500m
-
-
-
-
-
-
-
-
- org.scala-tools
- maven-scala-plugin
-
- ${scala-version}
-
-
-
-
-
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+
+
+ add_sources
+ generate-sources
+
+ add-source
+
+
+
+ src/main/java
+
+
+
+
+ add_test_sources
+ generate-test-sources
+
+ add-test-source
+
+
+
+ src/test/java
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 2.3.2
+
+ 1.6
+ 1.6
+
+
+
+ org.scala-tools
+ maven-scala-plugin
+ 2.15.2
+
+
+ scala-compile-first
+ process-resources
+
+ add-source
+ compile
+
+
+
+ scala-test-compile
+ process-test-resources
+
+ testCompile
+
+
+
+
+
+ -Xms128m
+ -Xmx1500m
+
+
+
+
+
+
+
+
+ org.scala-tools
+ maven-scala-plugin
+
+ ${scala-version}
+
+
+
+
+
com.sun.jersey
jersey-client
${jersey-version}
compile
-
- org.scala-lang
- scala-library
- ${scala-version}
- compile
-
-
- com.wordnik
- swagger-core_2.9.1
- ${swagger-core-version}
- compile
-
-
- org.scalatest
- scalatest_2.9.1
- ${scala-test-version}
- test
-
-
- junit
- junit
- ${junit-version}
- test
-
-
-
-
- scala-tools.org
- Scala-Tools Maven2 Repository
- http://scala-tools.org/repo-releases
-
-
- wordnik-ci-aws
- https://ci.aws.wordnik.com/artifactory/libs-snapshots/
-
-
- wordnik-ci-aws-maven
- https://ci.aws.wordnik.com/artifactory/m2-snapshots/
-
-
- wordnik-ci-aws-remote
- https://ci.aws.wordnik.com/artifactory/remote-repos/
-
-
-
-
+
+ org.scala-lang
+ scala-library
+ ${scala-version}
+ compile
+
+
+ com.wordnik
+ swagger-core_2.9.1
+ ${swagger-core-version}
+ compile
+
+
+ org.scalatest
+ scalatest_2.9.1
+ ${scala-test-version}
+ test
+
+
+ junit
+ junit
+ ${junit-version}
+ test
+
+
+
1.7
1.1.0
- 2.9.1-1
- 4.8.1
- 1.0.0
- 1.6.1
- 4.8.1
- 1.6.1
-
-
+ 2.9.1-1
+ 4.8.1
+ 1.0.0
+ 1.6.1
+ 4.8.1
+ 1.6.1
+
+
\ No newline at end of file
diff --git a/src/main/scala/com/wordnik/swagger/codegen/BasicScalaGenerator.scala b/src/main/scala/com/wordnik/swagger/codegen/BasicScalaGenerator.scala
index fcbe8f107ca..eca723e5433 100644
--- a/src/main/scala/com/wordnik/swagger/codegen/BasicScalaGenerator.scala
+++ b/src/main/scala/com/wordnik/swagger/codegen/BasicScalaGenerator.scala
@@ -33,6 +33,7 @@ class BasicScalaGenerator extends BasicGenerator {
"Any")
override def typeMapping = Map(
+ "boolean" -> "Boolean",
"string" -> "String",
"int" -> "Int",
"float" -> "Float",
diff --git a/src/test/scala/ScalaCodegenConfigTest.scala b/src/test/scala/ScalaCodegenConfigTest.scala
index c6859f4df47..26593c42e12 100644
--- a/src/test/scala/ScalaCodegenConfigTest.scala
+++ b/src/test/scala/ScalaCodegenConfigTest.scala
@@ -69,6 +69,7 @@ class BasicScalaGeneratorTest extends FlatSpec with ShouldMatchers {
* types
*/
it should "convert to a declared type" in {
+ config.toDeclaredType("boolean") should be ("Boolean")
config.toDeclaredType("string") should be ("String")
config.toDeclaredType("int") should be ("Int")
config.toDeclaredType("float") should be ("Float")