regenerated client

This commit is contained in:
Tony Tam
2013-10-18 14:42:57 -07:00
parent 609cef0b65
commit d56c5e3b44
23 changed files with 540 additions and 230 deletions

View File

@@ -14,11 +14,7 @@
<prerequisites>
<maven>2.2.0</maven>
</prerequisites>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>5</version>
</parent>
<build>
<plugins>
<plugin>
@@ -37,30 +33,6 @@
<forkMode>pertest</forkMode>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
@@ -135,6 +107,7 @@
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin-version}</version>
<executions>
<execution>
<goals>
@@ -235,6 +208,7 @@
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.8.1</junit-version>
<scala-test-version>1.6.1</scala-test-version>
<scala-maven-plugin-version>3.1.5</scala-maven-plugin-version>
</properties>
</project>

View File

@@ -2,9 +2,9 @@ package com.wordnik.client.api;
import com.wordnik.client.common.ApiException;
import com.wordnik.client.common.ApiInvoker;
import com.wordnik.client.model.ApiTokenStatus;
import com.wordnik.client.model.WordList;
import com.wordnik.client.model.User;
import com.wordnik.client.model.WordList;
import com.wordnik.client.model.ApiTokenStatus;
import com.wordnik.client.model.AuthenticationToken;
import java.util.*;
@@ -38,8 +38,10 @@ public class AccountApi {
}
if(!"null".equals(String.valueOf(password)))
queryParams.put("password", String.valueOf(password));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (AuthenticationToken) ApiInvoker.deserialize(response, "", AuthenticationToken.class);
}
@@ -67,8 +69,10 @@ public class AccountApi {
if(username == null || body == null ) {
throw new ApiException(400, "missing required params");
}
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
if(response != null){
return (AuthenticationToken) ApiInvoker.deserialize(response, "", AuthenticationToken.class);
}
@@ -101,8 +105,10 @@ public class AccountApi {
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<WordList>) ApiInvoker.deserialize(response, "List", WordList.class);
}
@@ -127,8 +133,10 @@ public class AccountApi {
Map<String, String> headerParams = new HashMap<String, String>();
headerParams.put("api_key", api_key);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (ApiTokenStatus) ApiInvoker.deserialize(response, "", ApiTokenStatus.class);
}
@@ -157,8 +165,10 @@ public class AccountApi {
throw new ApiException(400, "missing required params");
}
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (User) ApiInvoker.deserialize(response, "", User.class);
}

View File

@@ -2,16 +2,17 @@ package com.wordnik.client.api;
import com.wordnik.client.common.ApiException;
import com.wordnik.client.common.ApiInvoker;
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.model.Bigram;
import com.wordnik.client.model.WordObject;
import com.wordnik.client.model.ExampleSearchResults;
import com.wordnik.client.model.Example;
import com.wordnik.client.model.ScrabbleScoreResult;
import com.wordnik.client.model.TextPron;
import com.wordnik.client.model.Syllable;
import com.wordnik.client.model.Related;
import com.wordnik.client.model.Definition;
import com.wordnik.client.model.AudioFile;
import java.util.*;
public class WordApi {
@@ -50,8 +51,10 @@ public class WordApi {
queryParams.put("skip", String.valueOf(skip));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (ExampleSearchResults) ApiInvoker.deserialize(response, "", ExampleSearchResults.class);
}
@@ -83,8 +86,10 @@ public class WordApi {
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(includeSuggestions)))
queryParams.put("includeSuggestions", String.valueOf(includeSuggestions));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (WordObject) ApiInvoker.deserialize(response, "", WordObject.class);
}
@@ -124,8 +129,10 @@ public class WordApi {
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(includeTags)))
queryParams.put("includeTags", String.valueOf(includeTags));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<Definition>) ApiInvoker.deserialize(response, "List", Definition.class);
}
@@ -155,8 +162,10 @@ public class WordApi {
}
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (Example) ApiInvoker.deserialize(response, "", Example.class);
}
@@ -190,8 +199,10 @@ public class WordApi {
queryParams.put("relationshipTypes", String.valueOf(relationshipTypes));
if(!"null".equals(String.valueOf(limitPerRelationshipType)))
queryParams.put("limitPerRelationshipType", String.valueOf(limitPerRelationshipType));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<Related>) ApiInvoker.deserialize(response, "List", Related.class);
}
@@ -227,8 +238,10 @@ public class WordApi {
queryParams.put("typeFormat", String.valueOf(typeFormat));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<TextPron>) ApiInvoker.deserialize(response, "List", TextPron.class);
}
@@ -262,8 +275,10 @@ public class WordApi {
queryParams.put("sourceDictionary", String.valueOf(sourceDictionary));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<Syllable>) ApiInvoker.deserialize(response, "List", Syllable.class);
}
@@ -297,8 +312,10 @@ public class WordApi {
queryParams.put("startYear", String.valueOf(startYear));
if(!"null".equals(String.valueOf(endYear)))
queryParams.put("endYear", String.valueOf(endYear));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (FrequencySummary) ApiInvoker.deserialize(response, "", FrequencySummary.class);
}
@@ -332,8 +349,10 @@ public class WordApi {
queryParams.put("wlmi", String.valueOf(wlmi));
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<Bigram>) ApiInvoker.deserialize(response, "List", Bigram.class);
}
@@ -363,8 +382,10 @@ public class WordApi {
}
if(!"null".equals(String.valueOf(useCanonical)))
queryParams.put("useCanonical", String.valueOf(useCanonical));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<String>) ApiInvoker.deserialize(response, "List", String.class);
}
@@ -396,8 +417,10 @@ public class WordApi {
queryParams.put("useCanonical", String.valueOf(useCanonical));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<AudioFile>) ApiInvoker.deserialize(response, "List", AudioFile.class);
}
@@ -413,5 +436,36 @@ public class WordApi {
}
}
}
public ScrabbleScoreResult getScrabbleScore (String word) throws ApiException {
// create path and map variables
String path = "/word.{format}/{word}/scrabbleScore".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString()));
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
// verify required params are set
if(word == null ) {
throw new ApiException(400, "missing required params");
}
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (ScrabbleScoreResult) ApiInvoker.deserialize(response, "", ScrabbleScoreResult.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
}

View File

@@ -2,9 +2,9 @@ package com.wordnik.client.api;
import com.wordnik.client.common.ApiException;
import com.wordnik.client.common.ApiInvoker;
import com.wordnik.client.model.WordListWord;
import com.wordnik.client.model.WordList;
import com.wordnik.client.model.StringValue;
import com.wordnik.client.model.WordListWord;
import java.util.*;
public class WordListApi {
@@ -36,8 +36,10 @@ public class WordListApi {
throw new ApiException(400, "missing required params");
}
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, body, headerParams, contentType);
if(response != null){
return ;
}
@@ -66,8 +68,10 @@ public class WordListApi {
throw new ApiException(400, "missing required params");
}
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, null, headerParams, contentType);
if(response != null){
return ;
}
@@ -96,8 +100,10 @@ public class WordListApi {
throw new ApiException(400, "missing required params");
}
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (WordList) ApiInvoker.deserialize(response, "", WordList.class);
}
@@ -126,8 +132,10 @@ public class WordListApi {
throw new ApiException(400, "missing required params");
}
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
if(response != null){
return ;
}
@@ -164,8 +172,10 @@ public class WordListApi {
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<WordListWord>) ApiInvoker.deserialize(response, "List", WordListWord.class);
}
@@ -194,8 +204,10 @@ public class WordListApi {
throw new ApiException(400, "missing required params");
}
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
if(response != null){
return ;
}

View File

@@ -34,8 +34,10 @@ public class WordListsApi {
throw new ApiException(400, "missing required params");
}
headerParams.put("auth_token", auth_token);
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, body, headerParams, contentType);
if(response != null){
return (WordList) ApiInvoker.deserialize(response, "", WordList.class);
}

View File

@@ -2,8 +2,8 @@ package com.wordnik.client.api;
import com.wordnik.client.common.ApiException;
import com.wordnik.client.common.ApiInvoker;
import com.wordnik.client.model.WordObject;
import com.wordnik.client.model.DefinitionSearchResults;
import com.wordnik.client.model.WordObject;
import com.wordnik.client.model.WordOfTheDay;
import com.wordnik.client.model.WordSearchResults;
import java.util.*;
@@ -58,8 +58,10 @@ public class WordsApi {
queryParams.put("skip", String.valueOf(skip));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (WordSearchResults) ApiInvoker.deserialize(response, "", WordSearchResults.class);
}
@@ -85,8 +87,10 @@ public class WordsApi {
if(!"null".equals(String.valueOf(date)))
queryParams.put("date", String.valueOf(date));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (WordOfTheDay) ApiInvoker.deserialize(response, "", WordOfTheDay.class);
}
@@ -146,8 +150,10 @@ public class WordsApi {
queryParams.put("skip", String.valueOf(skip));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (DefinitionSearchResults) ApiInvoker.deserialize(response, "", DefinitionSearchResults.class);
}
@@ -195,8 +201,10 @@ public class WordsApi {
queryParams.put("sortOrder", String.valueOf(sortOrder));
if(!"null".equals(String.valueOf(limit)))
queryParams.put("limit", String.valueOf(limit));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (List<WordObject>) ApiInvoker.deserialize(response, "List", WordObject.class);
}
@@ -238,8 +246,10 @@ public class WordsApi {
queryParams.put("minLength", String.valueOf(minLength));
if(!"null".equals(String.valueOf(maxLength)))
queryParams.put("maxLength", String.valueOf(maxLength));
String contentType = "application/json";
try {
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams);
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, null, headerParams, contentType);
if(response != null){
return (WordObject) ApiInvoker.deserialize(response, "", WordObject.class);
}

View File

@@ -44,9 +44,8 @@ public class ApiInvoker {
return response;
}
else if(String.class.equals(cls)) {
if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1) {
if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1)
return json.substring(1, json.length() - 2);
}
else
return json;
}
@@ -61,15 +60,17 @@ public class ApiInvoker {
public static String serialize(Object obj) throws ApiException {
try {
if (obj != null) return JsonUtil.getJsonMapper().writeValueAsString(obj);
else return null;
if (obj != null)
return JsonUtil.getJsonMapper().writeValueAsString(obj);
else
return null;
}
catch (Exception e) {
throw new ApiException(500, e.getMessage());
}
}
public String invokeAPI(String host, String path, String method, Map<String, String> queryParams, Object body, Map<String, String> headerParams) throws ApiException {
public String invokeAPI(String host, String path, String method, Map<String, String> queryParams, Object body, Map<String, String> headerParams, String contentType) throws ApiException {
Client client = getClient(host);
StringBuilder b = new StringBuilder();
@@ -77,14 +78,16 @@ public class ApiInvoker {
for(String key : queryParams.keySet()) {
String value = queryParams.get(key);
if (value != null){
if(b.toString().length() == 0) b.append("?");
else b.append("&");
if(b.toString().length() == 0)
b.append("?");
else
b.append("&");
b.append(escapeString(key)).append("=").append(escapeString(value));
}
}
String querystring = b.toString();
Builder builder = client.resource(host + path + querystring).type("application/json");
Builder builder = client.resource(host + path + querystring).accept("application/json");
for(String key : headerParams.keySet()) {
builder.header(key, headerParams.get(key));
}
@@ -100,13 +103,22 @@ public class ApiInvoker {
response = (ClientResponse) builder.get(ClientResponse.class);
}
else if ("POST".equals(method)) {
if(body == null)
response = builder.post(ClientResponse.class, serialize(body));
else
response = builder.type("application/json").post(ClientResponse.class, serialize(body));
}
else if ("PUT".equals(method)) {
response = builder.put(ClientResponse.class, serialize(body));
}
if(body == null)
response = builder.put(ClientResponse.class, serialize(body));
else
response = builder.type("application/json").put(ClientResponse.class, serialize(body));
}
else if ("DELETE".equals(method)) {
if(body == null)
response = builder.delete(ClientResponse.class, serialize(body));
else
response = builder.type("application/json").delete(ClientResponse.class, serialize(body));
}
else {
throw new ApiException(500, "unknown method type " + method);
@@ -122,12 +134,12 @@ public class ApiInvoker {
}
private Client getClient(String host) {
if(!hostMap.containsKey(host)) {
Client client = Client.create();
client.addFilter(new LoggingFilter());
hostMap.put(host, client);
}
return hostMap.get(host);
if(!hostMap.containsKey(host)) {
Client client = Client.create();
client.addFilter(new LoggingFilter());
hostMap.put(host, client);
}
return hostMap.get(host);
}
}

View File

@@ -1,12 +1,12 @@
package com.wordnik.client.model;
import java.util.*;
import com.wordnik.client.model.ExampleUsage;
import com.wordnik.client.model.Note;
import com.wordnik.client.model.Citation;
import com.wordnik.client.model.TextPron;
import com.wordnik.client.model.Label;
import com.wordnik.client.model.ExampleUsage;
import com.wordnik.client.model.TextPron;
import com.wordnik.client.model.Citation;
import com.wordnik.client.model.Related;
import com.wordnik.client.model.Note;
public class Definition {
private String extendedText = null;
private String text = null;

View File

@@ -1,8 +1,8 @@
package com.wordnik.client.model;
import com.wordnik.client.model.Sentence;
import com.wordnik.client.model.ScoredWord;
import com.wordnik.client.model.ContentProvider;
import com.wordnik.client.model.ScoredWord;
public class Example {
private Long id = null;
private Long exampleId = null;

View File

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

View File

@@ -2,8 +2,8 @@ package com.wordnik.client.model;
import java.util.Date;
import java.util.*;
import com.wordnik.client.model.SimpleDefinition;
import com.wordnik.client.model.SimpleExample;
import com.wordnik.client.model.SimpleDefinition;
import com.wordnik.client.model.ContentProvider;
public class WordOfTheDay {
private Long id = null;