pub struct HookContext {Show 22 fields
pub hook_name: String,
pub key_name: String,
pub operation_id: String,
pub http_method: String,
pub path: String,
pub path_params: Vec<Parameter>,
pub query_params: Vec<Parameter>,
pub body_type: Option<String>,
pub response_type: String,
pub module_name: String,
pub spec_name: Option<String>,
pub api_import_path: String,
pub query_keys_import_path: String,
pub param_list: String,
pub param_names: String,
pub path_param_names: String,
pub schema_imports: String,
pub description: String,
pub success_map_type: String,
pub error_map_type: String,
pub generic_result_type: String,
pub import_runtime_path: String,
}Expand description
Context for hook generation.
Fields§
§hook_name: String§key_name: String§operation_id: String§http_method: String§path: String§path_params: Vec<Parameter>§query_params: Vec<Parameter>§body_type: Option<String>§response_type: String§module_name: String§spec_name: Option<String>§api_import_path: String§query_keys_import_path: String§param_list: String§param_names: String§path_param_names: String§schema_imports: String§description: String§success_map_type: String§error_map_type: String§generic_result_type: String§import_runtime_path: StringImplementations§
Source§impl HookContext
impl HookContext
Sourcepub fn calculate_api_import_path(
module_name: &str,
_spec_name: Option<&str>,
apis_dir: Option<&str>,
) -> String
pub fn calculate_api_import_path( module_name: &str, _spec_name: Option<&str>, apis_dir: Option<&str>, ) -> String
Calculate import path to API functions. From: src/hooks/{module}/useX.ts To: {apis_dir}/{module}/index.ts Note: apis_dir doesn’t include spec_name (it’s in config if needed), just like schemas
Sourcepub fn find_common_prefix(path1: &str, path2: &str) -> String
pub fn find_common_prefix(path1: &str, path2: &str) -> String
Find the common prefix of two paths
Sourcepub fn calculate_query_keys_import_path(
module_name: &str,
_spec_name: Option<&str>,
hooks_dir: Option<&str>,
query_keys_dir: Option<&str>,
) -> String
pub fn calculate_query_keys_import_path( module_name: &str, _spec_name: Option<&str>, hooks_dir: Option<&str>, query_keys_dir: Option<&str>, ) -> String
Calculate import path to query keys. From: {hooks_dir}/{module}/useX.ts To: {query_keys_dir}/{module}.ts Note: output_dir already includes spec_name if needed (from config), just like schemas/apis
Trait Implementations§
Source§impl Clone for HookContext
impl Clone for HookContext
Source§fn clone(&self) -> HookContext
fn clone(&self) -> HookContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HookContext
impl Debug for HookContext
Auto Trait Implementations§
impl Freeze for HookContext
impl RefUnwindSafe for HookContext
impl Send for HookContext
impl Sync for HookContext
impl Unpin for HookContext
impl UnwindSafe for HookContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more