use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CodeSearchResultItem {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "path")]
pub path: String,
#[serde(rename = "sha")]
pub sha: String,
#[serde(rename = "url")]
pub url: String,
#[serde(rename = "git_url")]
pub git_url: String,
#[serde(rename = "html_url")]
pub html_url: String,
#[serde(rename = "repository")]
pub repository: Box<models::MinimalRepository>,
#[serde(rename = "score")]
pub score: f64,
#[serde(rename = "file_size", skip_serializing_if = "Option::is_none")]
pub file_size: Option<i32>,
#[serde(rename = "language", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub language: Option<Option<String>>,
#[serde(rename = "last_modified_at", skip_serializing_if = "Option::is_none")]
pub last_modified_at: Option<String>,
#[serde(rename = "line_numbers", skip_serializing_if = "Option::is_none")]
pub line_numbers: Option<Vec<String>>,
#[serde(rename = "text_matches", skip_serializing_if = "Option::is_none")]
pub text_matches: Option<Vec<models::SearchResultTextMatchesInner>>,
}
impl CodeSearchResultItem {
pub fn new(name: String, path: String, sha: String, url: String, git_url: String, html_url: String, repository: models::MinimalRepository, score: f64) -> CodeSearchResultItem {
CodeSearchResultItem {
name,
path,
sha,
url,
git_url,
html_url,
repository: Box::new(repository),
score,
file_size: None,
language: None,
last_modified_at: None,
line_numbers: None,
text_matches: None,
}
}
}