openapi_github/models/
code_search_result_item.rs

1/*
2 * GitHub's official OpenAPI spec + Octokit extension
3 *
4 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
5 *
6 * The version of the OpenAPI document: 16.6.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// CodeSearchResultItem : Code Search Result Item
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CodeSearchResultItem {
17    #[serde(rename = "name")]
18    pub name: String,
19    #[serde(rename = "path")]
20    pub path: String,
21    #[serde(rename = "sha")]
22    pub sha: String,
23    #[serde(rename = "url")]
24    pub url: String,
25    #[serde(rename = "git_url")]
26    pub git_url: String,
27    #[serde(rename = "html_url")]
28    pub html_url: String,
29    #[serde(rename = "repository")]
30    pub repository: Box<models::MinimalRepository>,
31    #[serde(rename = "score")]
32    pub score: f64,
33    #[serde(rename = "file_size", skip_serializing_if = "Option::is_none")]
34    pub file_size: Option<i32>,
35    #[serde(rename = "language", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub language: Option<Option<String>>,
37    #[serde(rename = "last_modified_at", skip_serializing_if = "Option::is_none")]
38    pub last_modified_at: Option<String>,
39    #[serde(rename = "line_numbers", skip_serializing_if = "Option::is_none")]
40    pub line_numbers: Option<Vec<String>>,
41    #[serde(rename = "text_matches", skip_serializing_if = "Option::is_none")]
42    pub text_matches: Option<Vec<models::SearchResultTextMatchesInner>>,
43}
44
45impl CodeSearchResultItem {
46    /// Code Search Result Item
47    pub fn new(name: String, path: String, sha: String, url: String, git_url: String, html_url: String, repository: models::MinimalRepository, score: f64) -> CodeSearchResultItem {
48        CodeSearchResultItem {
49            name,
50            path,
51            sha,
52            url,
53            git_url,
54            html_url,
55            repository: Box::new(repository),
56            score,
57            file_size: None,
58            language: None,
59            last_modified_at: None,
60            line_numbers: None,
61            text_matches: None,
62        }
63    }
64}
65