forked from loafle/openapi-generator-original
added files
This commit is contained in:
parent
69dceb7f69
commit
585311c06a
214
samples/client/wordnik/scala/pom.xml
Normal file
214
samples/client/wordnik/scala/pom.xml
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.wordnik</groupId>
|
||||||
|
<artifactId>swagger-client</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>swagger-client</name>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<prerequisites>
|
||||||
|
<maven>2.2.0</maven>
|
||||||
|
</prerequisites>
|
||||||
|
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>maven-mongodb-plugin-repo</id>
|
||||||
|
<name>maven mongodb plugin repository</name>
|
||||||
|
<url>http://maven-mongodb-plugin.googlecode.com/svn/maven/repo</url>
|
||||||
|
<layout>default</layout>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.12</version>
|
||||||
|
<configuration>
|
||||||
|
<systemProperties>
|
||||||
|
<property>
|
||||||
|
<name>loggerPath</name>
|
||||||
|
<value>conf/log4j.properties</value>
|
||||||
|
</property>
|
||||||
|
</systemProperties>
|
||||||
|
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||||
|
<parallel>methods</parallel>
|
||||||
|
<forkMode>pertest</forkMode>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-dependencies</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- attach test jar -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
<goal>test-jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>add_sources</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-source</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>src/main/java</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>add_test_sources</id>
|
||||||
|
<phase>generate-test-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-test-source</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>src/test/java</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>2.3.2</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.6</source>
|
||||||
|
<target>1.6</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>net.alchim31.maven</groupId>
|
||||||
|
<artifactId>scala-maven-plugin</artifactId>
|
||||||
|
<version>${scala-maven-plugin-version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>scala-compile-first</id>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-source</goal>
|
||||||
|
<goal>compile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>scala-test-compile</id>
|
||||||
|
<phase>process-test-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>testCompile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<jvmArgs>
|
||||||
|
<jvmArg>-Xms128m</jvmArg>
|
||||||
|
<jvmArg>-Xmx1500m</jvmArg>
|
||||||
|
</jvmArgs>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<reporting>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.scala-tools</groupId>
|
||||||
|
<artifactId>maven-scala-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<scalaVersion>${scala-version}</scalaVersion>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</reporting>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.module</groupId>
|
||||||
|
<artifactId>jackson-module-scala_2.10</artifactId>
|
||||||
|
<version>${jackson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.jersey</groupId>
|
||||||
|
<artifactId>jersey-client</artifactId>
|
||||||
|
<version>${jersey-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.jersey.contribs</groupId>
|
||||||
|
<artifactId>jersey-multipart</artifactId>
|
||||||
|
<version>${jersey-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.scala-lang</groupId>
|
||||||
|
<artifactId>scala-library</artifactId>
|
||||||
|
<version>${scala-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.wordnik</groupId>
|
||||||
|
<artifactId>swagger-core</artifactId>
|
||||||
|
<version>${swagger-core-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.scalatest</groupId>
|
||||||
|
<artifactId>scalatest_2.10</artifactId>
|
||||||
|
<version>${scala-test-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>${junit-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>joda-time</groupId>
|
||||||
|
<artifactId>joda-time</artifactId>
|
||||||
|
<version>${joda-time-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.joda</groupId>
|
||||||
|
<artifactId>joda-convert</artifactId>
|
||||||
|
<version>${joda-version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<scala-version>2.10.4</scala-version>
|
||||||
|
<joda-version>1.2</joda-version>
|
||||||
|
<joda-time-version>2.2</joda-time-version>
|
||||||
|
<jersey-version>1.7</jersey-version>
|
||||||
|
<swagger-core-version>1.5.0-M1</swagger-core-version>
|
||||||
|
<maven-plugin.version>1.0.0</maven-plugin.version>
|
||||||
|
<jackson-version>2.4.2</jackson-version>
|
||||||
|
|
||||||
|
<junit-version>4.8.1</junit-version>
|
||||||
|
<scala-maven-plugin-version>3.1.5</scala-maven-plugin-version>
|
||||||
|
<scala-test-version>2.1.3</scala-test-version>
|
||||||
|
</properties>
|
||||||
|
</project>
|
@ -0,0 +1,164 @@
|
|||||||
|
package io.swagger.client
|
||||||
|
|
||||||
|
import com.sun.jersey.api.client.Client
|
||||||
|
import com.sun.jersey.api.client.ClientResponse
|
||||||
|
import com.sun.jersey.api.client.config.ClientConfig
|
||||||
|
import com.sun.jersey.api.client.config.DefaultClientConfig
|
||||||
|
import com.sun.jersey.api.client.filter.LoggingFilter
|
||||||
|
|
||||||
|
import com.sun.jersey.multipart.FormDataMultiPart
|
||||||
|
import com.sun.jersey.multipart.file.FileDataBodyPart
|
||||||
|
|
||||||
|
import java.io.File
|
||||||
|
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 escape(value: String): String = {
|
||||||
|
URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20")
|
||||||
|
}
|
||||||
|
|
||||||
|
def escape(value: Long): String = value.toString
|
||||||
|
def escape(value: Double): String = value.toString
|
||||||
|
def escape(value: Float): String = value.toString
|
||||||
|
|
||||||
|
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.toLowerCase match {
|
||||||
|
case "array" => {
|
||||||
|
val typeInfo = mapper.getTypeFactory().constructCollectionType(classOf[java.util.List[_]], cls)
|
||||||
|
val response = mapper.readValue(json, typeInfo).asInstanceOf[java.util.List[_]]
|
||||||
|
response.asScala.toList
|
||||||
|
}
|
||||||
|
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], contentType: String): String = {
|
||||||
|
val client = getClient(host)
|
||||||
|
|
||||||
|
val querystring = queryParams.filter(k => k._2 != null).map(k => (escape(k._1) + "=" + escape(k._2))).mkString("?", "&", "")
|
||||||
|
val builder = client.resource(host + path + querystring).accept(contentType)
|
||||||
|
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" => {
|
||||||
|
if(body != null && body.isInstanceOf[File]) {
|
||||||
|
val file = body.asInstanceOf[File]
|
||||||
|
val form = new FormDataMultiPart()
|
||||||
|
form.field("filename", file.getName())
|
||||||
|
form.bodyPart(new FileDataBodyPart("file", file, MediaType.MULTIPART_FORM_DATA_TYPE))
|
||||||
|
builder.post(classOf[ClientResponse], form)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(body == null) builder.post(classOf[ClientResponse], serialize(body))
|
||||||
|
else builder.`type`(contentType).post(classOf[ClientResponse], serialize(body))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "PUT" => {
|
||||||
|
if(body == null) builder.put(classOf[ClientResponse], null)
|
||||||
|
else builder.`type`(contentType).put(classOf[ClientResponse], serialize(body))
|
||||||
|
}
|
||||||
|
case "DELETE" => {
|
||||||
|
builder.delete(classOf[ClientResponse])
|
||||||
|
}
|
||||||
|
case _ => null
|
||||||
|
}
|
||||||
|
response.getClientResponseStatus().getStatusCode() match {
|
||||||
|
case 204 => ""
|
||||||
|
case code: Int if (Range(200, 299).contains(code)) => {
|
||||||
|
response.hasEntity() match {
|
||||||
|
case true => response.getEntity(classOf[String])
|
||||||
|
case false => ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case _ => {
|
||||||
|
val entity = response.hasEntity() match {
|
||||||
|
case true => response.getEntity(classOf[String])
|
||||||
|
case false => "no data"
|
||||||
|
}
|
||||||
|
throw new ApiException(
|
||||||
|
response.getClientResponseStatus().getStatusCode(),
|
||||||
|
entity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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(val code: Int, msg: String) extends RuntimeException(msg)
|
||||||
|
|
@ -0,0 +1,191 @@
|
|||||||
|
package io.swagger.client.api
|
||||||
|
|
||||||
|
import io.swagger.client.ApiInvoker
|
||||||
|
import io.swagger.client.ApiException
|
||||||
|
|
||||||
|
import java.io.File
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
|
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 getApiTokenStatus (api_key: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/account.json/apiTokenStatus".replaceAll("\\{format\\}","json")
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def authenticate (username: String, password: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/account.json/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(String.valueOf(password) != "null") queryParams += "password" -> password.toString
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def authenticatePost (username: String, body: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/account.json/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
if(body != null && body.isInstanceOf[File] )
|
||||||
|
"multipart/form-data"
|
||||||
|
else "application/json"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getLoggedInUser (auth_token: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/account.json/user".replaceAll("\\{format\\}","json")
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
headerParams += "auth_token" -> auth_token
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getWordListsForLoggedInUser (auth_token: String, skip: Integer, limit: Integer) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/account.json/wordLists".replaceAll("\\{format\\}","json")
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,424 @@
|
|||||||
|
package io.swagger.client.api
|
||||||
|
|
||||||
|
import io.swagger.client.ApiInvoker
|
||||||
|
import io.swagger.client.ApiException
|
||||||
|
|
||||||
|
import java.io.File
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
|
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 getWord (word: String, useCanonical: String, includeSuggestions: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/word.json/{word}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escape(word))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getAudio (word: String, useCanonical: String, limit: Integer) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/word.json/{word}/audio".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escape(word))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getDefinitions (word: String, limit: Integer, partOfSpeech: String, includeRelated: String, sourceDictionaries: List[String], useCanonical: String, includeTags: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/word.json/{word}/definitions".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escape(word))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getEtymologies (word: String, useCanonical: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/word.json/{word}/etymologies".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escape(word))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(String.valueOf(useCanonical) != "null") queryParams += "useCanonical" -> useCanonical.toString
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getExamples (word: String, includeDuplicates: String, useCanonical: String, skip: Integer, limit: Integer) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/word.json/{word}/examples".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escape(word))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getWordFrequency (word: String, useCanonical: String, startYear: Integer, endYear: Integer) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/word.json/{word}/frequency".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escape(word))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getHyphenation (word: String, useCanonical: String, sourceDictionary: String, limit: Integer) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/word.json/{word}/hyphenation".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escape(word))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getPhrases (word: String, limit: Integer, wlmi: Integer, useCanonical: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/word.json/{word}/phrases".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escape(word))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getTextPronunciations (word: String, useCanonical: String, sourceDictionary: String, typeFormat: String, limit: Integer) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/word.json/{word}/pronunciations".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escape(word))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getRelatedWords (word: String, useCanonical: String, relationshipTypes: String, limitPerRelationshipType: Integer) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/word.json/{word}/relatedWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escape(word))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getTopExample (word: String, useCanonical: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/word.json/{word}/topExample".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}",apiInvoker.escape(word))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(String.valueOf(useCanonical) != "null") queryParams += "useCanonical" -> useCanonical.toString
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,243 @@
|
|||||||
|
package io.swagger.client.api
|
||||||
|
|
||||||
|
import io.swagger.client.model.WordList
|
||||||
|
import io.swagger.client.model.StringValue
|
||||||
|
import io.swagger.client.ApiInvoker
|
||||||
|
import io.swagger.client.ApiException
|
||||||
|
|
||||||
|
import java.io.File
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
|
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 getWordListByPermalink (permalink: String, auth_token: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/wordList.json/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}",apiInvoker.escape(permalink))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
headerParams += "auth_token" -> auth_token
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "GET", queryParams.toMap, None, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def updateWordList (permalink: String, body: WordList, auth_token: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/wordList.json/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}",apiInvoker.escape(permalink))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
if(body != null && body.isInstanceOf[File] )
|
||||||
|
"multipart/form-data"
|
||||||
|
else "application/json"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
headerParams += "auth_token" -> auth_token
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "PUT", queryParams.toMap, body, headerParams.toMap, contentType) 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.json/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}",apiInvoker.escape(permalink))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
headerParams += "auth_token" -> auth_token
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, None, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def deleteWordsFromWordList (permalink: String, body: List[StringValue], auth_token: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/wordList.json/{permalink}/deleteWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}",apiInvoker.escape(permalink))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
if(body != null && body.isInstanceOf[File] )
|
||||||
|
"multipart/form-data"
|
||||||
|
else "application/json"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
headerParams += "auth_token" -> auth_token
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getWordListWords (permalink: String, sortBy: String, sortOrder: String, skip: Integer, limit: Integer, auth_token: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/wordList.json/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}",apiInvoker.escape(permalink))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def addWordsToWordList (permalink: String, body: List[StringValue], auth_token: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/wordList.json/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}",apiInvoker.escape(permalink))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
if(body != null && body.isInstanceOf[File] )
|
||||||
|
"multipart/form-data"
|
||||||
|
else "application/json"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
headerParams += "auth_token" -> auth_token
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package io.swagger.client.api
|
||||||
|
|
||||||
|
import io.swagger.client.model.WordList
|
||||||
|
import io.swagger.client.ApiInvoker
|
||||||
|
import io.swagger.client.ApiException
|
||||||
|
|
||||||
|
import java.io.File
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
|
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) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/wordLists.json".replaceAll("\\{format\\}","json")
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
if(body != null && body.isInstanceOf[File] )
|
||||||
|
"multipart/form-data"
|
||||||
|
else "application/json"
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
headerParams += "auth_token" -> auth_token
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,229 @@
|
|||||||
|
package io.swagger.client.api
|
||||||
|
|
||||||
|
import io.swagger.client.ApiInvoker
|
||||||
|
import io.swagger.client.ApiException
|
||||||
|
|
||||||
|
import java.io.File
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
|
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 getRandomWord (hasDictionaryDef: String, includePartOfSpeech: String, excludePartOfSpeech: String, minCorpusCount: Integer, maxCorpusCount: Integer, minDictionaryCount: Integer, maxDictionaryCount: Integer, minLength: Integer, maxLength: Integer) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/words.json/randomWord".replaceAll("\\{format\\}","json")
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getRandomWords (hasDictionaryDef: String, includePartOfSpeech: String, excludePartOfSpeech: String, minCorpusCount: Integer, maxCorpusCount: Integer, minDictionaryCount: Integer, maxDictionaryCount: Integer, minLength: Integer, maxLength: Integer, sortBy: String, sortOrder: String, limit: Integer) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/words.json/randomWords".replaceAll("\\{format\\}","json")
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
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: Integer, maxCorpusCount: Integer, minLength: Integer, maxLength: Integer, expandTerms: String, includeTags: String, sortBy: String, sortOrder: String, skip: String, limit: Integer) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/words.json/reverseDictionary".replaceAll("\\{format\\}","json")
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def searchWords (query: String, caseSensitive: String, includePartOfSpeech: String, excludePartOfSpeech: String, minCorpusCount: Integer, maxCorpusCount: Integer, minDictionaryCount: Integer, maxDictionaryCount: Integer, minLength: Integer, maxLength: Integer, skip: Integer, limit: Integer) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/words.json/search/{query}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "query" + "\\}",apiInvoker.escape(query))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getWordOfTheDay (date: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/words.json/wordOfTheDay".replaceAll("\\{format\\}","json")
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
|
||||||
|
"application/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, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class ApiTokenStatus (
|
||||||
|
valid: Boolean,
|
||||||
|
token: String,
|
||||||
|
resetsInMillis: Long,
|
||||||
|
remainingCalls: Long,
|
||||||
|
expiresInMillis: Long,
|
||||||
|
totalRequests: Long)
|
||||||
|
|
@ -0,0 +1,22 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
import org.joda.time.DateTime
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class AudioFile (
|
||||||
|
attributionUrl: String,
|
||||||
|
commentCount: Integer,
|
||||||
|
voteCount: Integer,
|
||||||
|
fileUrl: String,
|
||||||
|
audioType: String,
|
||||||
|
id: Long,
|
||||||
|
duration: Double,
|
||||||
|
attributionText: String,
|
||||||
|
createdBy: String,
|
||||||
|
description: String,
|
||||||
|
createdAt: DateTime,
|
||||||
|
voteWeightedAverage: Float,
|
||||||
|
voteAverage: Float,
|
||||||
|
word: String)
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class AudioType (
|
||||||
|
id: Integer,
|
||||||
|
name: String)
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class AuthenticationToken (
|
||||||
|
token: String,
|
||||||
|
userId: Long,
|
||||||
|
userSignature: String)
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class Bigram (
|
||||||
|
count: Long,
|
||||||
|
gram2: String,
|
||||||
|
gram1: String,
|
||||||
|
wlmi: Double,
|
||||||
|
mi: Double)
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class Category (
|
||||||
|
id: Long,
|
||||||
|
name: String)
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class Citation (
|
||||||
|
cite: String,
|
||||||
|
source: String)
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class ContentProvider (
|
||||||
|
id: Integer,
|
||||||
|
name: String)
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
import io.swagger.client.model.ExampleUsage
|
||||||
|
import io.swagger.client.model.Label
|
||||||
|
import io.swagger.client.model.Note
|
||||||
|
import io.swagger.client.model.Related
|
||||||
|
import io.swagger.client.model.Citation
|
||||||
|
import io.swagger.client.model.TextPron
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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,
|
||||||
|
notes: List[Note],
|
||||||
|
textProns: List[TextPron],
|
||||||
|
partOfSpeech: String)
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
import io.swagger.client.model.Definition
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class DefinitionSearchResults (
|
||||||
|
results: List[Definition],
|
||||||
|
totalResults: Integer)
|
||||||
|
|
@ -0,0 +1,22 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
import io.swagger.client.model.Sentence
|
||||||
|
import io.swagger.client.model.ContentProvider
|
||||||
|
import io.swagger.client.model.ScoredWord
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class Example (
|
||||||
|
id: Long,
|
||||||
|
exampleId: Long,
|
||||||
|
title: String,
|
||||||
|
text: String,
|
||||||
|
score: ScoredWord,
|
||||||
|
sentence: Sentence,
|
||||||
|
word: String,
|
||||||
|
provider: ContentProvider,
|
||||||
|
year: Integer,
|
||||||
|
rating: Float,
|
||||||
|
documentId: Long,
|
||||||
|
url: String)
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
import io.swagger.client.model.Example
|
||||||
|
import io.swagger.client.model.Facet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class ExampleSearchResults (
|
||||||
|
facets: List[Facet],
|
||||||
|
examples: List[Example])
|
||||||
|
|
@ -0,0 +1,8 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class ExampleUsage (
|
||||||
|
text: String)
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
import io.swagger.client.model.FacetValue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class Facet (
|
||||||
|
facetValues: List[FacetValue],
|
||||||
|
name: String)
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class FacetValue (
|
||||||
|
count: Long,
|
||||||
|
value: String)
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class Frequency (
|
||||||
|
count: Long,
|
||||||
|
year: Integer)
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
import io.swagger.client.model.Frequency
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class FrequencySummary (
|
||||||
|
unknownYearCount: Integer,
|
||||||
|
totalCount: Long,
|
||||||
|
frequencyString: String,
|
||||||
|
word: String,
|
||||||
|
frequency: List[Frequency])
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class Label (
|
||||||
|
text: String,
|
||||||
|
_type: String)
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class Note (
|
||||||
|
noteType: String,
|
||||||
|
appliesTo: List[String],
|
||||||
|
value: String,
|
||||||
|
pos: Integer)
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
import io.swagger.client.model.Category
|
||||||
|
import io.swagger.client.model.Root
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class PartOfSpeech (
|
||||||
|
roots: List[Root],
|
||||||
|
storageAbbr: List[String],
|
||||||
|
allCategories: List[Category])
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class Related (
|
||||||
|
label1: String,
|
||||||
|
relationshipType: String,
|
||||||
|
label2: String,
|
||||||
|
label3: String,
|
||||||
|
words: List[String],
|
||||||
|
gram: String,
|
||||||
|
label4: String)
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
import io.swagger.client.model.Category
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class Root (
|
||||||
|
id: Long,
|
||||||
|
name: String,
|
||||||
|
categories: List[Category])
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class ScoredWord (
|
||||||
|
position: Integer,
|
||||||
|
id: Long,
|
||||||
|
docTermCount: Integer,
|
||||||
|
lemma: String,
|
||||||
|
wordType: String,
|
||||||
|
score: Float,
|
||||||
|
sentenceId: Long,
|
||||||
|
word: String,
|
||||||
|
stopword: Boolean,
|
||||||
|
baseWordScore: Double,
|
||||||
|
partOfSpeech: String)
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
import io.swagger.client.model.ScoredWord
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class Sentence (
|
||||||
|
hasScoredWords: Boolean,
|
||||||
|
id: Long,
|
||||||
|
scoredWords: List[ScoredWord],
|
||||||
|
display: String,
|
||||||
|
rating: Integer,
|
||||||
|
documentMetadataId: Long)
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class SimpleDefinition (
|
||||||
|
text: String,
|
||||||
|
source: String,
|
||||||
|
note: String,
|
||||||
|
partOfSpeech: String)
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class SimpleExample (
|
||||||
|
id: Long,
|
||||||
|
title: String,
|
||||||
|
text: String,
|
||||||
|
url: String)
|
||||||
|
|
@ -0,0 +1,8 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class StringValue (
|
||||||
|
word: String)
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class Syllable (
|
||||||
|
text: String,
|
||||||
|
seq: Integer,
|
||||||
|
_type: String)
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class TextPron (
|
||||||
|
raw: String,
|
||||||
|
seq: Integer,
|
||||||
|
rawType: String)
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class User (
|
||||||
|
id: Long,
|
||||||
|
username: String,
|
||||||
|
email: String,
|
||||||
|
status: Integer,
|
||||||
|
faceBookId: String,
|
||||||
|
userName: String,
|
||||||
|
displayName: String,
|
||||||
|
password: String)
|
||||||
|
|
@ -0,0 +1,19 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
import org.joda.time.DateTime
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class WordList (
|
||||||
|
id: Long,
|
||||||
|
permalink: String,
|
||||||
|
name: String,
|
||||||
|
createdAt: DateTime,
|
||||||
|
updatedAt: DateTime,
|
||||||
|
lastActivityAt: DateTime,
|
||||||
|
username: String,
|
||||||
|
userId: Long,
|
||||||
|
description: String,
|
||||||
|
numberWordsInList: Long,
|
||||||
|
_type: String)
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
import org.joda.time.DateTime
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class WordListWord (
|
||||||
|
id: Long,
|
||||||
|
word: String,
|
||||||
|
username: String,
|
||||||
|
userId: Long,
|
||||||
|
createdAt: DateTime,
|
||||||
|
numberCommentsOnWord: Long,
|
||||||
|
numberLists: Long)
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class WordObject (
|
||||||
|
id: Long,
|
||||||
|
word: String,
|
||||||
|
originalWord: String,
|
||||||
|
suggestions: List[String],
|
||||||
|
canonicalForm: String,
|
||||||
|
vulgar: String)
|
||||||
|
|
@ -0,0 +1,23 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
import org.joda.time.DateTime
|
||||||
|
import io.swagger.client.model.SimpleDefinition
|
||||||
|
import io.swagger.client.model.ContentProvider
|
||||||
|
import io.swagger.client.model.SimpleExample
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class WordOfTheDay (
|
||||||
|
id: Long,
|
||||||
|
parentId: String,
|
||||||
|
category: String,
|
||||||
|
createdBy: String,
|
||||||
|
createdAt: DateTime,
|
||||||
|
contentProvider: ContentProvider,
|
||||||
|
htmlExtra: String,
|
||||||
|
word: String,
|
||||||
|
definitions: List[SimpleDefinition],
|
||||||
|
examples: List[SimpleExample],
|
||||||
|
note: String,
|
||||||
|
publishDate: DateTime)
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class WordSearchResult (
|
||||||
|
count: Long,
|
||||||
|
lexicality: Double,
|
||||||
|
word: String)
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
package io.swagger.client.model
|
||||||
|
|
||||||
|
import io.swagger.client.model.WordSearchResult
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case class WordSearchResults (
|
||||||
|
searchResults: List[WordSearchResult],
|
||||||
|
totalResults: Integer)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user