mobilitydata_client/models/matching_license.rs
1/*
2 * Mobility Database Catalog
3 *
4 * API for the Mobility Database Catalog. See [https://mobilitydatabase.org/](https://mobilitydatabase.org/). The Mobility Database API uses OAuth2 authentication. To initiate a successful API request, an access token must be included as a bearer token in the HTTP header. Access tokens are valid for one hour. To obtain an access token, you'll first need a refresh token, which is long-lived and does not expire.
5 *
6 * The version of the OpenAPI document: 1.0.0
7 * Contact: api@mobilitydata.org
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// MatchingLicense : Matching a license
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct MatchingLicense {
17 /// Unique identifier for the license (typically SPDX ID)
18 #[serde(rename = "license_id", skip_serializing_if = "Option::is_none")]
19 pub license_id: Option<String>,
20 /// Original license URL provided for resolution
21 #[serde(rename = "license_url", skip_serializing_if = "Option::is_none")]
22 pub license_url: Option<String>,
23 /// URL after normalization (lowercased, trimmed, protocol removed)
24 #[serde(rename = "normalized_url", skip_serializing_if = "Option::is_none")]
25 pub normalized_url: Option<String>,
26 /// Type of match performed. One of: - 'exact': Direct match found in database - 'heuristic': Matched via pattern-based rules (CC resolver, common patterns) - 'fuzzy': Similarity-based match against same-host licenses
27 #[serde(rename = "match_type", skip_serializing_if = "Option::is_none")]
28 pub match_type: Option<String>,
29 /// Match confidence score (0.0-1.0), examples: - 1.0: Exact match - 0.99: Creative Commons resolved - 0.95: Pattern heuristic match - 0.0-1.0: Fuzzy match score based on string similarity
30 #[serde(rename = "confidence", skip_serializing_if = "Option::is_none")]
31 pub confidence: Option<f64>,
32 /// SPDX License Identifier if matched (e.g., 'CC-BY-4.0', 'MIT')
33 #[serde(rename = "spdx_id", skip_serializing_if = "Option::is_none")]
34 pub spdx_id: Option<String>,
35 /// Human-readable name of the matched license
36 #[serde(rename = "matched_name", skip_serializing_if = "Option::is_none")]
37 pub matched_name: Option<String>,
38 /// Canonical URL from the license catalog/database
39 #[serde(rename = "matched_catalog_url", skip_serializing_if = "Option::is_none")]
40 pub matched_catalog_url: Option<String>,
41 /// Source of the match. Examples: - 'db.license': Exact match from database - 'cc-resolver': Creative Commons license resolver - 'pattern-heuristics': Generic pattern matching
42 #[serde(rename = "matched_source", skip_serializing_if = "Option::is_none")]
43 pub matched_source: Option<String>,
44 /// Additional context about the match (e.g., version normalization, locale detection)
45 #[serde(rename = "notes", skip_serializing_if = "Option::is_none")]
46 pub notes: Option<String>,
47 /// Regional/jurisdictional variant identifier for ported licenses (e.g., 'CC-BY-2.1-jp' for Japan-ported Creative Commons)
48 #[serde(rename = "regional_id", skip_serializing_if = "Option::is_none")]
49 pub regional_id: Option<String>,
50}
51
52impl MatchingLicense {
53 /// Matching a license
54 pub fn new() -> MatchingLicense {
55 MatchingLicense {
56 license_id: None,
57 license_url: None,
58 normalized_url: None,
59 match_type: None,
60 confidence: None,
61 spdx_id: None,
62 matched_name: None,
63 matched_catalog_url: None,
64 matched_source: None,
65 notes: None,
66 regional_id: None,
67 }
68 }
69}
70