/*
* Antimatter Public API
*
* Interact with the Antimatter Cloud API
*
* The version of the OpenAPI document: 2.0.13
* Contact: support@antimatter.io
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WriteContextConfigInfoRequiredHooksInner {
/// An identifier for a hook
#[serde(rename = "hook")]
pub hook: String,
/// A pattern for expressing hook version requirements. Note that this is used for expressing two things. The first is which major version of the hook to run on new data. Here, if the version starts with > or no special character, the newest version of the hook is used. If it starts with ~, then the major version is respected, but the newest minor and patch version available on the server will be used. The second function of this pattern is to express a minimum version for read contexts such that if the capsule does not have hook data meeting the requirement, the hook data will be generated just in time. For this, you may express ~1.2.3 to say \"if the hook data is older than 1.2.3, generate it with 1.x.x\" or you may say >1.2.3 to say \"if the hook data is older than 1.2.3, generate it with the newest version\" (which could be 2.x.x).
#[serde(rename = "constraint")]
pub constraint: String,
/// how should this hook be invoked
#[serde(rename = "mode")]
pub mode: Mode,
}
impl WriteContextConfigInfoRequiredHooksInner {
pub fn new(hook: String, constraint: String, mode: Mode) -> WriteContextConfigInfoRequiredHooksInner {
WriteContextConfigInfoRequiredHooksInner {
hook,
constraint,
mode,
}
}
}
/// how should this hook be invoked
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Mode {
#[serde(rename = "sync")]
Sync,
#[serde(rename = "async")]
Async,
}
impl Default for Mode {
fn default() -> Mode {
Self::Sync
}
}