Skip to content

Commit c9b667f

Browse files
committed
feat(projects): implement License struct for the Project (related for get_project_by_id)
1 parent 33453e5 commit c9b667f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
- [ ] - Implement custom struct for `requested_status` value (w/ Option)
1111
- [ ] - implement custom deserializer for URL links
1212
- [ ] - implement custom struct for donation links
13-
- [ ] - implement custom struct for license
13+
- [x] - implement custom struct for license
1414
- [x] - implement custom `ProjectStatus` struct

src/structs/projects.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! [documentation](https://docs.modrinth.com/api/operations/tags/projects/)
44
5-
use super::Date;
5+
use super::*;
66
use serde::{Deserialize, Serialize};
77

88
#[derive(Debug, Serialize, Deserialize)]
@@ -70,9 +70,7 @@ pub struct Project {
7070
pub approved: Option<Date>,
7171
pub queued: Option<Date>,
7272
pub followers: usize,
73-
/// TODO: read #6 in TODO.md file (structs\projects section)
74-
#[serde(skip)]
75-
pub license: Option<Vec<String>>, // placeholder
73+
pub license: License,
7674
/// A list of the version IDs of the project (will never be empty unless draft status)
7775
pub versions: Vec<String>,
7876
/// A list of all the game versions supported by the project
@@ -101,3 +99,10 @@ pub enum MonetizationStatus {
10199
Demonetized,
102100
ForceDemonetized,
103101
}
102+
103+
#[derive(Deserialize, Serialize, Debug, Clone)]
104+
pub struct License {
105+
pub id: String,
106+
pub name: String,
107+
pub url: Option<String>,
108+
}

0 commit comments

Comments
 (0)