cnb 0.2.1

CNB (cnb.cool) API client for Rust — typed, async, production-ready
Documentation
// @generated DO NOT EDIT.
//
// Generated from the CNB OpenAPI specification by `cnb-codegen`.
// Run `cargo run -p cnb-codegen --manifest-path codegen/Cargo.toml \
//      -- --spec codegen/spec/swagger.json --out src` to refresh.

#![allow(clippy::all)]
#![allow(missing_docs)]
#![allow(unused_imports)]
#![allow(unused_mut)]

use reqwest::Method;
use serde::Serialize;

use crate::error::{ApiError, Result};
use crate::http::HttpInner;
use crate::models;

// `Event` resource client (generated, 1 operations).

/// Resource client.
#[derive(Debug, Clone)]
pub struct EventClient {
    inner: HttpInner,
}

impl EventClient {
    /// Construct a new resource client. Normally obtained
    /// via [`crate::ApiClient`] rather than directly.
    pub fn new(inner: HttpInner) -> Self {
        Self { inner }
    }

    /// 获取仓库动态预签名地址,并返回内容。Get events pre-signed URL and return content.
    ///
    /// `GET /events/{repo}/-/{date}`
    pub async fn get_events(&self, repo: String, date: String) -> Result<serde_json::Value> {
        let path = format!("/events/{}/-/{}", repo, date);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<serde_json::Value>(Method::GET, url)
            .await
    }
}