feat: implement Display for PullRequest

This commit is contained in:
aviac 2023-09-25 08:32:55 +02:00
parent 49e18362ea
commit 032428b98e
No known key found for this signature in database
GPG key ID: 644781002BDEA982
3 changed files with 9 additions and 40 deletions

2
Cargo.lock generated
View file

@ -224,7 +224,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "forgejo-api-types"
version = "0.1.4"
version = "0.1.5"
dependencies = [
"chrono",
"clap",

View file

@ -1,6 +1,6 @@
[package]
name = "forgejo-api-types"
version = "0.1.4"
version = "0.1.5"
edition = "2021"
license = "AGPL-3.0-or-later"
keywords = ["forgejo", "types", "codeberg", "api"]

View file

@ -1,41 +1,4 @@
// [PullRequest{
// description:
// PullRequest represents a pull request
//
// allow_maintainer_edit boolean
// assignee User{...}
// assignees [
// x-go-name: Assignees
// User{...}]
// base PRBranchInfo{...}
// body string
// closed_at string($date-time)
// comments integer($int64)
// created_at string($date-time)
// diff_url string
// due_date string($date-time)
// head PRBranchInfo{...}
// html_url string
// id integer($int64)
// is_locked boolean
// labels [
// x-go-name: Labels
// Label{...}]
// merge_base string
// merge_commit_sha string
// mergeable boolean
// merged boolean
// merged_at string($date-time)
// merged_by User{...}
// milestone Milestone{...}
// number integer($int64)
// patch_url string
// state StateType[...]
// title string
// updated_at string($date-time)
// url string
// user User{...}
// }]
use std::fmt::Display;
use crate::types::api::label::Label;
use crate::types::api::milestone::Milestone;
@ -114,6 +77,12 @@ pub struct PullRequest {
pub user: User,
}
impl Display for PullRequest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.title)
}
}
#[test]
fn test_pull_request_serialization_deserialization() {
let user: User =