lmrc_gitlab/api/
mod.rs

1//! High-level API operations for GitLab resources.
2//!
3//! This module provides builder-pattern APIs for interacting with
4//! GitLab resources in a fluent, ergonomic way.
5//!
6//! # API Patterns
7//!
8//! This library uses different patterns for different types of operations:
9//!
10//! ## 1. Resource-specific operations (via client methods)
11//!
12//! For operations on specific resources, use the client methods:
13//!
14//! ```no_run
15//! # use lmrc_gitlab::GitLabClient;
16//! # async fn example() -> Result<(), lmrc_gitlab::GitLabError> {
17//! # let client = GitLabClient::new("https://gitlab.com", "token")?;
18//! // Single resource operations
19//! let pipeline = client.pipeline("project", 123).get().await?;
20//! let job = client.job("project", 456).get().await?;
21//!
22//! // List operations with filters
23//! let pipelines = client.pipelines("project")
24//!     .status(lmrc_gitlab::models::PipelineStatus::Failed)
25//!     .list()
26//!     .await?;
27//! # Ok(())
28//! # }
29//! ```
30//!
31//! ## 2. Project-level operations
32//!
33//! For operations at the project scope (creating resources, etc.):
34//!
35//! ```no_run
36//! # use lmrc_gitlab::GitLabClient;
37//! # async fn example() -> Result<(), lmrc_gitlab::GitLabError> {
38//! # let client = GitLabClient::new("https://gitlab.com", "token")?;
39//! // Create/trigger new pipeline
40//! let pipeline = client.project("myproject")
41//!     .create_pipeline()
42//!     .ref_name("main")
43//!     .variable("ENV", "prod")
44//!     .trigger()
45//!     .await?;
46//! # Ok(())
47//! # }
48//! ```
49//!
50//! ## 3. Direct API access
51//!
52//! For operations not yet wrapped, use the underlying client:
53//!
54//! ```no_run
55//! # use lmrc_gitlab::GitLabClient;
56//! # use gitlab::api::Query;
57//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
58//! # let client = GitLabClient::new("https://gitlab.com", "token")?;
59//! // Access the raw gitlab crate client
60//! let raw_client = client.client();
61//!
62//! // Use any gitlab API endpoint
63//! // let endpoint = ...;
64//! // let result = endpoint.query(raw_client)?;
65//! # Ok(())
66//! # }
67//! ```
68
69pub mod jobs;
70pub mod pipelines;
71pub mod projects;
72pub mod variables;
73
74pub use jobs::{JobBuilder, JobListBuilder};
75pub use pipelines::{PipelineBuilder, PipelineListBuilder};
76pub use projects::{CreatePipelineBuilder, ProjectBuilder};
77pub use variables::VariableBuilder;