objectiveai_api/functions/function_fetcher/fetcher.rs
1//! Trait for fetching Function definitions.
2
3use crate::ctx;
4
5/// Fetches Function definitions from GitHub repositories.
6///
7/// Functions are stored as `function.json` at repository root and referenced
8/// by owner/repository (optionally with commit SHA).
9#[async_trait::async_trait]
10pub trait Fetcher<CTXEXT> {
11 /// Fetches a Function by owner/repository/commit.
12 ///
13 /// Returns None if the Function is not found.
14 async fn fetch(
15 &self,
16 ctx: ctx::Context<CTXEXT>,
17 owner: &str,
18 repository: &str,
19 commit: Option<&str>,
20 ) -> Result<
21 Option<objectiveai::functions::response::GetFunction>,
22 objectiveai::error::ResponseError,
23 >;
24}