openai_core/resources/
videos.rs1use http::Method;
4
5use crate::generated::endpoints;
6
7use super::{
8 BytesRequestBuilder, DeleteResponse, JsonRequestBuilder, ListRequestBuilder, Video,
9 VideoCharacter, VideosResource, encode_path_segment,
10};
11
12impl VideosResource {
13 pub fn create(&self) -> JsonRequestBuilder<Video> {
15 let endpoint = endpoints::videos::VIDEOS_CREATE;
16 JsonRequestBuilder::new(
17 self.client.clone(),
18 endpoint.id,
19 Method::POST,
20 endpoint.template,
21 )
22 }
23
24 pub fn retrieve(&self, video_id: impl Into<String>) -> JsonRequestBuilder<Video> {
26 let video_id = encode_path_segment(video_id.into());
27 let endpoint = endpoints::videos::VIDEOS_RETRIEVE;
28 JsonRequestBuilder::new(
29 self.client.clone(),
30 endpoint.id,
31 Method::GET,
32 endpoint.render(&[("video_id", &video_id)]),
33 )
34 }
35
36 pub fn list(&self) -> ListRequestBuilder<Video> {
38 let endpoint = endpoints::videos::VIDEOS_LIST;
39 ListRequestBuilder::new(self.client.clone(), endpoint.id, endpoint.template)
40 }
41
42 pub fn delete(&self, video_id: impl Into<String>) -> JsonRequestBuilder<DeleteResponse> {
44 let video_id = encode_path_segment(video_id.into());
45 let endpoint = endpoints::videos::VIDEOS_DELETE;
46 JsonRequestBuilder::new(
47 self.client.clone(),
48 endpoint.id,
49 Method::DELETE,
50 endpoint.render(&[("video_id", &video_id)]),
51 )
52 }
53
54 pub fn edit(&self) -> JsonRequestBuilder<Video> {
56 let endpoint = endpoints::videos::VIDEOS_EDIT;
57 JsonRequestBuilder::new(
58 self.client.clone(),
59 endpoint.id,
60 Method::POST,
61 endpoint.template,
62 )
63 }
64
65 pub fn extend(&self) -> JsonRequestBuilder<Video> {
67 let endpoint = endpoints::videos::VIDEOS_EXTEND;
68 JsonRequestBuilder::new(
69 self.client.clone(),
70 endpoint.id,
71 Method::POST,
72 endpoint.template,
73 )
74 }
75
76 pub fn create_character(&self) -> JsonRequestBuilder<VideoCharacter> {
78 let endpoint = endpoints::videos::VIDEOS_CREATE_CHARACTER;
79 JsonRequestBuilder::new(
80 self.client.clone(),
81 endpoint.id,
82 Method::POST,
83 endpoint.template,
84 )
85 }
86
87 pub fn get_character(
89 &self,
90 character_id: impl Into<String>,
91 ) -> JsonRequestBuilder<VideoCharacter> {
92 let character_id = encode_path_segment(character_id.into());
93 let endpoint = endpoints::videos::VIDEOS_GET_CHARACTER;
94 JsonRequestBuilder::new(
95 self.client.clone(),
96 endpoint.id,
97 Method::GET,
98 endpoint.render(&[("character_id", &character_id)]),
99 )
100 }
101
102 pub fn download_content(&self, video_id: impl Into<String>) -> BytesRequestBuilder {
104 let video_id = encode_path_segment(video_id.into());
105 let endpoint = endpoints::videos::VIDEOS_DOWNLOAD_CONTENT;
106 BytesRequestBuilder::new(
107 self.client.clone(),
108 endpoint.id,
109 Method::GET,
110 endpoint.render(&[("video_id", &video_id)]),
111 )
112 }
113
114 pub fn remix(&self, video_id: impl Into<String>) -> JsonRequestBuilder<Video> {
116 let video_id = encode_path_segment(video_id.into());
117 let endpoint = endpoints::videos::VIDEOS_REMIX;
118 JsonRequestBuilder::new(
119 self.client.clone(),
120 endpoint.id,
121 Method::POST,
122 endpoint.render(&[("video_id", &video_id)]),
123 )
124 }
125}