diff --git a/samples/client/wordnik-api/java/README.md b/samples/client/wordnik-api/java/README.md index 25a8fc5fc0e..e2cb2cfa870 100644 --- a/samples/client/wordnik-api/java/README.md +++ b/samples/client/wordnik-api/java/README.md @@ -25,34 +25,34 @@ import com.wordnik.client.common.ApiException; import java.util.List; public class Test { - public static void main(String[] args) { - if(args.length == 0) { - System.out.println("Pass your API key as an argument"); - System.exit(0); - } - String key = args[0]; + public static void main(String[] args) { + if(args.length == 0) { + System.out.println("Pass your API key as an argument"); + System.exit(0); + } + String key = args[0]; - try { - WordApi api = new WordApi(); - api.getInvoker().addDefaultHeader("api_key", key); - List definitions = api.getDefinitions( - "Cat", // word - "noun", // only get definitions which are "nouns" - "wiktionary", // use wiktionary - 3, // fetch only 3 results max - "true", // return related words - "true", // fetch the canonical version of this word (Cat => cat) - "false" // return XML mark-up in response - ); + try { + WordApi api = new WordApi(); + api.getInvoker().addDefaultHeader("api_key", key); + List definitions = api.getDefinitions( + "Cat", // word + "noun", // only get definitions which are "nouns" + "wiktionary", // use wiktionary + 3, // fetch only 3 results max + "true", // return related words + "true", // fetch the canonical version of this word (Cat => cat) + "false" // return XML mark-up in response + ); - for(Definition def : definitions) { - System.out.print(def); - } - } - catch (ApiException e) { + for(Definition def : definitions) { + System.out.print(def); + } + } + catch (ApiException e) { - } - } + } + } } ``` diff --git a/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/AccountApi.java b/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/AccountApi.java index 7529fa32a19..9dba32f04bf 100644 --- a/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/AccountApi.java +++ b/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/AccountApi.java @@ -26,7 +26,7 @@ public class AccountApi { public AuthenticationToken authenticate (String username, String password) throws ApiException { // create path and map variables - String path = "/account.{format}/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username)); + String path = "/account.{format}/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); // query params Map queryParams = new HashMap(); @@ -57,7 +57,7 @@ public class AccountApi { } public AuthenticationToken authenticatePost (String username, String body) throws ApiException { // create path and map variables - String path = "/account.{format}/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username)); + String path = "/account.{format}/authenticate/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString())); // query params Map queryParams = new HashMap(); diff --git a/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/WordApi.java b/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/WordApi.java index 6aa63839bbb..a130de970b7 100644 --- a/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/WordApi.java +++ b/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/WordApi.java @@ -32,7 +32,7 @@ public class WordApi { public ExampleSearchResults getExamples (String word, String includeDuplicates, String useCanonical, Integer skip, Integer limit) throws ApiException { // create path and map variables - String path = "/word.{format}/{word}/examples".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word)); + String path = "/word.{format}/{word}/examples".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); // query params Map queryParams = new HashMap(); @@ -69,7 +69,7 @@ public class WordApi { } public WordObject getWord (String word, String useCanonical, String includeSuggestions) throws ApiException { // create path and map variables - String path = "/word.{format}/{word}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word)); + String path = "/word.{format}/{word}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); // query params Map queryParams = new HashMap(); @@ -102,7 +102,7 @@ public class WordApi { } public List getDefinitions (String word, String partOfSpeech, String sourceDictionaries, Integer limit, String includeRelated, String useCanonical, String includeTags) throws ApiException { // create path and map variables - String path = "/word.{format}/{word}/definitions".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word)); + String path = "/word.{format}/{word}/definitions".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); // query params Map queryParams = new HashMap(); @@ -143,7 +143,7 @@ public class WordApi { } public Example getTopExample (String word, String useCanonical) throws ApiException { // create path and map variables - String path = "/word.{format}/{word}/topExample".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word)); + String path = "/word.{format}/{word}/topExample".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); // query params Map queryParams = new HashMap(); @@ -174,7 +174,7 @@ public class WordApi { } public List getRelatedWords (String word, String relationshipTypes, String useCanonical, Integer limitPerRelationshipType) throws ApiException { // create path and map variables - String path = "/word.{format}/{word}/relatedWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word)); + String path = "/word.{format}/{word}/relatedWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); // query params Map queryParams = new HashMap(); @@ -209,7 +209,7 @@ public class WordApi { } public List getTextPronunciations (String word, String sourceDictionary, String typeFormat, String useCanonical, Integer limit) throws ApiException { // create path and map variables - String path = "/word.{format}/{word}/pronunciations".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word)); + String path = "/word.{format}/{word}/pronunciations".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); // query params Map queryParams = new HashMap(); @@ -246,7 +246,7 @@ public class WordApi { } public List getHyphenation (String word, String sourceDictionary, String useCanonical, Integer limit) throws ApiException { // create path and map variables - String path = "/word.{format}/{word}/hyphenation".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word)); + String path = "/word.{format}/{word}/hyphenation".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); // query params Map queryParams = new HashMap(); @@ -281,7 +281,7 @@ public class WordApi { } public FrequencySummary getWordFrequency (String word, String useCanonical, Integer startYear, Integer endYear) throws ApiException { // create path and map variables - String path = "/word.{format}/{word}/frequency".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word)); + String path = "/word.{format}/{word}/frequency".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); // query params Map queryParams = new HashMap(); @@ -316,7 +316,7 @@ public class WordApi { } public List getPhrases (String word, Integer limit, Integer wlmi, String useCanonical) throws ApiException { // create path and map variables - String path = "/word.{format}/{word}/phrases".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word)); + String path = "/word.{format}/{word}/phrases".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); // query params Map queryParams = new HashMap(); @@ -351,7 +351,7 @@ public class WordApi { } public List getEtymologies (String word, String useCanonical) throws ApiException { // create path and map variables - String path = "/word.{format}/{word}/etymologies".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word)); + String path = "/word.{format}/{word}/etymologies".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); // query params Map queryParams = new HashMap(); @@ -382,7 +382,7 @@ public class WordApi { } public List getAudio (String word, String useCanonical, Integer limit) throws ApiException { // create path and map variables - String path = "/word.{format}/{word}/audio".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word)); + String path = "/word.{format}/{word}/audio".replaceAll("\\{format\\}","json").replaceAll("\\{" + "word" + "\\}", apiInvoker.escapeString(word.toString())); // query params Map queryParams = new HashMap(); diff --git a/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/WordListApi.java b/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/WordListApi.java index df5c0c36969..78c160ee7da 100644 --- a/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/WordListApi.java +++ b/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/WordListApi.java @@ -25,7 +25,7 @@ public class WordListApi { public void updateWordList (String permalink, WordList body, String auth_token) throws ApiException { // create path and map variables - String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink)); + String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString())); // query params Map queryParams = new HashMap(); @@ -55,7 +55,7 @@ public class WordListApi { } public void deleteWordList (String permalink, String auth_token) throws ApiException { // create path and map variables - String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink)); + String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString())); // query params Map queryParams = new HashMap(); @@ -85,7 +85,7 @@ public class WordListApi { } public WordList getWordListByPermalink (String permalink, String auth_token) throws ApiException { // create path and map variables - String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink)); + String path = "/wordList.{format}/{permalink}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString())); // query params Map queryParams = new HashMap(); @@ -115,7 +115,7 @@ public class WordListApi { } public void addWordsToWordList (String permalink, List body, String auth_token) throws ApiException { // create path and map variables - String path = "/wordList.{format}/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink)); + String path = "/wordList.{format}/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString())); // query params Map queryParams = new HashMap(); @@ -145,7 +145,7 @@ public class WordListApi { } public List getWordListWords (String permalink, String auth_token, String sortBy, String sortOrder, Integer skip, Integer limit) throws ApiException { // create path and map variables - String path = "/wordList.{format}/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink)); + String path = "/wordList.{format}/{permalink}/words".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString())); // query params Map queryParams = new HashMap(); @@ -183,7 +183,7 @@ public class WordListApi { } public void deleteWordsFromWordList (String permalink, List body, String auth_token) throws ApiException { // create path and map variables - String path = "/wordList.{format}/{permalink}/deleteWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink)); + String path = "/wordList.{format}/{permalink}/deleteWords".replaceAll("\\{format\\}","json").replaceAll("\\{" + "permalink" + "\\}", apiInvoker.escapeString(permalink.toString())); // query params Map queryParams = new HashMap(); diff --git a/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/WordsApi.java b/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/WordsApi.java index 119fac75822..478e07bca37 100644 --- a/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/WordsApi.java +++ b/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/api/WordsApi.java @@ -26,7 +26,7 @@ public class WordsApi { public WordSearchResults searchWords (String query, String includePartOfSpeech, String excludePartOfSpeech, String caseSensitive, Integer minCorpusCount, Integer maxCorpusCount, Integer minDictionaryCount, Integer maxDictionaryCount, Integer minLength, Integer maxLength, Integer skip, Integer limit) throws ApiException { // create path and map variables - String path = "/words.{format}/search/{query}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "query" + "\\}", apiInvoker.escapeString(query)); + String path = "/words.{format}/search/{query}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "query" + "\\}", apiInvoker.escapeString(query.toString())); // query params Map queryParams = new HashMap(); diff --git a/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/model/WordList.java b/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/model/WordList.java index 5a6999cd596..d4089fcd014 100644 --- a/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/model/WordList.java +++ b/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/model/WordList.java @@ -2,24 +2,17 @@ package com.wordnik.client.model; import java.util.Date; public class WordList { - private Date updatedAt = null; private Long id = null; - private String username = null; private String permalink = null; - private Date lastActivityAt = null; - private Date createdAt = null; - private String description = null; - private Long userId = null; private String name = null; + private Date createdAt = null; + private Date updatedAt = null; + private Date lastActivityAt = null; + private String username = null; + private Long userId = null; + private String description = null; private Long numberWordsInList = null; private String type = null; - public Date getUpdatedAt() { - return updatedAt; - } - public void setUpdatedAt(Date updatedAt) { - this.updatedAt = updatedAt; - } - public Long getId() { return id; } @@ -27,13 +20,6 @@ public class WordList { this.id = id; } - public String getUsername() { - return username; - } - public void setUsername(String username) { - this.username = username; - } - public String getPermalink() { return permalink; } @@ -41,11 +27,11 @@ public class WordList { this.permalink = permalink; } - public Date getLastActivityAt() { - return lastActivityAt; + public String getName() { + return name; } - public void setLastActivityAt(Date lastActivityAt) { - this.lastActivityAt = lastActivityAt; + public void setName(String name) { + this.name = name; } public Date getCreatedAt() { @@ -55,11 +41,25 @@ public class WordList { this.createdAt = createdAt; } - public String getDescription() { - return description; + public Date getUpdatedAt() { + return updatedAt; } - public void setDescription(String description) { - this.description = description; + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Date getLastActivityAt() { + return lastActivityAt; + } + public void setLastActivityAt(Date lastActivityAt) { + this.lastActivityAt = lastActivityAt; + } + + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; } public Long getUserId() { @@ -69,11 +69,11 @@ public class WordList { this.userId = userId; } - public String getName() { - return name; + public String getDescription() { + return description; } - public void setName(String name) { - this.name = name; + public void setDescription(String description) { + this.description = description; } public Long getNumberWordsInList() { @@ -94,15 +94,15 @@ public class WordList { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class WordList {\n"); - sb.append(" updatedAt: ").append(updatedAt).append("\n"); sb.append(" id: ").append(id).append("\n"); - sb.append(" username: ").append(username).append("\n"); sb.append(" permalink: ").append(permalink).append("\n"); - sb.append(" lastActivityAt: ").append(lastActivityAt).append("\n"); - sb.append(" createdAt: ").append(createdAt).append("\n"); - sb.append(" description: ").append(description).append("\n"); - sb.append(" userId: ").append(userId).append("\n"); sb.append(" name: ").append(name).append("\n"); + sb.append(" createdAt: ").append(createdAt).append("\n"); + sb.append(" updatedAt: ").append(updatedAt).append("\n"); + sb.append(" lastActivityAt: ").append(lastActivityAt).append("\n"); + sb.append(" username: ").append(username).append("\n"); + sb.append(" userId: ").append(userId).append("\n"); + sb.append(" description: ").append(description).append("\n"); sb.append(" numberWordsInList: ").append(numberWordsInList).append("\n"); sb.append(" type: ").append(type).append("\n"); sb.append("}\n"); diff --git a/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/model/WordListWord.java b/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/model/WordListWord.java index 06afab98911..b86036b9a51 100644 --- a/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/model/WordListWord.java +++ b/samples/client/wordnik-api/java/src/main/java/com/wordnik/client/model/WordListWord.java @@ -3,11 +3,11 @@ package com.wordnik.client.model; import java.util.Date; public class WordListWord { private Long id = null; + private String word = null; private String username = null; + private Long userId = null; private Date createdAt = null; private Long numberCommentsOnWord = null; - private Long userId = null; - private String word = null; private Long numberLists = null; public Long getId() { return id; @@ -16,6 +16,13 @@ public class WordListWord { this.id = id; } + public String getWord() { + return word; + } + public void setWord(String word) { + this.word = word; + } + public String getUsername() { return username; } @@ -23,6 +30,13 @@ public class WordListWord { this.username = username; } + public Long getUserId() { + return userId; + } + public void setUserId(Long userId) { + this.userId = userId; + } + public Date getCreatedAt() { return createdAt; } @@ -37,20 +51,6 @@ public class WordListWord { this.numberCommentsOnWord = numberCommentsOnWord; } - public Long getUserId() { - return userId; - } - public void setUserId(Long userId) { - this.userId = userId; - } - - public String getWord() { - return word; - } - public void setWord(String word) { - this.word = word; - } - public Long getNumberLists() { return numberLists; } @@ -63,11 +63,11 @@ public class WordListWord { StringBuilder sb = new StringBuilder(); sb.append("class WordListWord {\n"); sb.append(" id: ").append(id).append("\n"); + sb.append(" word: ").append(word).append("\n"); sb.append(" username: ").append(username).append("\n"); + sb.append(" userId: ").append(userId).append("\n"); sb.append(" createdAt: ").append(createdAt).append("\n"); sb.append(" numberCommentsOnWord: ").append(numberCommentsOnWord).append("\n"); - sb.append(" userId: ").append(userId).append("\n"); - sb.append(" word: ").append(word).append("\n"); sb.append(" numberLists: ").append(numberLists).append("\n"); sb.append("}\n"); return sb.toString(); diff --git a/samples/client/wordnik-api/scala/README.md b/samples/client/wordnik-api/scala/README.md index ddcc37e8981..65310cbd086 100644 --- a/samples/client/wordnik-api/scala/README.md +++ b/samples/client/wordnik-api/scala/README.md @@ -36,13 +36,12 @@ object Test { val api = new WordApi api.addHeader("api_key", key) api.getDefinitions("cat", null, null, 10).flatten.foreach(definition => { - println(definition) + println(definition) }) } } ``` - This project was built with the following minimum requirements: * Maven 3.0