gitea_sdk/api/pulls/
pinned.rs1use serde::Serialize;
2
3use crate::{error::Result, model::pulls::PullRequest, Client};
4
5#[derive(Debug, Clone, Serialize)]
6pub struct PinnedPullRequestsBuilder {
7 #[serde(skip)]
8 owner: String,
9 #[serde(skip)]
10 repo: String,
11}
12
13impl PinnedPullRequestsBuilder {
14 pub fn new(owner: impl ToString, repo: impl ToString) -> Self {
15 Self {
16 owner: owner.to_string(),
17 repo: repo.to_string(),
18 }
19 }
20 pub async fn send(&self, client: &Client) -> Result<Vec<PullRequest>> {
22 let owner = &self.owner;
23 let repo = &self.repo;
24 let req = client
25 .get(format!("/repos/{owner}/{repo}/pulls/pinned"))
26 .build()?;
27 let res = client.make_request(req).await?;
28 client.parse_response(res).await
29 }
30}