1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* OpenAI API
*
* The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
*
* The version of the OpenAPI document: 2.3.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// WebSearchLocation : Approximate location parameters for the search.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct WebSearchLocation {
/// The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.
#[serde(rename = "country", skip_serializing_if = "Option::is_none")]
pub country: Option<String>,
/// Free text input for the region of the user, e.g. `California`.
#[serde(rename = "region", skip_serializing_if = "Option::is_none")]
pub region: Option<String>,
/// Free text input for the city of the user, e.g. `San Francisco`.
#[serde(rename = "city", skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
/// The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.
#[serde(rename = "timezone", skip_serializing_if = "Option::is_none")]
pub timezone: Option<String>,
}
impl WebSearchLocation {
/// Approximate location parameters for the search.
pub fn new() -> WebSearchLocation {
WebSearchLocation {
country: None,
region: None,
city: None,
timezone: None,
}
}
}
impl std::fmt::Display for WebSearchLocation {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match serde_json::to_string(self) {
Ok(s) => write!(f, "{}", s),
Err(_) => Err(std::fmt::Error),
}
}
}