vapi_client/models/
regex_replacement.rs

1/*
2 * Vapi API
3 *
4 * API for building voice assistants
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct RegexReplacement {
17    /// This is the regex replacement type. You can use this to replace a word or phrase that matches a pattern.  Usage: - Replace all numbers with \"some number\": { type: 'regex', regex: '\\\\d+', value: 'some number' } - Replace email addresses with \"[EMAIL]\": { type: 'regex', regex: '\\\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Z|a-z]{2,}\\\\b', value: '[EMAIL]' } - Replace phone numbers with a formatted version: { type: 'regex', regex: '(\\\\d{3})(\\\\d{3})(\\\\d{4})', value: '($1) $2-$3' } - Replace all instances of \"color\" or \"colour\" with \"hue\": { type: 'regex', regex: 'colou?r', value: 'hue' } - Capitalize the first letter of every sentence: { type: 'regex', regex: '(?<=\\\\. |^)[a-z]', value: (match) => match.toUpperCase() }
18    #[serde(rename = "type")]
19    pub r#type: Type,
20    /// This is the regex pattern to replace.  Note: - This works by using the `string.replace` method in Node.JS. Eg. `\"hello there\".replace(/hello/g, \"hi\")` will return `\"hi there\"`.  Hot tip: - In JavaScript, escape `\\` when sending the regex pattern. Eg. `\"hello\\sthere\"` will be sent over the wire as `\"hellosthere\"`. Send `\"hello\\\\sthere\"` instead.
21    #[serde(rename = "regex")]
22    pub regex: String,
23    /// These are the options for the regex replacement. Defaults to all disabled.  @default []
24    #[serde(rename = "options", skip_serializing_if = "Option::is_none")]
25    pub options: Option<Vec<models::RegexOption>>,
26    /// This is the value that will replace the match.
27    #[serde(rename = "value")]
28    pub value: String,
29}
30
31impl RegexReplacement {
32    pub fn new(r#type: Type, regex: String, value: String) -> RegexReplacement {
33        RegexReplacement {
34            r#type,
35            regex,
36            options: None,
37            value,
38        }
39    }
40}
41/// This is the regex replacement type. You can use this to replace a word or phrase that matches a pattern.  Usage: - Replace all numbers with \"some number\": { type: 'regex', regex: '\\\\d+', value: 'some number' } - Replace email addresses with \"[EMAIL]\": { type: 'regex', regex: '\\\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Z|a-z]{2,}\\\\b', value: '[EMAIL]' } - Replace phone numbers with a formatted version: { type: 'regex', regex: '(\\\\d{3})(\\\\d{3})(\\\\d{4})', value: '($1) $2-$3' } - Replace all instances of \"color\" or \"colour\" with \"hue\": { type: 'regex', regex: 'colou?r', value: 'hue' } - Capitalize the first letter of every sentence: { type: 'regex', regex: '(?<=\\\\. |^)[a-z]', value: (match) => match.toUpperCase() }
42#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
43pub enum Type {
44    #[serde(rename = "regex")]
45    Regex,
46}
47
48impl Default for Type {
49    fn default() -> Type {
50        Self::Regex
51    }
52}