Compare commits
No commits in common. "tasyn" and "main" have entirely different histories.
14 changed files with 10 additions and 70 deletions
|
@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
|
|||
use url::Url;
|
||||
|
||||
/// Represents a generic attachment.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Attachment {
|
||||
/// The browser download URL of the attachment.
|
||||
pub browser_download_url: Url,
|
||||
|
|
|
@ -21,7 +21,6 @@ pub struct CreateIssueOption {
|
|||
/// The milestone ID for the issue.
|
||||
pub milestone: Option<usize>,
|
||||
/// The reference for the issue.
|
||||
#[serde(rename = "ref")]
|
||||
pub ref_field: String,
|
||||
/// The title of the issue (required).
|
||||
pub title: String,
|
||||
|
|
|
@ -34,7 +34,6 @@ impl EditIssueOption {
|
|||
assignee: issue.assignee.as_ref().map(|user| user.login_name.clone()),
|
||||
assignees: issue
|
||||
.assignees
|
||||
.unwrap_or_default()
|
||||
.iter()
|
||||
.map(|user| user.login_name.clone())
|
||||
.collect::<Vec<_>>(),
|
||||
|
|
|
@ -50,14 +50,14 @@ use crate::types::misc::boolean_enums::is::locked::IsLocked;
|
|||
use crate::types::misc::boolean_enums::state_type::StateType;
|
||||
|
||||
/// Represents an issue in a repository.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Issue {
|
||||
/// List of attachments.
|
||||
pub assets: Vec<Attachment>,
|
||||
/// The user assigned to the issue.
|
||||
pub assignee: Option<User>,
|
||||
/// List of assignees.
|
||||
pub assignees: Option<Vec<User>>,
|
||||
pub assignees: Vec<User>,
|
||||
/// The body of the issue.
|
||||
pub body: String,
|
||||
/// The date and time when the issue was closed (if closed).
|
||||
|
@ -87,7 +87,6 @@ pub struct Issue {
|
|||
/// Pull request information for the issue.
|
||||
pub pull_request: Option<PullRequestMeta>,
|
||||
/// The reference for the issue.
|
||||
#[serde(rename = "ref")]
|
||||
pub ref_field: String,
|
||||
/// Metadata for the repository.
|
||||
pub repository: RepositoryMeta,
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::types::misc::boolean_enums::is::exclusive::Exclusive;
|
|||
use crate::types::misc::color::Color;
|
||||
|
||||
/// Label represents a label attached to an issue or a PR.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Label {
|
||||
/// The color of the label (in hexadecimal format).
|
||||
pub color: Color,
|
||||
|
|
|
@ -24,7 +24,7 @@ use serde::{Deserialize, Serialize};
|
|||
use crate::types::misc::boolean_enums::state_type::StateType;
|
||||
|
||||
/// Milestone represents a collection of issues on one repository.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Milestone {
|
||||
/// The timestamp when the milestone was closed.
|
||||
pub closed_at: Option<DateTime<Utc>>,
|
||||
|
|
|
@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
|
|||
use crate::types::misc::boolean_enums::is::merged::IsMerged;
|
||||
|
||||
/// PullRequestMeta represents PR information for an issue if it is a PR.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub struct PullRequestMeta {
|
||||
/// Indicates whether the PR is merged or not.
|
||||
pub merged: IsMerged,
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::fmt::Display;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Represents basic repository information.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub struct RepositoryMeta {
|
||||
/// The full name of the repository.
|
||||
pub full_name: String,
|
||||
|
|
|
@ -113,36 +113,4 @@ mod tests {
|
|||
};
|
||||
assert_eq!(user, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn deserialize_works_with_blank_language() {
|
||||
let data = include_str!("../../../test_data/example_user_blank_language.json");
|
||||
let user: User = serde_json::from_str(data).unwrap();
|
||||
let expected = User {
|
||||
active: IsActive::Yes,
|
||||
avatar_url: OptionalUrl::Some(
|
||||
Url::from_str("https://codeberg.org/avatars/foo-bar").unwrap(),
|
||||
),
|
||||
created: DateTime::from_str("2022-11-04T14:41:29Z").unwrap(),
|
||||
description: String::from(""),
|
||||
email: Email::from_str("example@mail.com").unwrap(),
|
||||
followers_count: 2,
|
||||
following_count: 1,
|
||||
full_name: String::from(""),
|
||||
id: 12345,
|
||||
is_admin: IsAdmin::No,
|
||||
language: Locale::None,
|
||||
last_login: DateTime::from_str("2023-07-26T19:38:27Z").unwrap(),
|
||||
location: String::from(""),
|
||||
login: String::from("ExampleUser"),
|
||||
login_name: String::from(""),
|
||||
prohibit_login: ProhibitLogin::No,
|
||||
restricted: IsRestricted::No,
|
||||
starred_repos_count: 0,
|
||||
username: String::from("ExampleUser"),
|
||||
visibility: Visibility::Public,
|
||||
website: OptionalUrl::Some(Url::from_str("https://example.com").unwrap()),
|
||||
};
|
||||
assert_eq!(user, expected);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@ implement_boolean_enum!(ignore_whitespace_conflicts, IgnoreWhitespaceConflicts);
|
|||
implement_boolean_enum!(includes_all_repositories, IncludesAllRepositories);
|
||||
implement_boolean_enum!(prohibit_login, ProhibitLogin);
|
||||
implement_boolean_enum!(auto_init, AutoInit);
|
||||
implement_boolean_enum!(state_type, StateType { Closed, Open });
|
||||
implement_boolean_enum!(state_type, StateType { Open, Closed });
|
||||
implement_boolean_enum!(unset_due_date, UnsetDueDate { Unset, Keep });
|
||||
|
|
|
@ -6,7 +6,7 @@ use palette::Srgb;
|
|||
use serde::de::Visitor;
|
||||
use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Color(pub(crate) Rgb<Srgb, u8>);
|
||||
|
||||
impl Display for Color {
|
||||
|
|
|
@ -18,8 +18,6 @@ use strum::{Display, EnumIs, EnumIter, EnumString};
|
|||
)]
|
||||
pub enum Locale {
|
||||
// 🚧🚧 TODO 🚧🚧 : extend the list
|
||||
#[serde(rename = "")]
|
||||
None,
|
||||
#[serde(rename = "de-DE")]
|
||||
De,
|
||||
#[serde(rename = "en-US")]
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
"original_author": "original_author",
|
||||
"original_author_id": 123,
|
||||
"pull_request": null,
|
||||
"ref": "refs/1",
|
||||
"ref_field": "refs/1",
|
||||
"repository": {
|
||||
"full_name": "exampleuser/example-repo",
|
||||
"id": 123,
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"active": true,
|
||||
"avatar_url": "https://codeberg.org/avatars/foo-bar",
|
||||
"created": "2022-11-04T14:41:29Z",
|
||||
"description": "",
|
||||
"email": "example@mail.com",
|
||||
"followers_count": 2,
|
||||
"following_count": 1,
|
||||
"full_name": "",
|
||||
"id": 12345,
|
||||
"is_admin": false,
|
||||
"language": "",
|
||||
"last_login": "2023-07-26T19:38:27Z",
|
||||
"location": "",
|
||||
"login": "ExampleUser",
|
||||
"login_name": "",
|
||||
"prohibit_login": false,
|
||||
"restricted": false,
|
||||
"starred_repos_count": 0,
|
||||
"username": "ExampleUser",
|
||||
"visibility": "public",
|
||||
"website": "https://example.com"
|
||||
}
|
Loading…
Reference in a new issue