Skip to main content

outfox_openai/spec/chatkit/
api.rs

1use derive_builder::Builder;
2use serde::{Deserialize, Serialize};
3
4use crate::error::OpenAIError;
5
6/// Sort order for listing ChatKit threads.
7#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
8#[serde(rename_all = "lowercase")]
9pub enum ListChatKitThreadsOrder {
10    /// Ascending order
11    Asc,
12    /// Descending order
13    Desc,
14}
15
16/// Query parameters for listing ChatKit threads.
17#[derive(Debug, Serialize, Default, Clone, Builder, PartialEq)]
18#[builder(name = "ListChatKitThreadsQueryArgs")]
19#[builder(pattern = "mutable")]
20#[builder(setter(into, strip_option), default)]
21#[builder(derive(Debug))]
22#[builder(build_fn(error = "OpenAIError"))]
23pub struct ListChatKitThreadsQuery {
24    /// Maximum number of thread items to return. Defaults to 20.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub limit: Option<u32>,
27    /// Sort order for results by creation time. Defaults to `desc`.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub order: Option<ListChatKitThreadsOrder>,
30    /// List items created after this thread item ID. Defaults to null for the first page.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub after: Option<String>,
33    /// List items created before this thread item ID. Defaults to null for the newest results.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub before: Option<String>,
36    /// Filter threads that belong to this user identifier. Defaults to null to return all users.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub user: Option<String>,
39}
40
41/// Sort order for listing ChatKit thread items.
42#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
43#[serde(rename_all = "lowercase")]
44pub enum ListChatKitThreadItemsOrder {
45    /// Ascending order
46    Asc,
47    /// Descending order
48    Desc,
49}
50
51/// Query parameters for listing ChatKit thread items.
52#[derive(Debug, Serialize, Default, Clone, Builder, PartialEq)]
53#[builder(name = "ListChatKitThreadItemsQueryArgs")]
54#[builder(pattern = "mutable")]
55#[builder(setter(into, strip_option), default)]
56#[builder(derive(Debug))]
57#[builder(build_fn(error = "OpenAIError"))]
58pub struct ListChatKitThreadItemsQuery {
59    /// Maximum number of thread items to return. Defaults to 20.
60    #[serde(skip_serializing_if = "Option::is_none")]
61    pub limit: Option<u32>,
62    /// Sort order for results by creation time. Defaults to `desc`.
63    #[serde(skip_serializing_if = "Option::is_none")]
64    pub order: Option<ListChatKitThreadItemsOrder>,
65    /// List items created after this thread item ID. Defaults to null for the first page.
66    #[serde(skip_serializing_if = "Option::is_none")]
67    pub after: Option<String>,
68    /// List items created before this thread item ID. Defaults to null for the newest results.
69    #[serde(skip_serializing_if = "Option::is_none")]
70    pub before: Option<String>,
71}