ironflow_ops_gitlab/lib.rs
1//! GitLab integration for Ironflow workflows.
2//!
3//! This crate provides a thin integration layer between the
4//! [`gitlab`](https://crates.io/crates/gitlab) crate and Ironflow's workflow
5//! engine. It re-exports the full `gitlab` API so that workflow handlers get
6//! typed, builder-based access to every GitLab endpoint without managing
7//! authentication or HTTP clients manually.
8//!
9//! # Quick start
10//!
11//! ```no_run
12//! use ironflow_ops_gitlab::GitLab;
13//! use ironflow_core::operation::{OperationContext, NoopSecretResolver};
14//! use std::sync::Arc;
15//!
16//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
17//! let ctx = OperationContext::new(Arc::new(NoopSecretResolver));
18//! let gitlab = GitLab::from_context(&ctx).await?;
19//! # Ok(())
20//! # }
21//! ```
22//!
23//! # Typed queries
24//!
25//! Use the re-exported [`gitlab::api`] builders and [`gitlab::api::AsyncQuery`] to call any
26//! endpoint with a typed response:
27//!
28//! ```no_run
29//! use ironflow_ops_gitlab::GitLab;
30//! use gitlab::api::{projects, AsyncQuery};
31//! use ironflow_core::operation::{OperationContext, NoopSecretResolver};
32//! use std::sync::Arc;
33//!
34//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
35//! let ctx = OperationContext::new(Arc::new(NoopSecretResolver));
36//! let gitlab = GitLab::from_context(&ctx).await?;
37//!
38//! let endpoint = projects::Project::builder().project(42).build()?;
39//! let project: serde_json::Value = endpoint.query_async(gitlab.client()).await?;
40//! # Ok(())
41//! # }
42//! ```
43//!
44//! # Tracked operations
45//!
46//! Wrap any endpoint in [`GitLabOp`] to execute it as a tracked workflow step
47//! via `WorkflowContext::operation()`:
48//!
49//! ```no_run
50//! use ironflow_ops_gitlab::GitLab;
51//! use gitlab::api::projects;
52//! use ironflow_core::operation::{OperationContext, NoopSecretResolver};
53//! use std::sync::Arc;
54//!
55//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
56//! let ctx = OperationContext::new(Arc::new(NoopSecretResolver));
57//! let gitlab = GitLab::from_context(&ctx).await?;
58//!
59//! let endpoint = projects::Project::builder().project(42).build()?;
60//! let op = gitlab.op(endpoint);
61//! // op implements Operation -- pass it to ctx.operation("get-project", &op)
62//! # Ok(())
63//! # }
64//! ```
65
66mod client;
67mod operation;
68
69pub use client::GitLab;
70pub use gitlab;
71pub use operation::GitLabOp;