data_for_seo/entity/content_generation/check_grammar.rs
1use serde::{Deserialize, Serialize};
2
3/// Result of `content_generation/check_grammar/live`: grammar and spelling errors.
4/// See <https://docs.dataforseo.com/v3/content_generation/check_grammar/live/>.
5#[derive(Debug, Default, Serialize, Deserialize, Clone)]
6pub struct ContentGenerationApiCheckGrammar {
7 /// Number of input tokens in the POST request.
8 pub input_tokens: Option<i64>,
9 /// Number of output tokens in the response.
10 pub output_tokens: Option<i64>,
11 /// Number of new tokens in the response.
12 pub new_tokens: Option<i64>,
13 /// The text supplied in the POST request.
14 pub initial_text: Option<String>,
15 /// Language code supplied in the POST request.
16 pub language_code: Option<String>,
17 /// Number of errors returned in `items`.
18 pub items_count: Option<i64>,
19 /// Grammar and spelling errors found in the text.
20 pub items: Option<Vec<ContentGenerationCheckGrammarItem>>,
21}
22
23/// Result item of `content_generation/check_grammar/languages`: a supported
24/// grammar-check language.
25/// See <https://docs.dataforseo.com/v3/content_generation/check_grammar/languages/>.
26#[derive(Debug, Default, Serialize, Deserialize, Clone)]
27pub struct ContentGenerationApiCheckGrammarLanguage {
28 /// Full language name.
29 pub language_name: Option<String>,
30 /// ISO 639-1 language code.
31 pub language_code: Option<String>,
32}
33
34/// A single grammar or spelling error found in the text.
35#[derive(Debug, Default, Serialize, Deserialize, Clone)]
36pub struct ContentGenerationCheckGrammarItem {
37 /// Type of element.
38 #[serde(rename = "type")]
39 pub element_type: Option<String>,
40 /// Message describing the grammar or spelling error.
41 pub message: Option<String>,
42 /// Description of the grammar or spelling error.
43 pub description: Option<String>,
44 /// Suggested corrections.
45 pub suggestions: Option<Vec<String>>,
46 /// Character offset of the error within the text.
47 pub offset: Option<i64>,
48 /// Character length of the erroneous span.
49 pub length: Option<i64>,
50 /// ID of the grammar or spelling rule that flagged the error.
51 pub rule_id: Option<String>,
52 /// Description of the rule.
53 pub rule_description: Option<String>,
54 /// Issue type flagged by the rule.
55 pub rule_issue_type: Option<String>,
56 /// ID of the rule category.
57 pub rule_category_id: Option<String>,
58 /// Name of the rule category.
59 pub rule_category_name: Option<String>,
60}