openapi_github/models/
commit_search_result_item.rs1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CommitSearchResultItem {
17 #[serde(rename = "url")]
18 pub url: String,
19 #[serde(rename = "sha")]
20 pub sha: String,
21 #[serde(rename = "html_url")]
22 pub html_url: String,
23 #[serde(rename = "comments_url")]
24 pub comments_url: String,
25 #[serde(rename = "commit")]
26 pub commit: Box<models::CommitSearchResultItemCommit>,
27 #[serde(rename = "author", deserialize_with = "Option::deserialize")]
28 pub author: Option<Box<models::NullableSimpleUser>>,
29 #[serde(rename = "committer", deserialize_with = "Option::deserialize")]
30 pub committer: Option<Box<models::NullableGitUser>>,
31 #[serde(rename = "parents")]
32 pub parents: Vec<models::FileCommitCommitParentsInner>,
33 #[serde(rename = "repository")]
34 pub repository: Box<models::MinimalRepository>,
35 #[serde(rename = "score")]
36 pub score: f64,
37 #[serde(rename = "node_id")]
38 pub node_id: String,
39 #[serde(rename = "text_matches", skip_serializing_if = "Option::is_none")]
40 pub text_matches: Option<Vec<models::SearchResultTextMatchesInner>>,
41}
42
43impl CommitSearchResultItem {
44 pub fn new(url: String, sha: String, html_url: String, comments_url: String, commit: models::CommitSearchResultItemCommit, author: Option<models::NullableSimpleUser>, committer: Option<models::NullableGitUser>, parents: Vec<models::FileCommitCommitParentsInner>, repository: models::MinimalRepository, score: f64, node_id: String) -> CommitSearchResultItem {
46 CommitSearchResultItem {
47 url,
48 sha,
49 html_url,
50 comments_url,
51 commit: Box::new(commit),
52 author: author.map(Box::new),
53 committer: committer.map(Box::new),
54 parents,
55 repository: Box::new(repository),
56 score,
57 node_id,
58 text_matches: None,
59 }
60 }
61}
62