Skip to main content

Crate ironflow_ops_gitlab

Crate ironflow_ops_gitlab 

Source
Expand description

GitLab integration for Ironflow workflows.

This crate provides a thin integration layer between the gitlab crate and Ironflow’s workflow engine. It re-exports the full gitlab API so that workflow handlers get typed, builder-based access to every GitLab endpoint without managing authentication or HTTP clients manually.

§Quick start

use ironflow_ops_gitlab::GitLab;
use ironflow_core::operation::{OperationContext, NoopSecretResolver};
use std::sync::Arc;

let ctx = OperationContext::new(Arc::new(NoopSecretResolver));
let gitlab = GitLab::from_context(&ctx).await?;

§Typed queries

Use the re-exported gitlab::api builders and gitlab::api::AsyncQuery to call any endpoint with a typed response:

use ironflow_ops_gitlab::GitLab;
use gitlab::api::{projects, AsyncQuery};
use ironflow_core::operation::{OperationContext, NoopSecretResolver};
use std::sync::Arc;

let ctx = OperationContext::new(Arc::new(NoopSecretResolver));
let gitlab = GitLab::from_context(&ctx).await?;

let endpoint = projects::Project::builder().project(42).build()?;
let project: serde_json::Value = endpoint.query_async(gitlab.client()).await?;

§Tracked operations

Wrap any endpoint in GitLabOp to execute it as a tracked workflow step via WorkflowContext::operation():

use ironflow_ops_gitlab::GitLab;
use gitlab::api::projects;
use ironflow_core::operation::{OperationContext, NoopSecretResolver};
use std::sync::Arc;

let ctx = OperationContext::new(Arc::new(NoopSecretResolver));
let gitlab = GitLab::from_context(&ctx).await?;

let endpoint = projects::Project::builder().project(42).build()?;
let op = gitlab.op(endpoint);
// op implements Operation -- pass it to ctx.operation("get-project", &op)

§Missing endpoints

Some GitLab REST routes are not implemented by the gitlab crate. This crate fills those gaps under endpoints, wired the same way as any other endpoint:

use ironflow_ops_gitlab::GitLab;
use ironflow_ops_gitlab::endpoints::merge_requests::CreateMergeRequestDiscussionNote;
use gitlab::api::common::NameOrId;
use ironflow_core::operation::{OperationContext, NoopSecretResolver};
use std::sync::Arc;

let ctx = OperationContext::new(Arc::new(NoopSecretResolver));
let gitlab = GitLab::from_context(&ctx).await?;

let endpoint = CreateMergeRequestDiscussionNote {
    project: NameOrId::from(42),
    merge_request: 7,
    discussion_id: "abcd1234".to_string(),
    body: "Looks good, thanks!".to_string(),
};
let op = gitlab.op(endpoint);

§Paginated operations

Use GitLab::paged_op to drive a pageable “list …” endpoint across every page and get back a single JSON array concatenating every page’s results:

use ironflow_ops_gitlab::GitLab;
use gitlab::api::projects::merge_requests::MergeRequests;
use gitlab::api::Pagination;
use ironflow_core::operation::{OperationContext, NoopSecretResolver};
use std::sync::Arc;

let ctx = OperationContext::new(Arc::new(NoopSecretResolver));
let gitlab = GitLab::from_context(&ctx).await?;

let endpoint = MergeRequests::builder().project(42).build()?;
let op = gitlab.paged_op(endpoint, Pagination::All);
// op.execute(..) returns a Value::Array concatenating every page

Re-exports§

pub use gitlab;

Modules§

endpoints
Hand-written Endpoint implementations for GitLab API v4 routes that are missing from the gitlab crate.

Structs§

GitLab
A GitLab client that resolves credentials from the workflow’s secret store.
GitLabOp
A GitLab endpoint wrapped as an Ironflow Operation.
GitLabPagedOp
A paginated GitLab endpoint wrapped as an Ironflow Operation.