/* -------------------------------------------------------------------------- */ /* searchForKanji related classes */ /* -------------------------------------------------------------------------- */ class YomiExample { String example; String reading; String meaning; YomiExample({String example, String reading, String meaning}) { this.example = example; this.reading = reading; this.meaning = meaning; } Map toJson() => { 'example': example, 'reading': reading, 'meaning': meaning }; } class Radical { String symbol; List forms; String meaning; Radical({String symbol, List forms, String meaning}){ this.symbol = symbol; this.forms = forms; this.meaning = meaning; } Map toJson() => { 'symbol': symbol, 'forms': forms, 'meaning': meaning }; } class KanjiResult { String query; bool found; String taughtIn; String jlptLevel; int newspaperFrequencyRank; int strokeCount; String meaning; List kunyomi; List onyomi; List kunyomiExamples; List onyomiExamples; Radical radical; List parts; String strokeOrderDiagramUri; String strokeOrderSvgUri; String strokeOrderGifUri; String uri; Map toJson() { if (found == false) { return { 'query': query, 'found': found }; } var returnObject = { 'query': query, 'found': found, 'taughtIn': taughtIn, 'jlptLevel': jlptLevel, 'newspaperFrequencyRank': newspaperFrequencyRank, 'strokeCount': strokeCount, 'meaning': meaning, 'kunyomi': kunyomi, 'onyomi': onyomi, 'onyomiExamples': onyomiExamples, 'kunyomiExamples': kunyomiExamples, 'radical': radical.toJson(), 'parts': parts, 'strokeOrderDiagramUri': strokeOrderDiagramUri, 'strokeOrderSvgUri': strokeOrderSvgUri, 'strokeOrderGifUri': strokeOrderGifUri, 'uri': uri }; return returnObject; } } /* -------------------------------------------------------------------------- */ /* searchForExamples related classes */ /* -------------------------------------------------------------------------- */ class ExampleSentencePiece { String lifted; String unlifted; ExampleSentencePiece({String lifted, String unlifted}){ this.lifted = lifted; this.unlifted = unlifted; } Map toJson() { return { 'lifted': lifted, 'unlifted': unlifted }; } } class ExampleResultData { String kanji; String kana; String english; List pieces; ExampleResultData({String english, String kanji, String kana, List pieces}){ this.english = english; this.kanji = kanji; this.kana = kana; this.pieces = pieces; } Map toJson() { return { 'english': english, 'kanji': kanji, 'kana': kana, 'pieces': pieces }; } } class ExampleResults { String query; bool found; String uri; List results; String phrase; ExampleResults({String query, bool found, List results, String uri, String phrase}){ this.query = query; this.found = found; this.results = results; this.uri = uri; this.phrase = phrase; } Map toJson() { return { 'query': query, 'found': found, 'results': results, 'uri': uri, 'phrase': phrase }; } } /* -------------------------------------------------------------------------- */ /* scrapeForPhrase related classes */ /* -------------------------------------------------------------------------- */ class PhraseScrapeSentence { String english; String japanese; List pieces; PhraseScrapeSentence ({String english, String japanese, List pieces}){ this.english = english; this.japanese = japanese; this.pieces = pieces; } Map toJson() => { 'english': english, 'japanese': japanese, 'pieces': pieces }; } class PhraseScrapeMeaning { List seeAlsoTerms; List sentences; String definition; List supplemental; String definitionAbstract; List tags; PhraseScrapeMeaning({ List seeAlsoTerms, List sentences, String definition, List supplemental, String definitionAbstract, List tags, }){ this.seeAlsoTerms = seeAlsoTerms; this.sentences = sentences; this.definition = definition; this.supplemental = supplemental; this.definitionAbstract = definitionAbstract; this.tags = tags; } Map toJson() => { 'seeAlsoTerms': seeAlsoTerms, 'sentences': sentences, 'definition': definition, 'supplemental': supplemental, 'definitionAbstract': definitionAbstract, 'tags': tags }; } class KanjiKanaPair { String kanji; String kana; KanjiKanaPair({ String kanji, String kana }){ this.kanji = kanji; this.kana = kana; } Map toJson() => { 'kanji': kanji, 'kana': kana }; } class PhrasePageScrapeResult { bool found; String query; String uri; List tags; List meanings; List otherForms; List notes; PhrasePageScrapeResult({ bool found, String query, String uri, List tags, List meanings, List otherForms, List notes, }){ this.found = found; this.query = query; this.uri = uri; this.tags = tags; this.meanings = meanings; this.otherForms = otherForms; this.notes = notes; } Map toJson() => { 'found': found, 'query': query, 'uri': uri, 'tags': tags, 'meanings': meanings, 'otherForms': otherForms, 'notes': notes }; } /* -------------------------------------------------------------------------- */ /* searchForPhrase related classes */ /* -------------------------------------------------------------------------- */ class JishoJapaneseWord { String word; String reading; JishoJapaneseWord({this.word, this.reading}); factory JishoJapaneseWord.fromJson(Map json){ return JishoJapaneseWord( word: json['word'] as String, reading: json['reading'] as String ); } } class JishoSenseLink { String text; String url; JishoSenseLink({this.text, this.url}); factory JishoSenseLink.fromJson(Map json){ return JishoSenseLink( text: json['text'] as String, url: json['url'] as String ); } } class JishoWordSense { List english_definitions; List parts_of_speech; List links; List tags; List see_also; List antonyms; List source; List info; List restrictions; JishoWordSense({ this.english_definitions, this.parts_of_speech, this.links, this.tags, this.see_also, this.antonyms, this.source, this.info, this.restrictions }); factory JishoWordSense.fromJson(Map json){ return JishoWordSense( english_definitions: json['english_definitions'] as List, parts_of_speech: json['parts_of_speech'] as List, links: json['links'] as List, tags: json['tags'] as List, see_also: json['see_also'] as List, antonyms: json['antonyms'] as List, source: json['source'] as List, info: json['info'] as List, restrictions: json['restrictions'] as List ); } } class JishoAttribution { bool jmdict; bool jmnedict; bool dbpedia; JishoAttribution({ this.jmdict, this.jmnedict, this.dbpedia }); factory JishoAttribution.fromJson(Map json){ return JishoAttribution( jmdict: json['jmdict'] as bool, jmnedict: json['jmnedict'] as bool, dbpedia: json['dbpedia'] as bool ); } } class JishoResult { String slug; bool is_common; List tags; List jlpt; List japanese; List senses; JishoAttribution attribution; JishoResult({ this.slug, this.is_common, this.tags, this.jlpt, this.japanese, this.senses, this.attribution }) factory JishoResult.fromJson(Map json){ return JishoResult( slug: json['slug'] as String, is_common: json['is_common'] as bool, tags: json['tags'] as List, jlpt: json['jlpt'] as List, japanese: json['japanese'] as List, senses: json['senses'] as List, attribution: json['attribution'] as JishoAttribution ); } } class JishoResultMeta { int status; JishoResultMeta({this.status}); factory JishoResultMeta.fromJson(Map json){ return JishoResultMeta( status: json['status'] as int ); } } class JishoAPIResult { JishoResultMeta meta; List data; JishoAPIResult({this.meta, this.data}); factory JishoAPIResult.fromJson(Map json){ return JishoAPIResult( meta: json['meta'] as JishoResultMeta, data: json['data'] as List ); } }