Refactor Gitea client and improve issue handling
Update the authorization header format in the Gitea client. Enhance issue details in work package creation and make `number` field public in the `Issue` struct.
This commit is contained in:
parent
696fd15cfa
commit
7b6cc33ecb
@ -47,7 +47,7 @@ impl Issue2WorkActionTrait for GiteaAction {
|
||||
|
||||
fn create_work_package_from_issue(issue: &Issue, assignee: Option<User>) -> WorkPackageWriter {
|
||||
WorkPackageWriter {
|
||||
subject: format!("{} ({})", issue.title, issue.repository.full_name),
|
||||
subject: format!("{} ({}/{})", issue.title, issue.repository.full_name, issue.number),
|
||||
work_type: "TASK".into(),
|
||||
description: crate::openproject::work::DescriptionWriter {
|
||||
format: "markdown".into(),
|
||||
|
@ -54,7 +54,7 @@ impl Client {
|
||||
|
||||
pub async fn get<T: DeserializeOwned>(&self, url: Url) -> Result<T, GeneralError> {
|
||||
let mut headers = HeaderMap::new();
|
||||
headers.append(AUTHORIZATION, self.token.parse()?);
|
||||
headers.append(AUTHORIZATION, format!("token {}", self.token).parse()?);
|
||||
headers.append(ACCEPT, "application/json".parse()?);
|
||||
|
||||
let client = ClientBuilder::new()
|
||||
|
@ -7,7 +7,7 @@ use url::Url;
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Issue {
|
||||
pub id: u64,
|
||||
number: u64,
|
||||
pub number: u64,
|
||||
pub title: String,
|
||||
pub body: String,
|
||||
pub repository: Repository,
|
||||
|
Loading…
Reference in New Issue
Block a user