Commit b59cae61 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

api/projects: make PipelineVariables pageable

parent a4efe368
......@@ -5,6 +5,7 @@
* The `api::projects::issues::Issues` endpoint's `milestone` field was
changed to match the actual API exposed by GitLab (with `None` and `Any`
options).
* The `api::projects::pipelines::PipelineVariables` endpoint is now pageable.
# v0.1210.2
......
......@@ -40,6 +40,8 @@ impl<'a> Endpoint for PipelineVariables<'a> {
}
}
impl<'a> Pageable for PipelineVariables<'a> {}
#[cfg(test)]
mod tests {
use crate::api::projects::pipelines::PipelineVariables;
......
......@@ -26,12 +26,6 @@ use crate::api::{self, common, groups, Query};
use crate::auth::{Auth, AuthError};
use crate::types::*;
macro_rules! query_param_slice {
( $( $x:expr ),* ) => (
&[$($x),*] as QueryParamSlice
)
}
const PATH_SEGMENT_ENCODE_SET: &AsciiSet = &CONTROLS
.add(b' ')
.add(b'"')
......@@ -1897,7 +1891,15 @@ impl Gitlab {
project: ProjectId,
id: PipelineId,
) -> GitlabResult<Vec<PipelineVariable>> {
self.get(format!("projects/{}/pipelines/{}/variables", project, id))
Ok(api::paged(
projects::pipelines::PipelineVariables::builder()
.project(project.value())
.pipeline(id.value())
.build()
.unwrap(),
api::Pagination::All,
)
.query(self)?)
}
/// Create a new pipeline.
......@@ -2614,15 +2616,6 @@ impl Gitlab {
serde_json::from_value::<T>(v).map_err(GitlabError::data_type::<T>)
}
/// Create a `GET` request to an API endpoint.
fn get<T, U>(&self, url: U) -> GitlabResult<T>
where
T: DeserializeOwned,
U: AsRef<str>,
{
self.get_with_param(url, query_param_slice![])
}
/// Create a `GET` request to an API endpoint with query parameters.
fn get_with_param<T, U, I, K, V>(&self, url: U, params: I) -> GitlabResult<T>
where
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment