Skip to main content

httpgenerator_cli/
observer.rs

1use std::path::PathBuf;
2
3use httpgenerator_core::openapi::OpenApiInspection;
4
5pub trait ExecutionObserver {
6    fn validation_started(&mut self) {}
7
8    fn validation_succeeded(&mut self, _inspection: &OpenApiInspection) {}
9
10    fn azure_auth_started(&mut self) {}
11
12    fn azure_auth_finished(&mut self, _status: &AzureAuthStatus) {}
13
14    fn file_writing_started(&mut self, _file_count: usize) {}
15
16    fn files_written(&mut self, _paths: &[PathBuf]) {}
17}
18
19#[derive(Default)]
20pub(crate) struct NoopExecutionObserver;
21
22impl ExecutionObserver for NoopExecutionObserver {}
23
24#[derive(Debug, Clone, PartialEq, Eq)]
25pub struct ExecutionSummary {
26    pub output_folder: PathBuf,
27    pub files: Vec<PathBuf>,
28    pub validation: Option<OpenApiInspection>,
29    pub azure_auth: AzureAuthStatus,
30}
31
32#[derive(Debug, Clone, PartialEq, Eq)]
33pub enum AzureAuthStatus {
34    NotRequested,
35    Acquired,
36    Failed { reason: String },
37}