Add documentation to objects

This commit is contained in:
Oystein Kristoffer Tveit 2020-06-30 12:46:41 +02:00
parent 59411b8463
commit 5ae14e60b7
2 changed files with 55 additions and 0 deletions

View File

@ -1,6 +1,7 @@
## 1.1.0 ## 1.1.0
- Export object interfaces for both libraries - Export object interfaces for both libraries
- Add documentation for object interfaces
## 1.0.2 ## 1.0.2

View File

@ -3,8 +3,11 @@
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
class YomiExample { class YomiExample {
/// The original text of the example.
String example; String example;
/// The reading of the example.
String reading; String reading;
/// The meaning of the example.
String meaning; String meaning;
YomiExample({this.example, this.reading, this.meaning}); YomiExample({this.example, this.reading, this.meaning});
@ -14,8 +17,11 @@ class YomiExample {
} }
class Radical { class Radical {
/// The radical symbol, if applicable.
String symbol; String symbol;
/// The radical forms used in this kanji, if applicable.
List<String> forms; List<String> forms;
/// The meaning of the radical, if applicable.
String meaning; String meaning;
Radical({this.symbol, this.forms, this.meaning}); Radical({this.symbol, this.forms, this.meaning});
@ -25,23 +31,42 @@ class Radical {
} }
class KanjiResult { class KanjiResult {
/// True if results were found.
String query; String query;
/// The term that you searched for.
bool found; bool found;
/// The school level that the kanji is taught in, if applicable.
String taughtIn; String taughtIn;
/// The lowest JLPT exam that this kanji is likely to appear in, if applicable.
///
/// 'N5' or 'N4' or 'N3' or 'N2' or 'N1'.
String jlptLevel; String jlptLevel;
/// A number representing this kanji's frequency rank in newspapers, if applicable.
int newspaperFrequencyRank; int newspaperFrequencyRank;
/// How many strokes this kanji is typically drawn in, if applicable.
int strokeCount; int strokeCount;
/// The meaning of the kanji, if applicable.
String meaning; String meaning;
/// This character's kunyomi, if applicable.
List<String> kunyomi; List<String> kunyomi;
/// This character's onyomi, if applicable.
List<String> onyomi; List<String> onyomi;
/// Examples of this character's kunyomi being used, if applicable.
List<YomiExample> kunyomiExamples; List<YomiExample> kunyomiExamples;
/// Examples of this character's onyomi being used, if applicable.
List<YomiExample> onyomiExamples; List<YomiExample> onyomiExamples;
/// Information about this character's radical, if applicable.
Radical radical; Radical radical;
/// The parts used in this kanji, if applicable.
List<String> parts; List<String> parts;
/// The URL to a diagram showing how to draw this kanji step by step, if applicable.
String strokeOrderDiagramUri; String strokeOrderDiagramUri;
/// The URL to an SVG describing how to draw this kanji, if applicable.
String strokeOrderSvgUri; String strokeOrderSvgUri;
/// The URL to a gif showing the kanji being draw and its stroke order, if applicable.
String strokeOrderGifUri; String strokeOrderGifUri;
/// The URI that these results were scraped from, if applicable.
String uri; String uri;
KanjiResult( KanjiResult(
@ -91,7 +116,9 @@ class KanjiResult {
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
class ExampleSentencePiece { class ExampleSentencePiece {
/// Baseline text shown on Jisho.org (below the lifted text / furigana)
String lifted; String lifted;
/// Furigana text shown on Jisho.org (above the unlifted text)
String unlifted; String unlifted;
ExampleSentencePiece({this.lifted, this.unlifted}); ExampleSentencePiece({this.lifted, this.unlifted});
@ -102,9 +129,13 @@ class ExampleSentencePiece {
} }
class ExampleResultData { class ExampleResultData {
/// The example sentence including kanji.
String kanji; String kanji;
/// The example sentence without kanji (only kana). Sometimes this may include some Kanji, as furigana is not always available from Jisho.org.
String kana; String kana;
/// An English translation of the example.
String english; String english;
/// The lifted/unlifted pairs that make up the sentence. Lifted text is furigana, unlifted is the text below the furigana.
List<ExampleSentencePiece> pieces; List<ExampleSentencePiece> pieces;
ExampleResultData({this.english, this.kanji, this.kana, this.pieces}); ExampleResultData({this.english, this.kanji, this.kana, this.pieces});
@ -115,10 +146,15 @@ class ExampleResultData {
} }
class ExampleResults { class ExampleResults {
/// The term that you searched for.
String query; String query;
/// True if results were found.
bool found; bool found;
/// The URI that these results were scraped from.
String uri; String uri;
/// The examples that were found, if any.
List<ExampleResultData> results; List<ExampleResultData> results;
String phrase; String phrase;
ExampleResults({this.query, this.found, this.results, this.uri, this.phrase}); ExampleResults({this.query, this.found, this.results, this.uri, this.phrase});
@ -139,8 +175,11 @@ class ExampleResults {
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
class PhraseScrapeSentence { class PhraseScrapeSentence {
/// The English meaning of the sentence.
String english; String english;
/// The Japanese text of the sentence.
String japanese; String japanese;
/// The lifted/unlifted pairs that make up the sentence. Lifted text is furigana, unlifted is the text below the furigana.
List<ExampleSentencePiece> pieces; List<ExampleSentencePiece> pieces;
PhraseScrapeSentence({this.english, this.japanese, this.pieces}); PhraseScrapeSentence({this.english, this.japanese, this.pieces});
@ -150,11 +189,19 @@ class PhraseScrapeSentence {
} }
class PhraseScrapeMeaning { class PhraseScrapeMeaning {
/// The words that Jisho lists as "see also".
List<String> seeAlsoTerms; List<String> seeAlsoTerms;
/// Example sentences for this meaning.
List<PhraseScrapeSentence> sentences; List<PhraseScrapeSentence> sentences;
/// The definition of the meaning
String definition; String definition;
/// Supplemental information.
/// For example "usually written using kana alone".
List<String> supplemental; List<String> supplemental;
/// An "abstract" definition.
/// Often this is a Wikipedia definition.
String definitionAbstract; String definitionAbstract;
/// Tags associated with this meaning.
List<String> tags; List<String> tags;
PhraseScrapeMeaning( PhraseScrapeMeaning(
@ -185,12 +232,19 @@ class KanjiKanaPair {
} }
class PhrasePageScrapeResult { class PhrasePageScrapeResult {
/// True if a result was found.
bool found; bool found;
/// The term that you searched for.
String query; String query;
/// The URI that these results were scraped from, if a result was found.
String uri; String uri;
/// Other forms of the search term, if a result was found.
List<String> tags; List<String> tags;
/// Information about the meanings associated with this search result.
List<PhraseScrapeMeaning> meanings; List<PhraseScrapeMeaning> meanings;
/// Tags associated with this search result.
List<KanjiKanaPair> otherForms; List<KanjiKanaPair> otherForms;
/// Notes associated with the search result.
List<String> notes; List<String> notes;
PhrasePageScrapeResult( PhrasePageScrapeResult(