Skip to main content

atlassian_rust_api/jira/endpoints/fields/
get_all_fields.rs

1use std::sync::Arc;
2
3use crate::{Jira, Result, rest_client::RestClient, web::Endpoint};
4
5#[derive(Debug, Clone)]
6pub struct GetAllFieldsBuilder {
7	client: Arc<RestClient>,
8	request: GetAllFieldsRequest,
9}
10
11#[derive(Debug, Clone, Default)]
12struct GetAllFieldsRequest;
13
14impl Endpoint for GetAllFieldsRequest {
15	fn endpoint(&self) -> std::borrow::Cow<'static, str> {
16		"field".into()
17	}
18}
19
20impl GetAllFieldsBuilder {
21	fn new(client: Arc<RestClient>) -> GetAllFieldsBuilder {
22		GetAllFieldsBuilder { client, request: GetAllFieldsRequest::default() }
23	}
24
25	pub async fn send(self) -> Result<serde_json::Value> {
26		self.client.get(self.request).await
27	}
28}
29
30impl Jira {
31	/// Returns a list of all fields, both system and custom
32	pub fn get_all_fields(&self) -> GetAllFieldsBuilder {
33		GetAllFieldsBuilder::new(Arc::clone(&self.client))
34	}
35}