1#[doc = "Returns a list of assistants."]
2pub fn list_assistants<C, Fut, B, E>(
3 client: C,
4 params: &crate::__types::ListAssistantsParams,
5) -> ListAssistants<Fut, B, E>
6where
7 C: FnOnce(http::Request<String>) -> Fut,
8 Fut: Future<Output = Result<http::Response<B>, E>>,
9 B: http_body::Body,
10{
11 ListAssistants(futures::TryFutureExt::and_then(
12 crate::__combinators::Send::new(
13 client,
14 || {
15 let path = {
16 #[serde_with::serde_as]
17 #[derive(serde :: Serialize)]
18 struct Query<'a> {
19 #[serde(rename = "limit")]
20 #[serde(skip_serializing_if = "Option::is_none")]
21 limit: &'a Option<i64>,
22 #[serde(rename = "order")]
23 #[serde(skip_serializing_if = "Option::is_none")]
24 order: &'a Option<crate::__types::ListAssistantsParamsOrder>,
25 #[serde(rename = "after")]
26 #[serde(skip_serializing_if = "Option::is_none")]
27 after: &'a Option<String>,
28 #[serde(rename = "before")]
29 #[serde(skip_serializing_if = "Option::is_none")]
30 before: &'a Option<String>,
31 #[serde(skip_serializing)]
32 _phantom: std::marker::PhantomData<&'a ()>,
33 }
34 #[allow(clippy::useless_format)]
35 let mut path = format!("/assistants",);
36 let crate::__types::ListAssistantsParams {
37 limit,
38 order,
39 after,
40 before,
41 ..
42 } = params;
43 let query = serde_urlencoded::to_string(Query {
44 limit,
45 order,
46 after,
47 before,
48 _phantom: std::marker::PhantomData,
49 })?;
50 if !query.is_empty() {
51 path.push('?');
52 path.push_str(&query);
53 }
54 path
55 };
56 let body = String::new();
57 Ok(http::Request::builder()
58 .method(http::Method::GET)
59 .uri(path)
60 .header(http::header::CONTENT_LENGTH, body.len())
61 .body(body)?)
62 },
63 (
64 http::StatusCode::from_u16(200u16).unwrap(),
65 Some(mime::APPLICATION_JSON),
66 ),
67 ),
68 crate::__combinators::Json::new,
69 ))
70}
71future!(
72 ListAssistants,
73 futures::future::AndThen<
74 crate::__combinators::Send<Fut, B, E>,
75 crate::__combinators::Json<B, E, crate::__types::ListAssistantsResponse>,
76 fn(
77 http::Response<B>,
78 ) -> crate::__combinators::Json<B, E, crate::__types::ListAssistantsResponse>,
79 >,
80 crate::__types::ListAssistantsResponse
81);
82#[doc = "Create an assistant with a model and instructions."]
83pub fn create_assistant<C, Fut, B, E>(
84 client: C,
85 request: &crate::__types::CreateAssistantRequest,
86) -> CreateAssistant<Fut, B, E>
87where
88 C: FnOnce(http::Request<String>) -> Fut,
89 Fut: Future<Output = Result<http::Response<B>, E>>,
90 B: http_body::Body,
91{
92 CreateAssistant(futures::TryFutureExt::and_then(
93 crate::__combinators::Send::new(
94 client,
95 || {
96 let path = "/assistants";
97 let body = serde_json::to_string(request)?;
98 Ok(http::Request::builder()
99 .method(http::Method::POST)
100 .uri(path)
101 .header(http::header::CONTENT_LENGTH, body.len())
102 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
103 .body(body)?)
104 },
105 (
106 http::StatusCode::from_u16(200u16).unwrap(),
107 Some(mime::APPLICATION_JSON),
108 ),
109 ),
110 crate::__combinators::Json::new,
111 ))
112}
113future!(
114 CreateAssistant,
115 futures::future::AndThen<
116 crate::__combinators::Send<Fut, B, E>,
117 crate::__combinators::Json<B, E, crate::__types::AssistantObject>,
118 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::AssistantObject>,
119 >,
120 crate::__types::AssistantObject
121);
122#[doc = "Retrieves an assistant."]
123pub fn get_assistant<C, Fut, B, E>(
124 client: C,
125 params: &crate::__types::GetAssistantParams,
126) -> GetAssistant<Fut, B, E>
127where
128 C: FnOnce(http::Request<String>) -> Fut,
129 Fut: Future<Output = Result<http::Response<B>, E>>,
130 B: http_body::Body,
131{
132 GetAssistant(futures::TryFutureExt::and_then(
133 crate::__combinators::Send::new(
134 client,
135 || {
136 let path = {
137 #[serde_with::serde_as]
138 #[derive(serde :: Serialize)]
139 struct Query<'a> {
140 #[serde(skip_serializing)]
141 _phantom: std::marker::PhantomData<&'a ()>,
142 }
143 #[allow(clippy::useless_format)]
144 let mut path = format!(
145 "/assistants/{assistant_id}",
146 assistant_id = params.assistant_id
147 );
148 let crate::__types::GetAssistantParams { .. } = params;
149 let query = serde_urlencoded::to_string(Query {
150 _phantom: std::marker::PhantomData,
151 })?;
152 if !query.is_empty() {
153 path.push('?');
154 path.push_str(&query);
155 }
156 path
157 };
158 let body = String::new();
159 Ok(http::Request::builder()
160 .method(http::Method::GET)
161 .uri(path)
162 .header(http::header::CONTENT_LENGTH, body.len())
163 .body(body)?)
164 },
165 (
166 http::StatusCode::from_u16(200u16).unwrap(),
167 Some(mime::APPLICATION_JSON),
168 ),
169 ),
170 crate::__combinators::Json::new,
171 ))
172}
173future!(
174 GetAssistant,
175 futures::future::AndThen<
176 crate::__combinators::Send<Fut, B, E>,
177 crate::__combinators::Json<B, E, crate::__types::AssistantObject>,
178 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::AssistantObject>,
179 >,
180 crate::__types::AssistantObject
181);
182#[doc = "Modifies an assistant."]
183pub fn modify_assistant<C, Fut, B, E>(
184 client: C,
185 params: &crate::__types::ModifyAssistantParams,
186 request: &crate::__types::ModifyAssistantRequest,
187) -> ModifyAssistant<Fut, B, E>
188where
189 C: FnOnce(http::Request<String>) -> Fut,
190 Fut: Future<Output = Result<http::Response<B>, E>>,
191 B: http_body::Body,
192{
193 ModifyAssistant(futures::TryFutureExt::and_then(
194 crate::__combinators::Send::new(
195 client,
196 || {
197 let path = {
198 #[serde_with::serde_as]
199 #[derive(serde :: Serialize)]
200 struct Query<'a> {
201 #[serde(skip_serializing)]
202 _phantom: std::marker::PhantomData<&'a ()>,
203 }
204 #[allow(clippy::useless_format)]
205 let mut path = format!(
206 "/assistants/{assistant_id}",
207 assistant_id = params.assistant_id
208 );
209 let crate::__types::ModifyAssistantParams { .. } = params;
210 let query = serde_urlencoded::to_string(Query {
211 _phantom: std::marker::PhantomData,
212 })?;
213 if !query.is_empty() {
214 path.push('?');
215 path.push_str(&query);
216 }
217 path
218 };
219 let body = serde_json::to_string(request)?;
220 Ok(http::Request::builder()
221 .method(http::Method::POST)
222 .uri(path)
223 .header(http::header::CONTENT_LENGTH, body.len())
224 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
225 .body(body)?)
226 },
227 (
228 http::StatusCode::from_u16(200u16).unwrap(),
229 Some(mime::APPLICATION_JSON),
230 ),
231 ),
232 crate::__combinators::Json::new,
233 ))
234}
235future!(
236 ModifyAssistant,
237 futures::future::AndThen<
238 crate::__combinators::Send<Fut, B, E>,
239 crate::__combinators::Json<B, E, crate::__types::AssistantObject>,
240 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::AssistantObject>,
241 >,
242 crate::__types::AssistantObject
243);
244#[doc = "Delete an assistant."]
245pub fn delete_assistant<C, Fut, B, E>(
246 client: C,
247 params: &crate::__types::DeleteAssistantParams,
248) -> DeleteAssistant<Fut, B, E>
249where
250 C: FnOnce(http::Request<String>) -> Fut,
251 Fut: Future<Output = Result<http::Response<B>, E>>,
252 B: http_body::Body,
253{
254 DeleteAssistant(futures::TryFutureExt::and_then(
255 crate::__combinators::Send::new(
256 client,
257 || {
258 let path = {
259 #[serde_with::serde_as]
260 #[derive(serde :: Serialize)]
261 struct Query<'a> {
262 #[serde(skip_serializing)]
263 _phantom: std::marker::PhantomData<&'a ()>,
264 }
265 #[allow(clippy::useless_format)]
266 let mut path = format!(
267 "/assistants/{assistant_id}",
268 assistant_id = params.assistant_id
269 );
270 let crate::__types::DeleteAssistantParams { .. } = params;
271 let query = serde_urlencoded::to_string(Query {
272 _phantom: std::marker::PhantomData,
273 })?;
274 if !query.is_empty() {
275 path.push('?');
276 path.push_str(&query);
277 }
278 path
279 };
280 let body = String::new();
281 Ok(http::Request::builder()
282 .method(http::Method::DELETE)
283 .uri(path)
284 .header(http::header::CONTENT_LENGTH, body.len())
285 .body(body)?)
286 },
287 (
288 http::StatusCode::from_u16(200u16).unwrap(),
289 Some(mime::APPLICATION_JSON),
290 ),
291 ),
292 crate::__combinators::Json::new,
293 ))
294}
295future!(
296 DeleteAssistant,
297 futures::future::AndThen<
298 crate::__combinators::Send<Fut, B, E>,
299 crate::__combinators::Json<B, E, crate::__types::DeleteAssistantResponse>,
300 fn(
301 http::Response<B>,
302 ) -> crate::__combinators::Json<B, E, crate::__types::DeleteAssistantResponse>,
303 >,
304 crate::__types::DeleteAssistantResponse
305);
306#[doc = "Generates audio from the input text."]
307pub fn create_speech_stream<C, Fut, B, E>(
308 client: C,
309 request: &crate::__types::CreateSpeechRequest,
310) -> CreateSpeechStream<Fut, B, E>
311where
312 C: FnOnce(http::Request<String>) -> Fut,
313 Fut: Future<Output = Result<http::Response<B>, E>>,
314 B: http_body::Body,
315{
316 CreateSpeechStream(futures::TryFutureExt::map_ok(
317 crate::__combinators::Send::new(
318 client,
319 || {
320 let path = "/audio/speech";
321 let body = serde_json::to_string(request)?;
322 Ok(http::Request::builder()
323 .method(http::Method::POST)
324 .uri(path)
325 .header(http::header::CONTENT_LENGTH, body.len())
326 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
327 .body(body)?)
328 },
329 (
330 http::StatusCode::from_u16(200u16).unwrap(),
331 Some(mime::TEXT_EVENT_STREAM),
332 ),
333 ),
334 crate::__combinators::EventStream::new,
335 ))
336}
337future ! (CreateSpeechStream , futures :: future :: MapOk < crate :: __combinators :: Send < Fut , B , E > , fn (http :: Response < B >) -> crate :: __combinators :: EventStream < B , crate :: __types :: CreateSpeechResponseStreamEvent > , > , crate :: __combinators :: EventStream < B , crate :: __types :: CreateSpeechResponseStreamEvent >);
338#[doc = "Creates and executes a batch from an uploaded file of requests"]
339pub fn create_batch<C, Fut, B, E>(
340 client: C,
341 request: &crate::__types::CreateBatchRequest,
342) -> CreateBatch<Fut, B, E>
343where
344 C: FnOnce(http::Request<String>) -> Fut,
345 Fut: Future<Output = Result<http::Response<B>, E>>,
346 B: http_body::Body,
347{
348 CreateBatch(futures::TryFutureExt::and_then(
349 crate::__combinators::Send::new(
350 client,
351 || {
352 let path = "/batches";
353 let body = serde_json::to_string(request)?;
354 Ok(http::Request::builder()
355 .method(http::Method::POST)
356 .uri(path)
357 .header(http::header::CONTENT_LENGTH, body.len())
358 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
359 .body(body)?)
360 },
361 (
362 http::StatusCode::from_u16(200u16).unwrap(),
363 Some(mime::APPLICATION_JSON),
364 ),
365 ),
366 crate::__combinators::Json::new,
367 ))
368}
369future!(
370 CreateBatch,
371 futures::future::AndThen<
372 crate::__combinators::Send<Fut, B, E>,
373 crate::__combinators::Json<B, E, crate::__types::Batch>,
374 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Batch>,
375 >,
376 crate::__types::Batch
377);
378#[doc = "List your organization's batches."]
379pub fn list_batches<C, Fut, B, E>(
380 client: C,
381 params: &crate::__types::ListBatchesParams,
382) -> ListBatches<Fut, B, E>
383where
384 C: FnOnce(http::Request<String>) -> Fut,
385 Fut: Future<Output = Result<http::Response<B>, E>>,
386 B: http_body::Body,
387{
388 ListBatches(futures::TryFutureExt::and_then(
389 crate::__combinators::Send::new(
390 client,
391 || {
392 let path = {
393 #[serde_with::serde_as]
394 #[derive(serde :: Serialize)]
395 struct Query<'a> {
396 #[serde(rename = "after")]
397 #[serde(skip_serializing_if = "Option::is_none")]
398 after: &'a Option<String>,
399 #[serde(rename = "limit")]
400 #[serde(skip_serializing_if = "Option::is_none")]
401 limit: &'a Option<i64>,
402 #[serde(skip_serializing)]
403 _phantom: std::marker::PhantomData<&'a ()>,
404 }
405 #[allow(clippy::useless_format)]
406 let mut path = format!("/batches",);
407 let crate::__types::ListBatchesParams { after, limit, .. } = params;
408 let query = serde_urlencoded::to_string(Query {
409 after,
410 limit,
411 _phantom: std::marker::PhantomData,
412 })?;
413 if !query.is_empty() {
414 path.push('?');
415 path.push_str(&query);
416 }
417 path
418 };
419 let body = String::new();
420 Ok(http::Request::builder()
421 .method(http::Method::GET)
422 .uri(path)
423 .header(http::header::CONTENT_LENGTH, body.len())
424 .body(body)?)
425 },
426 (
427 http::StatusCode::from_u16(200u16).unwrap(),
428 Some(mime::APPLICATION_JSON),
429 ),
430 ),
431 crate::__combinators::Json::new,
432 ))
433}
434future!(
435 ListBatches,
436 futures::future::AndThen<
437 crate::__combinators::Send<Fut, B, E>,
438 crate::__combinators::Json<B, E, crate::__types::ListBatchesResponse>,
439 fn(
440 http::Response<B>,
441 ) -> crate::__combinators::Json<B, E, crate::__types::ListBatchesResponse>,
442 >,
443 crate::__types::ListBatchesResponse
444);
445#[doc = "Retrieves a batch."]
446pub fn retrieve_batch<C, Fut, B, E>(
447 client: C,
448 params: &crate::__types::RetrieveBatchParams,
449) -> RetrieveBatch<Fut, B, E>
450where
451 C: FnOnce(http::Request<String>) -> Fut,
452 Fut: Future<Output = Result<http::Response<B>, E>>,
453 B: http_body::Body,
454{
455 RetrieveBatch(futures::TryFutureExt::and_then(
456 crate::__combinators::Send::new(
457 client,
458 || {
459 let path = {
460 #[serde_with::serde_as]
461 #[derive(serde :: Serialize)]
462 struct Query<'a> {
463 #[serde(skip_serializing)]
464 _phantom: std::marker::PhantomData<&'a ()>,
465 }
466 #[allow(clippy::useless_format)]
467 let mut path = format!("/batches/{batch_id}", batch_id = params.batch_id);
468 let crate::__types::RetrieveBatchParams { .. } = params;
469 let query = serde_urlencoded::to_string(Query {
470 _phantom: std::marker::PhantomData,
471 })?;
472 if !query.is_empty() {
473 path.push('?');
474 path.push_str(&query);
475 }
476 path
477 };
478 let body = String::new();
479 Ok(http::Request::builder()
480 .method(http::Method::GET)
481 .uri(path)
482 .header(http::header::CONTENT_LENGTH, body.len())
483 .body(body)?)
484 },
485 (
486 http::StatusCode::from_u16(200u16).unwrap(),
487 Some(mime::APPLICATION_JSON),
488 ),
489 ),
490 crate::__combinators::Json::new,
491 ))
492}
493future!(
494 RetrieveBatch,
495 futures::future::AndThen<
496 crate::__combinators::Send<Fut, B, E>,
497 crate::__combinators::Json<B, E, crate::__types::Batch>,
498 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Batch>,
499 >,
500 crate::__types::Batch
501);
502#[doc = "Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file."]
503pub fn cancel_batch<C, Fut, B, E>(
504 client: C,
505 params: &crate::__types::CancelBatchParams,
506) -> CancelBatch<Fut, B, E>
507where
508 C: FnOnce(http::Request<String>) -> Fut,
509 Fut: Future<Output = Result<http::Response<B>, E>>,
510 B: http_body::Body,
511{
512 CancelBatch(futures::TryFutureExt::and_then(
513 crate::__combinators::Send::new(
514 client,
515 || {
516 let path = {
517 #[serde_with::serde_as]
518 #[derive(serde :: Serialize)]
519 struct Query<'a> {
520 #[serde(skip_serializing)]
521 _phantom: std::marker::PhantomData<&'a ()>,
522 }
523 #[allow(clippy::useless_format)]
524 let mut path =
525 format!("/batches/{batch_id}/cancel", batch_id = params.batch_id);
526 let crate::__types::CancelBatchParams { .. } = params;
527 let query = serde_urlencoded::to_string(Query {
528 _phantom: std::marker::PhantomData,
529 })?;
530 if !query.is_empty() {
531 path.push('?');
532 path.push_str(&query);
533 }
534 path
535 };
536 let body = String::new();
537 Ok(http::Request::builder()
538 .method(http::Method::POST)
539 .uri(path)
540 .header(http::header::CONTENT_LENGTH, body.len())
541 .body(body)?)
542 },
543 (
544 http::StatusCode::from_u16(200u16).unwrap(),
545 Some(mime::APPLICATION_JSON),
546 ),
547 ),
548 crate::__combinators::Json::new,
549 ))
550}
551future!(
552 CancelBatch,
553 futures::future::AndThen<
554 crate::__combinators::Send<Fut, B, E>,
555 crate::__combinators::Json<B, E, crate::__types::Batch>,
556 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Batch>,
557 >,
558 crate::__types::Batch
559);
560#[doc = "List stored Chat Completions. Only Chat Completions that have been stored\nwith the `store` parameter set to `true` will be returned.\n"]
561pub fn list_chat_completions<C, Fut, B, E>(
562 client: C,
563 params: &crate::__types::ListChatCompletionsParams,
564) -> ListChatCompletions<Fut, B, E>
565where
566 C: FnOnce(http::Request<String>) -> Fut,
567 Fut: Future<Output = Result<http::Response<B>, E>>,
568 B: http_body::Body,
569{
570 ListChatCompletions(futures::TryFutureExt::and_then(
571 crate::__combinators::Send::new(
572 client,
573 || {
574 let path = {
575 #[serde_with::serde_as]
576 #[derive(serde :: Serialize)]
577 struct Query<'a> {
578 #[serde(rename = "model")]
579 #[serde(skip_serializing_if = "Option::is_none")]
580 model: &'a Option<String>,
581 #[serde(rename = "metadata")]
582 #[serde(skip_serializing_if = "Option::is_none")]
583 metadata: &'a Option<crate::__types::Metadata>,
584 #[serde(rename = "after")]
585 #[serde(skip_serializing_if = "Option::is_none")]
586 after: &'a Option<String>,
587 #[serde(rename = "limit")]
588 #[serde(skip_serializing_if = "Option::is_none")]
589 limit: &'a Option<i64>,
590 #[serde(rename = "order")]
591 #[serde(skip_serializing_if = "Option::is_none")]
592 order: &'a Option<crate::__types::ListChatCompletionsParamsOrder>,
593 #[serde(skip_serializing)]
594 _phantom: std::marker::PhantomData<&'a ()>,
595 }
596 #[allow(clippy::useless_format)]
597 let mut path = format!("/chat/completions",);
598 let crate::__types::ListChatCompletionsParams {
599 model,
600 metadata,
601 after,
602 limit,
603 order,
604 ..
605 } = params;
606 let query = serde_urlencoded::to_string(Query {
607 model,
608 metadata,
609 after,
610 limit,
611 order,
612 _phantom: std::marker::PhantomData,
613 })?;
614 if !query.is_empty() {
615 path.push('?');
616 path.push_str(&query);
617 }
618 path
619 };
620 let body = String::new();
621 Ok(http::Request::builder()
622 .method(http::Method::GET)
623 .uri(path)
624 .header(http::header::CONTENT_LENGTH, body.len())
625 .body(body)?)
626 },
627 (
628 http::StatusCode::from_u16(200u16).unwrap(),
629 Some(mime::APPLICATION_JSON),
630 ),
631 ),
632 crate::__combinators::Json::new,
633 ))
634}
635future!(
636 ListChatCompletions,
637 futures::future::AndThen<
638 crate::__combinators::Send<Fut, B, E>,
639 crate::__combinators::Json<B, E, crate::__types::ChatCompletionList>,
640 fn(
641 http::Response<B>,
642 ) -> crate::__combinators::Json<B, E, crate::__types::ChatCompletionList>,
643 >,
644 crate::__types::ChatCompletionList
645);
646#[doc = "**Starting a new project?** We recommend trying [Responses](https://platform.openai.com/docs/api-reference/responses) \nto take advantage of the latest OpenAI platform features. Compare\n[Chat Completions with Responses](https://platform.openai.com/docs/guides/responses-vs-chat-completions?api-mode=responses).\n\n---\n\nCreates a model response for the given chat conversation. Learn more in the\n[text generation](https://platform.openai.com/docs/guides/text-generation), [vision](https://platform.openai.com/docs/guides/vision),\nand [audio](https://platform.openai.com/docs/guides/audio) guides.\n\nParameter support can differ depending on the model used to generate the\nresponse, particularly for newer reasoning models. Parameters that are only\nsupported for reasoning models are noted below. For the current state of \nunsupported parameters in reasoning models, \n[refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning).\n"]
647pub fn create_chat_completion<C, Fut, B, E>(
648 client: C,
649 request: &crate::__types::CreateChatCompletionRequest,
650) -> CreateChatCompletion<Fut, B, E>
651where
652 C: FnOnce(http::Request<String>) -> Fut,
653 Fut: Future<Output = Result<http::Response<B>, E>>,
654 B: http_body::Body,
655{
656 CreateChatCompletion(futures::TryFutureExt::and_then(
657 crate::__combinators::Send::new(
658 client,
659 || {
660 let path = "/chat/completions";
661 let body = serde_json::to_string(request)?;
662 Ok(http::Request::builder()
663 .method(http::Method::POST)
664 .uri(path)
665 .header(http::header::CONTENT_LENGTH, body.len())
666 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
667 .body(body)?)
668 },
669 (
670 http::StatusCode::from_u16(200u16).unwrap(),
671 Some(mime::APPLICATION_JSON),
672 ),
673 ),
674 crate::__combinators::Json::new,
675 ))
676}
677future!(
678 CreateChatCompletion,
679 futures::future::AndThen<
680 crate::__combinators::Send<Fut, B, E>,
681 crate::__combinators::Json<B, E, crate::__types::CreateChatCompletionResponse>,
682 fn(
683 http::Response<B>,
684 )
685 -> crate::__combinators::Json<B, E, crate::__types::CreateChatCompletionResponse>,
686 >,
687 crate::__types::CreateChatCompletionResponse
688);
689#[doc = "**Starting a new project?** We recommend trying [Responses](https://platform.openai.com/docs/api-reference/responses) \nto take advantage of the latest OpenAI platform features. Compare\n[Chat Completions with Responses](https://platform.openai.com/docs/guides/responses-vs-chat-completions?api-mode=responses).\n\n---\n\nCreates a model response for the given chat conversation. Learn more in the\n[text generation](https://platform.openai.com/docs/guides/text-generation), [vision](https://platform.openai.com/docs/guides/vision),\nand [audio](https://platform.openai.com/docs/guides/audio) guides.\n\nParameter support can differ depending on the model used to generate the\nresponse, particularly for newer reasoning models. Parameters that are only\nsupported for reasoning models are noted below. For the current state of \nunsupported parameters in reasoning models, \n[refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning).\n"]
690pub fn create_chat_completion_stream<C, Fut, B, E>(
691 client: C,
692 request: &crate::__types::CreateChatCompletionRequest,
693) -> CreateChatCompletionStream<Fut, B, E>
694where
695 C: FnOnce(http::Request<String>) -> Fut,
696 Fut: Future<Output = Result<http::Response<B>, E>>,
697 B: http_body::Body,
698{
699 CreateChatCompletionStream(futures::TryFutureExt::map_ok(
700 crate::__combinators::Send::new(
701 client,
702 || {
703 let path = "/chat/completions";
704 let body = serde_json::to_string(request)?;
705 Ok(http::Request::builder()
706 .method(http::Method::POST)
707 .uri(path)
708 .header(http::header::CONTENT_LENGTH, body.len())
709 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
710 .body(body)?)
711 },
712 (
713 http::StatusCode::from_u16(200u16).unwrap(),
714 Some(mime::TEXT_EVENT_STREAM),
715 ),
716 ),
717 crate::__combinators::EventStream::new,
718 ))
719}
720future ! (CreateChatCompletionStream , futures :: future :: MapOk < crate :: __combinators :: Send < Fut , B , E > , fn (http :: Response < B >) -> crate :: __combinators :: EventStream < B , crate :: __types :: CreateChatCompletionStreamResponse > , > , crate :: __combinators :: EventStream < B , crate :: __types :: CreateChatCompletionStreamResponse >);
721#[doc = "Get a stored chat completion. Only Chat Completions that have been created\nwith the `store` parameter set to `true` will be returned.\n"]
722pub fn get_chat_completion<C, Fut, B, E>(
723 client: C,
724 params: &crate::__types::GetChatCompletionParams,
725) -> GetChatCompletion<Fut, B, E>
726where
727 C: FnOnce(http::Request<String>) -> Fut,
728 Fut: Future<Output = Result<http::Response<B>, E>>,
729 B: http_body::Body,
730{
731 GetChatCompletion(futures::TryFutureExt::and_then(
732 crate::__combinators::Send::new(
733 client,
734 || {
735 let path = {
736 #[serde_with::serde_as]
737 #[derive(serde :: Serialize)]
738 struct Query<'a> {
739 #[serde(skip_serializing)]
740 _phantom: std::marker::PhantomData<&'a ()>,
741 }
742 #[allow(clippy::useless_format)]
743 let mut path = format!(
744 "/chat/completions/{completion_id}",
745 completion_id = params.completion_id
746 );
747 let crate::__types::GetChatCompletionParams { .. } = params;
748 let query = serde_urlencoded::to_string(Query {
749 _phantom: std::marker::PhantomData,
750 })?;
751 if !query.is_empty() {
752 path.push('?');
753 path.push_str(&query);
754 }
755 path
756 };
757 let body = String::new();
758 Ok(http::Request::builder()
759 .method(http::Method::GET)
760 .uri(path)
761 .header(http::header::CONTENT_LENGTH, body.len())
762 .body(body)?)
763 },
764 (
765 http::StatusCode::from_u16(200u16).unwrap(),
766 Some(mime::APPLICATION_JSON),
767 ),
768 ),
769 crate::__combinators::Json::new,
770 ))
771}
772future!(
773 GetChatCompletion,
774 futures::future::AndThen<
775 crate::__combinators::Send<Fut, B, E>,
776 crate::__combinators::Json<B, E, crate::__types::CreateChatCompletionResponse>,
777 fn(
778 http::Response<B>,
779 )
780 -> crate::__combinators::Json<B, E, crate::__types::CreateChatCompletionResponse>,
781 >,
782 crate::__types::CreateChatCompletionResponse
783);
784#[doc = "Modify a stored chat completion. Only Chat Completions that have been\ncreated with the `store` parameter set to `true` can be modified. Currently,\nthe only supported modification is to update the `metadata` field.\n"]
785pub fn update_chat_completion<C, Fut, B, E>(
786 client: C,
787 params: &crate::__types::UpdateChatCompletionParams,
788 request: &crate::__types::UpdateChatCompletionRequest,
789) -> UpdateChatCompletion<Fut, B, E>
790where
791 C: FnOnce(http::Request<String>) -> Fut,
792 Fut: Future<Output = Result<http::Response<B>, E>>,
793 B: http_body::Body,
794{
795 UpdateChatCompletion(futures::TryFutureExt::and_then(
796 crate::__combinators::Send::new(
797 client,
798 || {
799 let path = {
800 #[serde_with::serde_as]
801 #[derive(serde :: Serialize)]
802 struct Query<'a> {
803 #[serde(skip_serializing)]
804 _phantom: std::marker::PhantomData<&'a ()>,
805 }
806 #[allow(clippy::useless_format)]
807 let mut path = format!(
808 "/chat/completions/{completion_id}",
809 completion_id = params.completion_id
810 );
811 let crate::__types::UpdateChatCompletionParams { .. } = params;
812 let query = serde_urlencoded::to_string(Query {
813 _phantom: std::marker::PhantomData,
814 })?;
815 if !query.is_empty() {
816 path.push('?');
817 path.push_str(&query);
818 }
819 path
820 };
821 let body = serde_json::to_string(request)?;
822 Ok(http::Request::builder()
823 .method(http::Method::POST)
824 .uri(path)
825 .header(http::header::CONTENT_LENGTH, body.len())
826 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
827 .body(body)?)
828 },
829 (
830 http::StatusCode::from_u16(200u16).unwrap(),
831 Some(mime::APPLICATION_JSON),
832 ),
833 ),
834 crate::__combinators::Json::new,
835 ))
836}
837future!(
838 UpdateChatCompletion,
839 futures::future::AndThen<
840 crate::__combinators::Send<Fut, B, E>,
841 crate::__combinators::Json<B, E, crate::__types::CreateChatCompletionResponse>,
842 fn(
843 http::Response<B>,
844 )
845 -> crate::__combinators::Json<B, E, crate::__types::CreateChatCompletionResponse>,
846 >,
847 crate::__types::CreateChatCompletionResponse
848);
849#[doc = "Delete a stored chat completion. Only Chat Completions that have been\ncreated with the `store` parameter set to `true` can be deleted.\n"]
850pub fn delete_chat_completion<C, Fut, B, E>(
851 client: C,
852 params: &crate::__types::DeleteChatCompletionParams,
853) -> DeleteChatCompletion<Fut, B, E>
854where
855 C: FnOnce(http::Request<String>) -> Fut,
856 Fut: Future<Output = Result<http::Response<B>, E>>,
857 B: http_body::Body,
858{
859 DeleteChatCompletion(futures::TryFutureExt::and_then(
860 crate::__combinators::Send::new(
861 client,
862 || {
863 let path = {
864 #[serde_with::serde_as]
865 #[derive(serde :: Serialize)]
866 struct Query<'a> {
867 #[serde(skip_serializing)]
868 _phantom: std::marker::PhantomData<&'a ()>,
869 }
870 #[allow(clippy::useless_format)]
871 let mut path = format!(
872 "/chat/completions/{completion_id}",
873 completion_id = params.completion_id
874 );
875 let crate::__types::DeleteChatCompletionParams { .. } = params;
876 let query = serde_urlencoded::to_string(Query {
877 _phantom: std::marker::PhantomData,
878 })?;
879 if !query.is_empty() {
880 path.push('?');
881 path.push_str(&query);
882 }
883 path
884 };
885 let body = String::new();
886 Ok(http::Request::builder()
887 .method(http::Method::DELETE)
888 .uri(path)
889 .header(http::header::CONTENT_LENGTH, body.len())
890 .body(body)?)
891 },
892 (
893 http::StatusCode::from_u16(200u16).unwrap(),
894 Some(mime::APPLICATION_JSON),
895 ),
896 ),
897 crate::__combinators::Json::new,
898 ))
899}
900future!(
901 DeleteChatCompletion,
902 futures::future::AndThen<
903 crate::__combinators::Send<Fut, B, E>,
904 crate::__combinators::Json<B, E, crate::__types::ChatCompletionDeleted>,
905 fn(
906 http::Response<B>,
907 ) -> crate::__combinators::Json<B, E, crate::__types::ChatCompletionDeleted>,
908 >,
909 crate::__types::ChatCompletionDeleted
910);
911#[doc = "Get the messages in a stored chat completion. Only Chat Completions that\nhave been created with the `store` parameter set to `true` will be\nreturned.\n"]
912pub fn get_chat_completion_messages<C, Fut, B, E>(
913 client: C,
914 params: &crate::__types::GetChatCompletionMessagesParams,
915) -> GetChatCompletionMessages<Fut, B, E>
916where
917 C: FnOnce(http::Request<String>) -> Fut,
918 Fut: Future<Output = Result<http::Response<B>, E>>,
919 B: http_body::Body,
920{
921 GetChatCompletionMessages(futures::TryFutureExt::and_then(
922 crate::__combinators::Send::new(
923 client,
924 || {
925 let path = {
926 #[serde_with::serde_as]
927 #[derive(serde :: Serialize)]
928 struct Query<'a> {
929 #[serde(rename = "after")]
930 #[serde(skip_serializing_if = "Option::is_none")]
931 after: &'a Option<String>,
932 #[serde(rename = "limit")]
933 #[serde(skip_serializing_if = "Option::is_none")]
934 limit: &'a Option<i64>,
935 #[serde(rename = "order")]
936 #[serde(skip_serializing_if = "Option::is_none")]
937 order: &'a Option<crate::__types::GetChatCompletionMessagesParamsOrder>,
938 #[serde(skip_serializing)]
939 _phantom: std::marker::PhantomData<&'a ()>,
940 }
941 #[allow(clippy::useless_format)]
942 let mut path = format!(
943 "/chat/completions/{completion_id}/messages",
944 completion_id = params.completion_id
945 );
946 let crate::__types::GetChatCompletionMessagesParams {
947 after,
948 limit,
949 order,
950 ..
951 } = params;
952 let query = serde_urlencoded::to_string(Query {
953 after,
954 limit,
955 order,
956 _phantom: std::marker::PhantomData,
957 })?;
958 if !query.is_empty() {
959 path.push('?');
960 path.push_str(&query);
961 }
962 path
963 };
964 let body = String::new();
965 Ok(http::Request::builder()
966 .method(http::Method::GET)
967 .uri(path)
968 .header(http::header::CONTENT_LENGTH, body.len())
969 .body(body)?)
970 },
971 (
972 http::StatusCode::from_u16(200u16).unwrap(),
973 Some(mime::APPLICATION_JSON),
974 ),
975 ),
976 crate::__combinators::Json::new,
977 ))
978}
979future!(
980 GetChatCompletionMessages,
981 futures::future::AndThen<
982 crate::__combinators::Send<Fut, B, E>,
983 crate::__combinators::Json<B, E, crate::__types::ChatCompletionMessageList>,
984 fn(
985 http::Response<B>,
986 ) -> crate::__combinators::Json<B, E, crate::__types::ChatCompletionMessageList>,
987 >,
988 crate::__types::ChatCompletionMessageList
989);
990#[doc = "Creates a completion for the provided prompt and parameters."]
991pub fn create_completion<C, Fut, B, E>(
992 client: C,
993 request: &crate::__types::CreateCompletionRequest,
994) -> CreateCompletion<Fut, B, E>
995where
996 C: FnOnce(http::Request<String>) -> Fut,
997 Fut: Future<Output = Result<http::Response<B>, E>>,
998 B: http_body::Body,
999{
1000 CreateCompletion(futures::TryFutureExt::and_then(
1001 crate::__combinators::Send::new(
1002 client,
1003 || {
1004 let path = "/completions";
1005 let body = serde_json::to_string(request)?;
1006 Ok(http::Request::builder()
1007 .method(http::Method::POST)
1008 .uri(path)
1009 .header(http::header::CONTENT_LENGTH, body.len())
1010 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
1011 .body(body)?)
1012 },
1013 (
1014 http::StatusCode::from_u16(200u16).unwrap(),
1015 Some(mime::APPLICATION_JSON),
1016 ),
1017 ),
1018 crate::__combinators::Json::new,
1019 ))
1020}
1021future!(
1022 CreateCompletion,
1023 futures::future::AndThen<
1024 crate::__combinators::Send<Fut, B, E>,
1025 crate::__combinators::Json<B, E, crate::__types::CreateCompletionResponse>,
1026 fn(
1027 http::Response<B>,
1028 ) -> crate::__combinators::Json<B, E, crate::__types::CreateCompletionResponse>,
1029 >,
1030 crate::__types::CreateCompletionResponse
1031);
1032#[doc = "List Containers"]
1033pub fn list_containers<C, Fut, B, E>(
1034 client: C,
1035 params: &crate::__types::ListContainersParams,
1036) -> ListContainers<Fut, B, E>
1037where
1038 C: FnOnce(http::Request<String>) -> Fut,
1039 Fut: Future<Output = Result<http::Response<B>, E>>,
1040 B: http_body::Body,
1041{
1042 ListContainers(futures::TryFutureExt::and_then(
1043 crate::__combinators::Send::new(
1044 client,
1045 || {
1046 let path = {
1047 #[serde_with::serde_as]
1048 #[derive(serde :: Serialize)]
1049 struct Query<'a> {
1050 #[serde(rename = "limit")]
1051 #[serde(skip_serializing_if = "Option::is_none")]
1052 limit: &'a Option<i64>,
1053 #[serde(rename = "order")]
1054 #[serde(skip_serializing_if = "Option::is_none")]
1055 order: &'a Option<crate::__types::ListContainersParamsOrder>,
1056 #[serde(rename = "after")]
1057 #[serde(skip_serializing_if = "Option::is_none")]
1058 after: &'a Option<String>,
1059 #[serde(skip_serializing)]
1060 _phantom: std::marker::PhantomData<&'a ()>,
1061 }
1062 #[allow(clippy::useless_format)]
1063 let mut path = format!("/containers",);
1064 let crate::__types::ListContainersParams {
1065 limit,
1066 order,
1067 after,
1068 ..
1069 } = params;
1070 let query = serde_urlencoded::to_string(Query {
1071 limit,
1072 order,
1073 after,
1074 _phantom: std::marker::PhantomData,
1075 })?;
1076 if !query.is_empty() {
1077 path.push('?');
1078 path.push_str(&query);
1079 }
1080 path
1081 };
1082 let body = String::new();
1083 Ok(http::Request::builder()
1084 .method(http::Method::GET)
1085 .uri(path)
1086 .header(http::header::CONTENT_LENGTH, body.len())
1087 .body(body)?)
1088 },
1089 (
1090 http::StatusCode::from_u16(200u16).unwrap(),
1091 Some(mime::APPLICATION_JSON),
1092 ),
1093 ),
1094 crate::__combinators::Json::new,
1095 ))
1096}
1097future!(
1098 ListContainers,
1099 futures::future::AndThen<
1100 crate::__combinators::Send<Fut, B, E>,
1101 crate::__combinators::Json<B, E, crate::__types::ContainerListResource>,
1102 fn(
1103 http::Response<B>,
1104 ) -> crate::__combinators::Json<B, E, crate::__types::ContainerListResource>,
1105 >,
1106 crate::__types::ContainerListResource
1107);
1108#[doc = "Retrieve Container"]
1109pub fn retrieve_container<C, Fut, B, E>(
1110 client: C,
1111 params: &crate::__types::RetrieveContainerParams,
1112) -> RetrieveContainer<Fut, B, E>
1113where
1114 C: FnOnce(http::Request<String>) -> Fut,
1115 Fut: Future<Output = Result<http::Response<B>, E>>,
1116 B: http_body::Body,
1117{
1118 RetrieveContainer(futures::TryFutureExt::and_then(
1119 crate::__combinators::Send::new(
1120 client,
1121 || {
1122 let path = {
1123 #[serde_with::serde_as]
1124 #[derive(serde :: Serialize)]
1125 struct Query<'a> {
1126 #[serde(skip_serializing)]
1127 _phantom: std::marker::PhantomData<&'a ()>,
1128 }
1129 #[allow(clippy::useless_format)]
1130 let mut path = format!(
1131 "/containers/{container_id}",
1132 container_id = params.container_id
1133 );
1134 let crate::__types::RetrieveContainerParams { .. } = params;
1135 let query = serde_urlencoded::to_string(Query {
1136 _phantom: std::marker::PhantomData,
1137 })?;
1138 if !query.is_empty() {
1139 path.push('?');
1140 path.push_str(&query);
1141 }
1142 path
1143 };
1144 let body = String::new();
1145 Ok(http::Request::builder()
1146 .method(http::Method::GET)
1147 .uri(path)
1148 .header(http::header::CONTENT_LENGTH, body.len())
1149 .body(body)?)
1150 },
1151 (
1152 http::StatusCode::from_u16(200u16).unwrap(),
1153 Some(mime::APPLICATION_JSON),
1154 ),
1155 ),
1156 crate::__combinators::Json::new,
1157 ))
1158}
1159future!(
1160 RetrieveContainer,
1161 futures::future::AndThen<
1162 crate::__combinators::Send<Fut, B, E>,
1163 crate::__combinators::Json<B, E, crate::__types::ContainerResource>,
1164 fn(
1165 http::Response<B>,
1166 ) -> crate::__combinators::Json<B, E, crate::__types::ContainerResource>,
1167 >,
1168 crate::__types::ContainerResource
1169);
1170#[doc = "List Container files"]
1171pub fn list_container_files<C, Fut, B, E>(
1172 client: C,
1173 params: &crate::__types::ListContainerFilesParams,
1174) -> ListContainerFiles<Fut, B, E>
1175where
1176 C: FnOnce(http::Request<String>) -> Fut,
1177 Fut: Future<Output = Result<http::Response<B>, E>>,
1178 B: http_body::Body,
1179{
1180 ListContainerFiles(futures::TryFutureExt::and_then(
1181 crate::__combinators::Send::new(
1182 client,
1183 || {
1184 let path = {
1185 #[serde_with::serde_as]
1186 #[derive(serde :: Serialize)]
1187 struct Query<'a> {
1188 #[serde(rename = "limit")]
1189 #[serde(skip_serializing_if = "Option::is_none")]
1190 limit: &'a Option<i64>,
1191 #[serde(rename = "order")]
1192 #[serde(skip_serializing_if = "Option::is_none")]
1193 order: &'a Option<crate::__types::ListContainerFilesParamsOrder>,
1194 #[serde(rename = "after")]
1195 #[serde(skip_serializing_if = "Option::is_none")]
1196 after: &'a Option<String>,
1197 #[serde(skip_serializing)]
1198 _phantom: std::marker::PhantomData<&'a ()>,
1199 }
1200 #[allow(clippy::useless_format)]
1201 let mut path = format!(
1202 "/containers/{container_id}/files",
1203 container_id = params.container_id
1204 );
1205 let crate::__types::ListContainerFilesParams {
1206 limit,
1207 order,
1208 after,
1209 ..
1210 } = params;
1211 let query = serde_urlencoded::to_string(Query {
1212 limit,
1213 order,
1214 after,
1215 _phantom: std::marker::PhantomData,
1216 })?;
1217 if !query.is_empty() {
1218 path.push('?');
1219 path.push_str(&query);
1220 }
1221 path
1222 };
1223 let body = String::new();
1224 Ok(http::Request::builder()
1225 .method(http::Method::GET)
1226 .uri(path)
1227 .header(http::header::CONTENT_LENGTH, body.len())
1228 .body(body)?)
1229 },
1230 (
1231 http::StatusCode::from_u16(200u16).unwrap(),
1232 Some(mime::APPLICATION_JSON),
1233 ),
1234 ),
1235 crate::__combinators::Json::new,
1236 ))
1237}
1238future!(
1239 ListContainerFiles,
1240 futures::future::AndThen<
1241 crate::__combinators::Send<Fut, B, E>,
1242 crate::__combinators::Json<B, E, crate::__types::ContainerFileListResource>,
1243 fn(
1244 http::Response<B>,
1245 ) -> crate::__combinators::Json<B, E, crate::__types::ContainerFileListResource>,
1246 >,
1247 crate::__types::ContainerFileListResource
1248);
1249#[doc = "Retrieve Container File"]
1250pub fn retrieve_container_file<C, Fut, B, E>(
1251 client: C,
1252 params: &crate::__types::RetrieveContainerFileParams,
1253) -> RetrieveContainerFile<Fut, B, E>
1254where
1255 C: FnOnce(http::Request<String>) -> Fut,
1256 Fut: Future<Output = Result<http::Response<B>, E>>,
1257 B: http_body::Body,
1258{
1259 RetrieveContainerFile(futures::TryFutureExt::and_then(
1260 crate::__combinators::Send::new(
1261 client,
1262 || {
1263 let path = {
1264 #[serde_with::serde_as]
1265 #[derive(serde :: Serialize)]
1266 struct Query<'a> {
1267 #[serde(skip_serializing)]
1268 _phantom: std::marker::PhantomData<&'a ()>,
1269 }
1270 #[allow(clippy::useless_format)]
1271 let mut path = format!(
1272 "/containers/{container_id}/files/{file_id}",
1273 container_id = params.container_id,
1274 file_id = params.file_id
1275 );
1276 let crate::__types::RetrieveContainerFileParams { .. } = params;
1277 let query = serde_urlencoded::to_string(Query {
1278 _phantom: std::marker::PhantomData,
1279 })?;
1280 if !query.is_empty() {
1281 path.push('?');
1282 path.push_str(&query);
1283 }
1284 path
1285 };
1286 let body = String::new();
1287 Ok(http::Request::builder()
1288 .method(http::Method::GET)
1289 .uri(path)
1290 .header(http::header::CONTENT_LENGTH, body.len())
1291 .body(body)?)
1292 },
1293 (
1294 http::StatusCode::from_u16(200u16).unwrap(),
1295 Some(mime::APPLICATION_JSON),
1296 ),
1297 ),
1298 crate::__combinators::Json::new,
1299 ))
1300}
1301future!(
1302 RetrieveContainerFile,
1303 futures::future::AndThen<
1304 crate::__combinators::Send<Fut, B, E>,
1305 crate::__combinators::Json<B, E, crate::__types::ContainerFileResource>,
1306 fn(
1307 http::Response<B>,
1308 ) -> crate::__combinators::Json<B, E, crate::__types::ContainerFileResource>,
1309 >,
1310 crate::__types::ContainerFileResource
1311);
1312#[doc = "Creates an embedding vector representing the input text."]
1313pub fn create_embedding<C, Fut, B, E>(
1314 client: C,
1315 request: &crate::__types::CreateEmbeddingRequest,
1316) -> CreateEmbedding<Fut, B, E>
1317where
1318 C: FnOnce(http::Request<String>) -> Fut,
1319 Fut: Future<Output = Result<http::Response<B>, E>>,
1320 B: http_body::Body,
1321{
1322 CreateEmbedding(futures::TryFutureExt::and_then(
1323 crate::__combinators::Send::new(
1324 client,
1325 || {
1326 let path = "/embeddings";
1327 let body = serde_json::to_string(request)?;
1328 Ok(http::Request::builder()
1329 .method(http::Method::POST)
1330 .uri(path)
1331 .header(http::header::CONTENT_LENGTH, body.len())
1332 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
1333 .body(body)?)
1334 },
1335 (
1336 http::StatusCode::from_u16(200u16).unwrap(),
1337 Some(mime::APPLICATION_JSON),
1338 ),
1339 ),
1340 crate::__combinators::Json::new,
1341 ))
1342}
1343future!(
1344 CreateEmbedding,
1345 futures::future::AndThen<
1346 crate::__combinators::Send<Fut, B, E>,
1347 crate::__combinators::Json<B, E, crate::__types::CreateEmbeddingResponse>,
1348 fn(
1349 http::Response<B>,
1350 ) -> crate::__combinators::Json<B, E, crate::__types::CreateEmbeddingResponse>,
1351 >,
1352 crate::__types::CreateEmbeddingResponse
1353);
1354#[doc = "List evaluations for a project.\n"]
1355pub fn list_evals<C, Fut, B, E>(
1356 client: C,
1357 params: &crate::__types::ListEvalsParams,
1358) -> ListEvals<Fut, B, E>
1359where
1360 C: FnOnce(http::Request<String>) -> Fut,
1361 Fut: Future<Output = Result<http::Response<B>, E>>,
1362 B: http_body::Body,
1363{
1364 ListEvals(futures::TryFutureExt::and_then(
1365 crate::__combinators::Send::new(
1366 client,
1367 || {
1368 let path = {
1369 #[serde_with::serde_as]
1370 #[derive(serde :: Serialize)]
1371 struct Query<'a> {
1372 #[serde(rename = "after")]
1373 #[serde(skip_serializing_if = "Option::is_none")]
1374 after: &'a Option<String>,
1375 #[serde(rename = "limit")]
1376 #[serde(skip_serializing_if = "Option::is_none")]
1377 limit: &'a Option<i64>,
1378 #[serde(rename = "order")]
1379 #[serde(skip_serializing_if = "Option::is_none")]
1380 order: &'a Option<crate::__types::ListEvalsParamsOrder>,
1381 #[serde(rename = "order_by")]
1382 #[serde(skip_serializing_if = "Option::is_none")]
1383 order_by: &'a Option<crate::__types::ListEvalsParamsOrderBy>,
1384 #[serde(skip_serializing)]
1385 _phantom: std::marker::PhantomData<&'a ()>,
1386 }
1387 #[allow(clippy::useless_format)]
1388 let mut path = format!("/evals",);
1389 let crate::__types::ListEvalsParams {
1390 after,
1391 limit,
1392 order,
1393 order_by,
1394 ..
1395 } = params;
1396 let query = serde_urlencoded::to_string(Query {
1397 after,
1398 limit,
1399 order,
1400 order_by,
1401 _phantom: std::marker::PhantomData,
1402 })?;
1403 if !query.is_empty() {
1404 path.push('?');
1405 path.push_str(&query);
1406 }
1407 path
1408 };
1409 let body = String::new();
1410 Ok(http::Request::builder()
1411 .method(http::Method::GET)
1412 .uri(path)
1413 .header(http::header::CONTENT_LENGTH, body.len())
1414 .body(body)?)
1415 },
1416 (
1417 http::StatusCode::from_u16(200u16).unwrap(),
1418 Some(mime::APPLICATION_JSON),
1419 ),
1420 ),
1421 crate::__combinators::Json::new,
1422 ))
1423}
1424future!(
1425 ListEvals,
1426 futures::future::AndThen<
1427 crate::__combinators::Send<Fut, B, E>,
1428 crate::__combinators::Json<B, E, crate::__types::EvalList>,
1429 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::EvalList>,
1430 >,
1431 crate::__types::EvalList
1432);
1433#[doc = "Create the structure of an evaluation that can be used to test a model's performance.\nAn evaluation is a set of testing criteria and the config for a data source, which dictates the schema of the data used in the evaluation. After creating an evaluation, you can run it on different models and model parameters. We support several types of graders and datasources.\nFor more information, see the [Evals guide](https://platform.openai.com/docs/guides/evals).\n"]
1434pub fn create_eval<C, Fut, B, E>(
1435 client: C,
1436 request: &crate::__types::CreateEvalRequest,
1437) -> CreateEval<Fut, B, E>
1438where
1439 C: FnOnce(http::Request<String>) -> Fut,
1440 Fut: Future<Output = Result<http::Response<B>, E>>,
1441 B: http_body::Body,
1442{
1443 CreateEval(futures::TryFutureExt::and_then(
1444 crate::__combinators::Send::new(
1445 client,
1446 || {
1447 let path = "/evals";
1448 let body = serde_json::to_string(request)?;
1449 Ok(http::Request::builder()
1450 .method(http::Method::POST)
1451 .uri(path)
1452 .header(http::header::CONTENT_LENGTH, body.len())
1453 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
1454 .body(body)?)
1455 },
1456 (
1457 http::StatusCode::from_u16(201u16).unwrap(),
1458 Some(mime::APPLICATION_JSON),
1459 ),
1460 ),
1461 crate::__combinators::Json::new,
1462 ))
1463}
1464future!(
1465 CreateEval,
1466 futures::future::AndThen<
1467 crate::__combinators::Send<Fut, B, E>,
1468 crate::__combinators::Json<B, E, crate::__types::Eval>,
1469 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Eval>,
1470 >,
1471 crate::__types::Eval
1472);
1473#[doc = "Get an evaluation by ID.\n"]
1474pub fn get_eval<C, Fut, B, E>(
1475 client: C,
1476 params: &crate::__types::GetEvalParams,
1477) -> GetEval<Fut, B, E>
1478where
1479 C: FnOnce(http::Request<String>) -> Fut,
1480 Fut: Future<Output = Result<http::Response<B>, E>>,
1481 B: http_body::Body,
1482{
1483 GetEval(futures::TryFutureExt::and_then(
1484 crate::__combinators::Send::new(
1485 client,
1486 || {
1487 let path = {
1488 #[serde_with::serde_as]
1489 #[derive(serde :: Serialize)]
1490 struct Query<'a> {
1491 #[serde(skip_serializing)]
1492 _phantom: std::marker::PhantomData<&'a ()>,
1493 }
1494 #[allow(clippy::useless_format)]
1495 let mut path = format!("/evals/{eval_id}", eval_id = params.eval_id);
1496 let crate::__types::GetEvalParams { .. } = params;
1497 let query = serde_urlencoded::to_string(Query {
1498 _phantom: std::marker::PhantomData,
1499 })?;
1500 if !query.is_empty() {
1501 path.push('?');
1502 path.push_str(&query);
1503 }
1504 path
1505 };
1506 let body = String::new();
1507 Ok(http::Request::builder()
1508 .method(http::Method::GET)
1509 .uri(path)
1510 .header(http::header::CONTENT_LENGTH, body.len())
1511 .body(body)?)
1512 },
1513 (
1514 http::StatusCode::from_u16(200u16).unwrap(),
1515 Some(mime::APPLICATION_JSON),
1516 ),
1517 ),
1518 crate::__combinators::Json::new,
1519 ))
1520}
1521future!(
1522 GetEval,
1523 futures::future::AndThen<
1524 crate::__combinators::Send<Fut, B, E>,
1525 crate::__combinators::Json<B, E, crate::__types::Eval>,
1526 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Eval>,
1527 >,
1528 crate::__types::Eval
1529);
1530#[doc = "Update certain properties of an evaluation.\n"]
1531pub fn update_eval<C, Fut, B, E>(
1532 client: C,
1533 params: &crate::__types::UpdateEvalParams,
1534 request: &crate::__types::UpdateEvalRequest,
1535) -> UpdateEval<Fut, B, E>
1536where
1537 C: FnOnce(http::Request<String>) -> Fut,
1538 Fut: Future<Output = Result<http::Response<B>, E>>,
1539 B: http_body::Body,
1540{
1541 UpdateEval(futures::TryFutureExt::and_then(
1542 crate::__combinators::Send::new(
1543 client,
1544 || {
1545 let path = {
1546 #[serde_with::serde_as]
1547 #[derive(serde :: Serialize)]
1548 struct Query<'a> {
1549 #[serde(skip_serializing)]
1550 _phantom: std::marker::PhantomData<&'a ()>,
1551 }
1552 #[allow(clippy::useless_format)]
1553 let mut path = format!("/evals/{eval_id}", eval_id = params.eval_id);
1554 let crate::__types::UpdateEvalParams { .. } = params;
1555 let query = serde_urlencoded::to_string(Query {
1556 _phantom: std::marker::PhantomData,
1557 })?;
1558 if !query.is_empty() {
1559 path.push('?');
1560 path.push_str(&query);
1561 }
1562 path
1563 };
1564 let body = serde_json::to_string(request)?;
1565 Ok(http::Request::builder()
1566 .method(http::Method::POST)
1567 .uri(path)
1568 .header(http::header::CONTENT_LENGTH, body.len())
1569 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
1570 .body(body)?)
1571 },
1572 (
1573 http::StatusCode::from_u16(200u16).unwrap(),
1574 Some(mime::APPLICATION_JSON),
1575 ),
1576 ),
1577 crate::__combinators::Json::new,
1578 ))
1579}
1580future!(
1581 UpdateEval,
1582 futures::future::AndThen<
1583 crate::__combinators::Send<Fut, B, E>,
1584 crate::__combinators::Json<B, E, crate::__types::Eval>,
1585 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Eval>,
1586 >,
1587 crate::__types::Eval
1588);
1589#[doc = "Delete an evaluation.\n"]
1590pub fn delete_eval<C, Fut, B, E>(
1591 client: C,
1592 params: &crate::__types::DeleteEvalParams,
1593) -> DeleteEval<Fut, B, E>
1594where
1595 C: FnOnce(http::Request<String>) -> Fut,
1596 Fut: Future<Output = Result<http::Response<B>, E>>,
1597 B: http_body::Body,
1598{
1599 DeleteEval(futures::TryFutureExt::and_then(
1600 crate::__combinators::Send::new(
1601 client,
1602 || {
1603 let path = {
1604 #[serde_with::serde_as]
1605 #[derive(serde :: Serialize)]
1606 struct Query<'a> {
1607 #[serde(skip_serializing)]
1608 _phantom: std::marker::PhantomData<&'a ()>,
1609 }
1610 #[allow(clippy::useless_format)]
1611 let mut path = format!("/evals/{eval_id}", eval_id = params.eval_id);
1612 let crate::__types::DeleteEvalParams { .. } = params;
1613 let query = serde_urlencoded::to_string(Query {
1614 _phantom: std::marker::PhantomData,
1615 })?;
1616 if !query.is_empty() {
1617 path.push('?');
1618 path.push_str(&query);
1619 }
1620 path
1621 };
1622 let body = String::new();
1623 Ok(http::Request::builder()
1624 .method(http::Method::DELETE)
1625 .uri(path)
1626 .header(http::header::CONTENT_LENGTH, body.len())
1627 .body(body)?)
1628 },
1629 (
1630 http::StatusCode::from_u16(200u16).unwrap(),
1631 Some(mime::APPLICATION_JSON),
1632 ),
1633 ),
1634 crate::__combinators::Json::new,
1635 ))
1636}
1637future!(
1638 DeleteEval,
1639 futures::future::AndThen<
1640 crate::__combinators::Send<Fut, B, E>,
1641 crate::__combinators::Json<B, E, crate::__types::DeleteEvalResponse>,
1642 fn(
1643 http::Response<B>,
1644 ) -> crate::__combinators::Json<B, E, crate::__types::DeleteEvalResponse>,
1645 >,
1646 crate::__types::DeleteEvalResponse
1647);
1648#[doc = "Get a list of runs for an evaluation.\n"]
1649pub fn get_eval_runs<C, Fut, B, E>(
1650 client: C,
1651 params: &crate::__types::GetEvalRunsParams,
1652) -> GetEvalRuns<Fut, B, E>
1653where
1654 C: FnOnce(http::Request<String>) -> Fut,
1655 Fut: Future<Output = Result<http::Response<B>, E>>,
1656 B: http_body::Body,
1657{
1658 GetEvalRuns(futures::TryFutureExt::and_then(
1659 crate::__combinators::Send::new(
1660 client,
1661 || {
1662 let path = {
1663 #[serde_with::serde_as]
1664 #[derive(serde :: Serialize)]
1665 struct Query<'a> {
1666 #[serde(rename = "after")]
1667 #[serde(skip_serializing_if = "Option::is_none")]
1668 after: &'a Option<String>,
1669 #[serde(rename = "limit")]
1670 #[serde(skip_serializing_if = "Option::is_none")]
1671 limit: &'a Option<i64>,
1672 #[serde(rename = "order")]
1673 #[serde(skip_serializing_if = "Option::is_none")]
1674 order: &'a Option<crate::__types::GetEvalRunsParamsOrder>,
1675 #[serde(rename = "status")]
1676 #[serde(skip_serializing_if = "Option::is_none")]
1677 status: &'a Option<crate::__types::GetEvalRunsParamsStatus>,
1678 #[serde(skip_serializing)]
1679 _phantom: std::marker::PhantomData<&'a ()>,
1680 }
1681 #[allow(clippy::useless_format)]
1682 let mut path = format!("/evals/{eval_id}/runs", eval_id = params.eval_id);
1683 let crate::__types::GetEvalRunsParams {
1684 after,
1685 limit,
1686 order,
1687 status,
1688 ..
1689 } = params;
1690 let query = serde_urlencoded::to_string(Query {
1691 after,
1692 limit,
1693 order,
1694 status,
1695 _phantom: std::marker::PhantomData,
1696 })?;
1697 if !query.is_empty() {
1698 path.push('?');
1699 path.push_str(&query);
1700 }
1701 path
1702 };
1703 let body = String::new();
1704 Ok(http::Request::builder()
1705 .method(http::Method::GET)
1706 .uri(path)
1707 .header(http::header::CONTENT_LENGTH, body.len())
1708 .body(body)?)
1709 },
1710 (
1711 http::StatusCode::from_u16(200u16).unwrap(),
1712 Some(mime::APPLICATION_JSON),
1713 ),
1714 ),
1715 crate::__combinators::Json::new,
1716 ))
1717}
1718future!(
1719 GetEvalRuns,
1720 futures::future::AndThen<
1721 crate::__combinators::Send<Fut, B, E>,
1722 crate::__combinators::Json<B, E, crate::__types::EvalRunList>,
1723 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::EvalRunList>,
1724 >,
1725 crate::__types::EvalRunList
1726);
1727#[doc = "Kicks off a new run for a given evaluation, specifying the data source, and what model configuration to use to test. The datasource will be validated against the schema specified in the config of the evaluation.\n"]
1728pub fn create_eval_run<C, Fut, B, E>(
1729 client: C,
1730 params: &crate::__types::CreateEvalRunParams,
1731 request: &crate::__types::CreateEvalRunRequest,
1732) -> CreateEvalRun<Fut, B, E>
1733where
1734 C: FnOnce(http::Request<String>) -> Fut,
1735 Fut: Future<Output = Result<http::Response<B>, E>>,
1736 B: http_body::Body,
1737{
1738 CreateEvalRun(futures::TryFutureExt::and_then(
1739 crate::__combinators::Send::new(
1740 client,
1741 || {
1742 let path = {
1743 #[serde_with::serde_as]
1744 #[derive(serde :: Serialize)]
1745 struct Query<'a> {
1746 #[serde(skip_serializing)]
1747 _phantom: std::marker::PhantomData<&'a ()>,
1748 }
1749 #[allow(clippy::useless_format)]
1750 let mut path = format!("/evals/{eval_id}/runs", eval_id = params.eval_id);
1751 let crate::__types::CreateEvalRunParams { .. } = params;
1752 let query = serde_urlencoded::to_string(Query {
1753 _phantom: std::marker::PhantomData,
1754 })?;
1755 if !query.is_empty() {
1756 path.push('?');
1757 path.push_str(&query);
1758 }
1759 path
1760 };
1761 let body = serde_json::to_string(request)?;
1762 Ok(http::Request::builder()
1763 .method(http::Method::POST)
1764 .uri(path)
1765 .header(http::header::CONTENT_LENGTH, body.len())
1766 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
1767 .body(body)?)
1768 },
1769 (
1770 http::StatusCode::from_u16(201u16).unwrap(),
1771 Some(mime::APPLICATION_JSON),
1772 ),
1773 ),
1774 crate::__combinators::Json::new,
1775 ))
1776}
1777future!(
1778 CreateEvalRun,
1779 futures::future::AndThen<
1780 crate::__combinators::Send<Fut, B, E>,
1781 crate::__combinators::Json<B, E, crate::__types::EvalRun>,
1782 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::EvalRun>,
1783 >,
1784 crate::__types::EvalRun
1785);
1786#[doc = "Get an evaluation run by ID.\n"]
1787pub fn get_eval_run<C, Fut, B, E>(
1788 client: C,
1789 params: &crate::__types::GetEvalRunParams,
1790) -> GetEvalRun<Fut, B, E>
1791where
1792 C: FnOnce(http::Request<String>) -> Fut,
1793 Fut: Future<Output = Result<http::Response<B>, E>>,
1794 B: http_body::Body,
1795{
1796 GetEvalRun(futures::TryFutureExt::and_then(
1797 crate::__combinators::Send::new(
1798 client,
1799 || {
1800 let path = {
1801 #[serde_with::serde_as]
1802 #[derive(serde :: Serialize)]
1803 struct Query<'a> {
1804 #[serde(skip_serializing)]
1805 _phantom: std::marker::PhantomData<&'a ()>,
1806 }
1807 #[allow(clippy::useless_format)]
1808 let mut path = format!(
1809 "/evals/{eval_id}/runs/{run_id}",
1810 eval_id = params.eval_id,
1811 run_id = params.run_id
1812 );
1813 let crate::__types::GetEvalRunParams { .. } = params;
1814 let query = serde_urlencoded::to_string(Query {
1815 _phantom: std::marker::PhantomData,
1816 })?;
1817 if !query.is_empty() {
1818 path.push('?');
1819 path.push_str(&query);
1820 }
1821 path
1822 };
1823 let body = String::new();
1824 Ok(http::Request::builder()
1825 .method(http::Method::GET)
1826 .uri(path)
1827 .header(http::header::CONTENT_LENGTH, body.len())
1828 .body(body)?)
1829 },
1830 (
1831 http::StatusCode::from_u16(200u16).unwrap(),
1832 Some(mime::APPLICATION_JSON),
1833 ),
1834 ),
1835 crate::__combinators::Json::new,
1836 ))
1837}
1838future!(
1839 GetEvalRun,
1840 futures::future::AndThen<
1841 crate::__combinators::Send<Fut, B, E>,
1842 crate::__combinators::Json<B, E, crate::__types::EvalRun>,
1843 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::EvalRun>,
1844 >,
1845 crate::__types::EvalRun
1846);
1847#[doc = "Cancel an ongoing evaluation run.\n"]
1848pub fn cancel_eval_run<C, Fut, B, E>(
1849 client: C,
1850 params: &crate::__types::CancelEvalRunParams,
1851) -> CancelEvalRun<Fut, B, E>
1852where
1853 C: FnOnce(http::Request<String>) -> Fut,
1854 Fut: Future<Output = Result<http::Response<B>, E>>,
1855 B: http_body::Body,
1856{
1857 CancelEvalRun(futures::TryFutureExt::and_then(
1858 crate::__combinators::Send::new(
1859 client,
1860 || {
1861 let path = {
1862 #[serde_with::serde_as]
1863 #[derive(serde :: Serialize)]
1864 struct Query<'a> {
1865 #[serde(skip_serializing)]
1866 _phantom: std::marker::PhantomData<&'a ()>,
1867 }
1868 #[allow(clippy::useless_format)]
1869 let mut path = format!(
1870 "/evals/{eval_id}/runs/{run_id}",
1871 eval_id = params.eval_id,
1872 run_id = params.run_id
1873 );
1874 let crate::__types::CancelEvalRunParams { .. } = params;
1875 let query = serde_urlencoded::to_string(Query {
1876 _phantom: std::marker::PhantomData,
1877 })?;
1878 if !query.is_empty() {
1879 path.push('?');
1880 path.push_str(&query);
1881 }
1882 path
1883 };
1884 let body = String::new();
1885 Ok(http::Request::builder()
1886 .method(http::Method::POST)
1887 .uri(path)
1888 .header(http::header::CONTENT_LENGTH, body.len())
1889 .body(body)?)
1890 },
1891 (
1892 http::StatusCode::from_u16(200u16).unwrap(),
1893 Some(mime::APPLICATION_JSON),
1894 ),
1895 ),
1896 crate::__combinators::Json::new,
1897 ))
1898}
1899future!(
1900 CancelEvalRun,
1901 futures::future::AndThen<
1902 crate::__combinators::Send<Fut, B, E>,
1903 crate::__combinators::Json<B, E, crate::__types::EvalRun>,
1904 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::EvalRun>,
1905 >,
1906 crate::__types::EvalRun
1907);
1908#[doc = "Delete an eval run.\n"]
1909pub fn delete_eval_run<C, Fut, B, E>(
1910 client: C,
1911 params: &crate::__types::DeleteEvalRunParams,
1912) -> DeleteEvalRun<Fut, B, E>
1913where
1914 C: FnOnce(http::Request<String>) -> Fut,
1915 Fut: Future<Output = Result<http::Response<B>, E>>,
1916 B: http_body::Body,
1917{
1918 DeleteEvalRun(futures::TryFutureExt::and_then(
1919 crate::__combinators::Send::new(
1920 client,
1921 || {
1922 let path = {
1923 #[serde_with::serde_as]
1924 #[derive(serde :: Serialize)]
1925 struct Query<'a> {
1926 #[serde(skip_serializing)]
1927 _phantom: std::marker::PhantomData<&'a ()>,
1928 }
1929 #[allow(clippy::useless_format)]
1930 let mut path = format!(
1931 "/evals/{eval_id}/runs/{run_id}",
1932 eval_id = params.eval_id,
1933 run_id = params.run_id
1934 );
1935 let crate::__types::DeleteEvalRunParams { .. } = params;
1936 let query = serde_urlencoded::to_string(Query {
1937 _phantom: std::marker::PhantomData,
1938 })?;
1939 if !query.is_empty() {
1940 path.push('?');
1941 path.push_str(&query);
1942 }
1943 path
1944 };
1945 let body = String::new();
1946 Ok(http::Request::builder()
1947 .method(http::Method::DELETE)
1948 .uri(path)
1949 .header(http::header::CONTENT_LENGTH, body.len())
1950 .body(body)?)
1951 },
1952 (
1953 http::StatusCode::from_u16(200u16).unwrap(),
1954 Some(mime::APPLICATION_JSON),
1955 ),
1956 ),
1957 crate::__combinators::Json::new,
1958 ))
1959}
1960future!(
1961 DeleteEvalRun,
1962 futures::future::AndThen<
1963 crate::__combinators::Send<Fut, B, E>,
1964 crate::__combinators::Json<B, E, crate::__types::DeleteEvalRunResponse>,
1965 fn(
1966 http::Response<B>,
1967 ) -> crate::__combinators::Json<B, E, crate::__types::DeleteEvalRunResponse>,
1968 >,
1969 crate::__types::DeleteEvalRunResponse
1970);
1971#[doc = "Get a list of output items for an evaluation run.\n"]
1972pub fn get_eval_run_output_items<C, Fut, B, E>(
1973 client: C,
1974 params: &crate::__types::GetEvalRunOutputItemsParams,
1975) -> GetEvalRunOutputItems<Fut, B, E>
1976where
1977 C: FnOnce(http::Request<String>) -> Fut,
1978 Fut: Future<Output = Result<http::Response<B>, E>>,
1979 B: http_body::Body,
1980{
1981 GetEvalRunOutputItems(futures::TryFutureExt::and_then(
1982 crate::__combinators::Send::new(
1983 client,
1984 || {
1985 let path = {
1986 #[serde_with::serde_as]
1987 #[derive(serde :: Serialize)]
1988 struct Query<'a> {
1989 #[serde(rename = "after")]
1990 #[serde(skip_serializing_if = "Option::is_none")]
1991 after: &'a Option<String>,
1992 #[serde(rename = "limit")]
1993 #[serde(skip_serializing_if = "Option::is_none")]
1994 limit: &'a Option<i64>,
1995 #[serde(rename = "status")]
1996 #[serde(skip_serializing_if = "Option::is_none")]
1997 status: &'a Option<crate::__types::GetEvalRunOutputItemsParamsStatus>,
1998 #[serde(rename = "order")]
1999 #[serde(skip_serializing_if = "Option::is_none")]
2000 order: &'a Option<crate::__types::GetEvalRunOutputItemsParamsOrder>,
2001 #[serde(skip_serializing)]
2002 _phantom: std::marker::PhantomData<&'a ()>,
2003 }
2004 #[allow(clippy::useless_format)]
2005 let mut path = format!(
2006 "/evals/{eval_id}/runs/{run_id}/output_items",
2007 eval_id = params.eval_id,
2008 run_id = params.run_id
2009 );
2010 let crate::__types::GetEvalRunOutputItemsParams {
2011 after,
2012 limit,
2013 status,
2014 order,
2015 ..
2016 } = params;
2017 let query = serde_urlencoded::to_string(Query {
2018 after,
2019 limit,
2020 status,
2021 order,
2022 _phantom: std::marker::PhantomData,
2023 })?;
2024 if !query.is_empty() {
2025 path.push('?');
2026 path.push_str(&query);
2027 }
2028 path
2029 };
2030 let body = String::new();
2031 Ok(http::Request::builder()
2032 .method(http::Method::GET)
2033 .uri(path)
2034 .header(http::header::CONTENT_LENGTH, body.len())
2035 .body(body)?)
2036 },
2037 (
2038 http::StatusCode::from_u16(200u16).unwrap(),
2039 Some(mime::APPLICATION_JSON),
2040 ),
2041 ),
2042 crate::__combinators::Json::new,
2043 ))
2044}
2045future!(
2046 GetEvalRunOutputItems,
2047 futures::future::AndThen<
2048 crate::__combinators::Send<Fut, B, E>,
2049 crate::__combinators::Json<B, E, crate::__types::EvalRunOutputItemList>,
2050 fn(
2051 http::Response<B>,
2052 ) -> crate::__combinators::Json<B, E, crate::__types::EvalRunOutputItemList>,
2053 >,
2054 crate::__types::EvalRunOutputItemList
2055);
2056#[doc = "Get an evaluation run output item by ID.\n"]
2057pub fn get_eval_run_output_item<C, Fut, B, E>(
2058 client: C,
2059 params: &crate::__types::GetEvalRunOutputItemParams,
2060) -> GetEvalRunOutputItem<Fut, B, E>
2061where
2062 C: FnOnce(http::Request<String>) -> Fut,
2063 Fut: Future<Output = Result<http::Response<B>, E>>,
2064 B: http_body::Body,
2065{
2066 GetEvalRunOutputItem(futures::TryFutureExt::and_then(
2067 crate::__combinators::Send::new(
2068 client,
2069 || {
2070 let path = {
2071 #[serde_with::serde_as]
2072 #[derive(serde :: Serialize)]
2073 struct Query<'a> {
2074 #[serde(skip_serializing)]
2075 _phantom: std::marker::PhantomData<&'a ()>,
2076 }
2077 #[allow(clippy::useless_format)]
2078 let mut path = format!(
2079 "/evals/{eval_id}/runs/{run_id}/output_items/{output_item_id}",
2080 eval_id = params.eval_id,
2081 run_id = params.run_id,
2082 output_item_id = params.output_item_id
2083 );
2084 let crate::__types::GetEvalRunOutputItemParams { .. } = params;
2085 let query = serde_urlencoded::to_string(Query {
2086 _phantom: std::marker::PhantomData,
2087 })?;
2088 if !query.is_empty() {
2089 path.push('?');
2090 path.push_str(&query);
2091 }
2092 path
2093 };
2094 let body = String::new();
2095 Ok(http::Request::builder()
2096 .method(http::Method::GET)
2097 .uri(path)
2098 .header(http::header::CONTENT_LENGTH, body.len())
2099 .body(body)?)
2100 },
2101 (
2102 http::StatusCode::from_u16(200u16).unwrap(),
2103 Some(mime::APPLICATION_JSON),
2104 ),
2105 ),
2106 crate::__combinators::Json::new,
2107 ))
2108}
2109future!(
2110 GetEvalRunOutputItem,
2111 futures::future::AndThen<
2112 crate::__combinators::Send<Fut, B, E>,
2113 crate::__combinators::Json<B, E, crate::__types::EvalRunOutputItem>,
2114 fn(
2115 http::Response<B>,
2116 ) -> crate::__combinators::Json<B, E, crate::__types::EvalRunOutputItem>,
2117 >,
2118 crate::__types::EvalRunOutputItem
2119);
2120#[doc = "Returns a list of files."]
2121pub fn list_files<C, Fut, B, E>(
2122 client: C,
2123 params: &crate::__types::ListFilesParams,
2124) -> ListFiles<Fut, B, E>
2125where
2126 C: FnOnce(http::Request<String>) -> Fut,
2127 Fut: Future<Output = Result<http::Response<B>, E>>,
2128 B: http_body::Body,
2129{
2130 ListFiles(futures::TryFutureExt::and_then(
2131 crate::__combinators::Send::new(
2132 client,
2133 || {
2134 let path = {
2135 #[serde_with::serde_as]
2136 #[derive(serde :: Serialize)]
2137 struct Query<'a> {
2138 #[serde(rename = "purpose")]
2139 #[serde(skip_serializing_if = "Option::is_none")]
2140 purpose: &'a Option<String>,
2141 #[serde(rename = "limit")]
2142 #[serde(skip_serializing_if = "Option::is_none")]
2143 limit: &'a Option<i64>,
2144 #[serde(rename = "order")]
2145 #[serde(skip_serializing_if = "Option::is_none")]
2146 order: &'a Option<crate::__types::ListFilesParamsOrder>,
2147 #[serde(rename = "after")]
2148 #[serde(skip_serializing_if = "Option::is_none")]
2149 after: &'a Option<String>,
2150 #[serde(skip_serializing)]
2151 _phantom: std::marker::PhantomData<&'a ()>,
2152 }
2153 #[allow(clippy::useless_format)]
2154 let mut path = format!("/files",);
2155 let crate::__types::ListFilesParams {
2156 purpose,
2157 limit,
2158 order,
2159 after,
2160 ..
2161 } = params;
2162 let query = serde_urlencoded::to_string(Query {
2163 purpose,
2164 limit,
2165 order,
2166 after,
2167 _phantom: std::marker::PhantomData,
2168 })?;
2169 if !query.is_empty() {
2170 path.push('?');
2171 path.push_str(&query);
2172 }
2173 path
2174 };
2175 let body = String::new();
2176 Ok(http::Request::builder()
2177 .method(http::Method::GET)
2178 .uri(path)
2179 .header(http::header::CONTENT_LENGTH, body.len())
2180 .body(body)?)
2181 },
2182 (
2183 http::StatusCode::from_u16(200u16).unwrap(),
2184 Some(mime::APPLICATION_JSON),
2185 ),
2186 ),
2187 crate::__combinators::Json::new,
2188 ))
2189}
2190future!(
2191 ListFiles,
2192 futures::future::AndThen<
2193 crate::__combinators::Send<Fut, B, E>,
2194 crate::__combinators::Json<B, E, crate::__types::ListFilesResponse>,
2195 fn(
2196 http::Response<B>,
2197 ) -> crate::__combinators::Json<B, E, crate::__types::ListFilesResponse>,
2198 >,
2199 crate::__types::ListFilesResponse
2200);
2201#[doc = "Delete a file."]
2202pub fn delete_file<C, Fut, B, E>(
2203 client: C,
2204 params: &crate::__types::DeleteFileParams,
2205) -> DeleteFile<Fut, B, E>
2206where
2207 C: FnOnce(http::Request<String>) -> Fut,
2208 Fut: Future<Output = Result<http::Response<B>, E>>,
2209 B: http_body::Body,
2210{
2211 DeleteFile(futures::TryFutureExt::and_then(
2212 crate::__combinators::Send::new(
2213 client,
2214 || {
2215 let path = {
2216 #[serde_with::serde_as]
2217 #[derive(serde :: Serialize)]
2218 struct Query<'a> {
2219 #[serde(skip_serializing)]
2220 _phantom: std::marker::PhantomData<&'a ()>,
2221 }
2222 #[allow(clippy::useless_format)]
2223 let mut path = format!("/files/{file_id}", file_id = params.file_id);
2224 let crate::__types::DeleteFileParams { .. } = params;
2225 let query = serde_urlencoded::to_string(Query {
2226 _phantom: std::marker::PhantomData,
2227 })?;
2228 if !query.is_empty() {
2229 path.push('?');
2230 path.push_str(&query);
2231 }
2232 path
2233 };
2234 let body = String::new();
2235 Ok(http::Request::builder()
2236 .method(http::Method::DELETE)
2237 .uri(path)
2238 .header(http::header::CONTENT_LENGTH, body.len())
2239 .body(body)?)
2240 },
2241 (
2242 http::StatusCode::from_u16(200u16).unwrap(),
2243 Some(mime::APPLICATION_JSON),
2244 ),
2245 ),
2246 crate::__combinators::Json::new,
2247 ))
2248}
2249future!(
2250 DeleteFile,
2251 futures::future::AndThen<
2252 crate::__combinators::Send<Fut, B, E>,
2253 crate::__combinators::Json<B, E, crate::__types::DeleteFileResponse>,
2254 fn(
2255 http::Response<B>,
2256 ) -> crate::__combinators::Json<B, E, crate::__types::DeleteFileResponse>,
2257 >,
2258 crate::__types::DeleteFileResponse
2259);
2260#[doc = "Returns information about a specific file."]
2261pub fn retrieve_file<C, Fut, B, E>(
2262 client: C,
2263 params: &crate::__types::RetrieveFileParams,
2264) -> RetrieveFile<Fut, B, E>
2265where
2266 C: FnOnce(http::Request<String>) -> Fut,
2267 Fut: Future<Output = Result<http::Response<B>, E>>,
2268 B: http_body::Body,
2269{
2270 RetrieveFile(futures::TryFutureExt::and_then(
2271 crate::__combinators::Send::new(
2272 client,
2273 || {
2274 let path = {
2275 #[serde_with::serde_as]
2276 #[derive(serde :: Serialize)]
2277 struct Query<'a> {
2278 #[serde(skip_serializing)]
2279 _phantom: std::marker::PhantomData<&'a ()>,
2280 }
2281 #[allow(clippy::useless_format)]
2282 let mut path = format!("/files/{file_id}", file_id = params.file_id);
2283 let crate::__types::RetrieveFileParams { .. } = params;
2284 let query = serde_urlencoded::to_string(Query {
2285 _phantom: std::marker::PhantomData,
2286 })?;
2287 if !query.is_empty() {
2288 path.push('?');
2289 path.push_str(&query);
2290 }
2291 path
2292 };
2293 let body = String::new();
2294 Ok(http::Request::builder()
2295 .method(http::Method::GET)
2296 .uri(path)
2297 .header(http::header::CONTENT_LENGTH, body.len())
2298 .body(body)?)
2299 },
2300 (
2301 http::StatusCode::from_u16(200u16).unwrap(),
2302 Some(mime::APPLICATION_JSON),
2303 ),
2304 ),
2305 crate::__combinators::Json::new,
2306 ))
2307}
2308future!(
2309 RetrieveFile,
2310 futures::future::AndThen<
2311 crate::__combinators::Send<Fut, B, E>,
2312 crate::__combinators::Json<B, E, crate::__types::OpenAiFile>,
2313 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::OpenAiFile>,
2314 >,
2315 crate::__types::OpenAiFile
2316);
2317#[doc = "Returns the contents of the specified file."]
2318pub fn download_file<C, Fut, B, E>(
2319 client: C,
2320 params: &crate::__types::DownloadFileParams,
2321) -> DownloadFile<Fut, B, E>
2322where
2323 C: FnOnce(http::Request<String>) -> Fut,
2324 Fut: Future<Output = Result<http::Response<B>, E>>,
2325 B: http_body::Body,
2326{
2327 DownloadFile(futures::TryFutureExt::and_then(
2328 crate::__combinators::Send::new(
2329 client,
2330 || {
2331 let path = {
2332 #[serde_with::serde_as]
2333 #[derive(serde :: Serialize)]
2334 struct Query<'a> {
2335 #[serde(skip_serializing)]
2336 _phantom: std::marker::PhantomData<&'a ()>,
2337 }
2338 #[allow(clippy::useless_format)]
2339 let mut path = format!("/files/{file_id}/content", file_id = params.file_id);
2340 let crate::__types::DownloadFileParams { .. } = params;
2341 let query = serde_urlencoded::to_string(Query {
2342 _phantom: std::marker::PhantomData,
2343 })?;
2344 if !query.is_empty() {
2345 path.push('?');
2346 path.push_str(&query);
2347 }
2348 path
2349 };
2350 let body = String::new();
2351 Ok(http::Request::builder()
2352 .method(http::Method::GET)
2353 .uri(path)
2354 .header(http::header::CONTENT_LENGTH, body.len())
2355 .body(body)?)
2356 },
2357 (
2358 http::StatusCode::from_u16(200u16).unwrap(),
2359 Some(mime::APPLICATION_JSON),
2360 ),
2361 ),
2362 crate::__combinators::Json::new,
2363 ))
2364}
2365future!(
2366 DownloadFile,
2367 futures::future::AndThen<
2368 crate::__combinators::Send<Fut, B, E>,
2369 crate::__combinators::Json<B, E, String>,
2370 fn(http::Response<B>) -> crate::__combinators::Json<B, E, String>,
2371 >,
2372 String
2373);
2374#[doc = "Run a grader.\n"]
2375pub fn run_grader<C, Fut, B, E>(
2376 client: C,
2377 request: &crate::__types::RunGraderRequest,
2378) -> RunGrader<Fut, B, E>
2379where
2380 C: FnOnce(http::Request<String>) -> Fut,
2381 Fut: Future<Output = Result<http::Response<B>, E>>,
2382 B: http_body::Body,
2383{
2384 RunGrader(futures::TryFutureExt::and_then(
2385 crate::__combinators::Send::new(
2386 client,
2387 || {
2388 let path = "/fine_tuning/alpha/graders/run";
2389 let body = serde_json::to_string(request)?;
2390 Ok(http::Request::builder()
2391 .method(http::Method::POST)
2392 .uri(path)
2393 .header(http::header::CONTENT_LENGTH, body.len())
2394 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
2395 .body(body)?)
2396 },
2397 (
2398 http::StatusCode::from_u16(200u16).unwrap(),
2399 Some(mime::APPLICATION_JSON),
2400 ),
2401 ),
2402 crate::__combinators::Json::new,
2403 ))
2404}
2405future!(
2406 RunGrader,
2407 futures::future::AndThen<
2408 crate::__combinators::Send<Fut, B, E>,
2409 crate::__combinators::Json<B, E, crate::__types::RunGraderResponse>,
2410 fn(
2411 http::Response<B>,
2412 ) -> crate::__combinators::Json<B, E, crate::__types::RunGraderResponse>,
2413 >,
2414 crate::__types::RunGraderResponse
2415);
2416#[doc = "Validate a grader.\n"]
2417pub fn validate_grader<C, Fut, B, E>(
2418 client: C,
2419 request: &crate::__types::ValidateGraderRequest,
2420) -> ValidateGrader<Fut, B, E>
2421where
2422 C: FnOnce(http::Request<String>) -> Fut,
2423 Fut: Future<Output = Result<http::Response<B>, E>>,
2424 B: http_body::Body,
2425{
2426 ValidateGrader(futures::TryFutureExt::and_then(
2427 crate::__combinators::Send::new(
2428 client,
2429 || {
2430 let path = "/fine_tuning/alpha/graders/validate";
2431 let body = serde_json::to_string(request)?;
2432 Ok(http::Request::builder()
2433 .method(http::Method::POST)
2434 .uri(path)
2435 .header(http::header::CONTENT_LENGTH, body.len())
2436 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
2437 .body(body)?)
2438 },
2439 (
2440 http::StatusCode::from_u16(200u16).unwrap(),
2441 Some(mime::APPLICATION_JSON),
2442 ),
2443 ),
2444 crate::__combinators::Json::new,
2445 ))
2446}
2447future!(
2448 ValidateGrader,
2449 futures::future::AndThen<
2450 crate::__combinators::Send<Fut, B, E>,
2451 crate::__combinators::Json<B, E, crate::__types::ValidateGraderResponse>,
2452 fn(
2453 http::Response<B>,
2454 ) -> crate::__combinators::Json<B, E, crate::__types::ValidateGraderResponse>,
2455 >,
2456 crate::__types::ValidateGraderResponse
2457);
2458#[doc = "**NOTE:** This endpoint requires an [admin API key](../admin-api-keys).\n\nOrganization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint.\n"]
2459pub fn list_fine_tuning_checkpoint_permissions<C, Fut, B, E>(
2460 client: C,
2461 params: &crate::__types::ListFineTuningCheckpointPermissionsParams,
2462) -> ListFineTuningCheckpointPermissions<Fut, B, E>
2463where
2464 C: FnOnce(http::Request<String>) -> Fut,
2465 Fut: Future<Output = Result<http::Response<B>, E>>,
2466 B: http_body::Body,
2467{
2468 ListFineTuningCheckpointPermissions(futures::TryFutureExt::and_then(
2469 crate::__combinators::Send::new(
2470 client,
2471 || {
2472 let path = {
2473 #[serde_with::serde_as]
2474 #[derive(serde :: Serialize)]
2475 struct Query<'a> {
2476 #[serde(rename = "project_id")]
2477 #[serde(skip_serializing_if = "Option::is_none")]
2478 project_id: &'a Option<String>,
2479 #[serde(rename = "after")]
2480 #[serde(skip_serializing_if = "Option::is_none")]
2481 after: &'a Option<String>,
2482 #[serde(rename = "limit")]
2483 #[serde(skip_serializing_if = "Option::is_none")]
2484 limit: &'a Option<i64>,
2485 #[serde(rename = "order")]
2486 #[serde(skip_serializing_if = "Option::is_none")]
2487 order: &'a Option<
2488 crate::__types::ListFineTuningCheckpointPermissionsParamsOrder,
2489 >,
2490 #[serde(skip_serializing)]
2491 _phantom: std::marker::PhantomData<&'a ()>,
2492 }
2493 #[allow(clippy::useless_format)]
2494 let mut path = format!(
2495 "/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions",
2496 fine_tuned_model_checkpoint = params.fine_tuned_model_checkpoint
2497 );
2498 let crate::__types::ListFineTuningCheckpointPermissionsParams {
2499 project_id,
2500 after,
2501 limit,
2502 order,
2503 ..
2504 } = params;
2505 let query = serde_urlencoded::to_string(Query {
2506 project_id,
2507 after,
2508 limit,
2509 order,
2510 _phantom: std::marker::PhantomData,
2511 })?;
2512 if !query.is_empty() {
2513 path.push('?');
2514 path.push_str(&query);
2515 }
2516 path
2517 };
2518 let body = String::new();
2519 Ok(http::Request::builder()
2520 .method(http::Method::GET)
2521 .uri(path)
2522 .header(http::header::CONTENT_LENGTH, body.len())
2523 .body(body)?)
2524 },
2525 (
2526 http::StatusCode::from_u16(200u16).unwrap(),
2527 Some(mime::APPLICATION_JSON),
2528 ),
2529 ),
2530 crate::__combinators::Json::new,
2531 ))
2532}
2533future!(
2534 ListFineTuningCheckpointPermissions,
2535 futures::future::AndThen<
2536 crate::__combinators::Send<Fut, B, E>,
2537 crate::__combinators::Json<
2538 B,
2539 E,
2540 crate::__types::ListFineTuningCheckpointPermissionResponse,
2541 >,
2542 fn(
2543 http::Response<B>,
2544 ) -> crate::__combinators::Json<
2545 B,
2546 E,
2547 crate::__types::ListFineTuningCheckpointPermissionResponse,
2548 >,
2549 >,
2550 crate::__types::ListFineTuningCheckpointPermissionResponse
2551);
2552#[doc = "**NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).\n\nThis enables organization owners to share fine-tuned models with other projects in their organization.\n"]
2553pub fn create_fine_tuning_checkpoint_permission<C, Fut, B, E>(
2554 client: C,
2555 params: &crate::__types::CreateFineTuningCheckpointPermissionParams,
2556 request: &crate::__types::CreateFineTuningCheckpointPermissionRequest,
2557) -> CreateFineTuningCheckpointPermission<Fut, B, E>
2558where
2559 C: FnOnce(http::Request<String>) -> Fut,
2560 Fut: Future<Output = Result<http::Response<B>, E>>,
2561 B: http_body::Body,
2562{
2563 CreateFineTuningCheckpointPermission(futures::TryFutureExt::and_then(
2564 crate::__combinators::Send::new(
2565 client,
2566 || {
2567 let path = {
2568 #[serde_with::serde_as]
2569 #[derive(serde :: Serialize)]
2570 struct Query<'a> {
2571 #[serde(skip_serializing)]
2572 _phantom: std::marker::PhantomData<&'a ()>,
2573 }
2574 #[allow(clippy::useless_format)]
2575 let mut path = format!(
2576 "/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions",
2577 fine_tuned_model_checkpoint = params.fine_tuned_model_checkpoint
2578 );
2579 let crate::__types::CreateFineTuningCheckpointPermissionParams { .. } = params;
2580 let query = serde_urlencoded::to_string(Query {
2581 _phantom: std::marker::PhantomData,
2582 })?;
2583 if !query.is_empty() {
2584 path.push('?');
2585 path.push_str(&query);
2586 }
2587 path
2588 };
2589 let body = serde_json::to_string(request)?;
2590 Ok(http::Request::builder()
2591 .method(http::Method::POST)
2592 .uri(path)
2593 .header(http::header::CONTENT_LENGTH, body.len())
2594 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
2595 .body(body)?)
2596 },
2597 (
2598 http::StatusCode::from_u16(200u16).unwrap(),
2599 Some(mime::APPLICATION_JSON),
2600 ),
2601 ),
2602 crate::__combinators::Json::new,
2603 ))
2604}
2605future!(
2606 CreateFineTuningCheckpointPermission,
2607 futures::future::AndThen<
2608 crate::__combinators::Send<Fut, B, E>,
2609 crate::__combinators::Json<
2610 B,
2611 E,
2612 crate::__types::ListFineTuningCheckpointPermissionResponse,
2613 >,
2614 fn(
2615 http::Response<B>,
2616 ) -> crate::__combinators::Json<
2617 B,
2618 E,
2619 crate::__types::ListFineTuningCheckpointPermissionResponse,
2620 >,
2621 >,
2622 crate::__types::ListFineTuningCheckpointPermissionResponse
2623);
2624#[doc = "**NOTE:** This endpoint requires an [admin API key](../admin-api-keys).\n\nOrganization owners can use this endpoint to delete a permission for a fine-tuned model checkpoint.\n"]
2625pub fn delete_fine_tuning_checkpoint_permission<C, Fut, B, E>(
2626 client: C,
2627 params: &crate::__types::DeleteFineTuningCheckpointPermissionParams,
2628) -> DeleteFineTuningCheckpointPermission<Fut, B, E>
2629where
2630 C: FnOnce(http::Request<String>) -> Fut,
2631 Fut: Future<Output = Result<http::Response<B>, E>>,
2632 B: http_body::Body,
2633{
2634 DeleteFineTuningCheckpointPermission(futures::TryFutureExt::and_then(
2635 crate::__combinators::Send::new(
2636 client,
2637 || {
2638 let path = {
2639 #[serde_with::serde_as]
2640 #[derive(serde :: Serialize)]
2641 struct Query<'a> {
2642 #[serde(skip_serializing)]
2643 _phantom: std::marker::PhantomData<&'a ()>,
2644 }
2645 #[allow(clippy::useless_format)]
2646 let mut path = format!(
2647 "/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}",
2648 fine_tuned_model_checkpoint = params.fine_tuned_model_checkpoint,
2649 permission_id = params.permission_id
2650 );
2651 let crate::__types::DeleteFineTuningCheckpointPermissionParams { .. } = params;
2652 let query = serde_urlencoded::to_string(Query {
2653 _phantom: std::marker::PhantomData,
2654 })?;
2655 if !query.is_empty() {
2656 path.push('?');
2657 path.push_str(&query);
2658 }
2659 path
2660 };
2661 let body = String::new();
2662 Ok(http::Request::builder()
2663 .method(http::Method::DELETE)
2664 .uri(path)
2665 .header(http::header::CONTENT_LENGTH, body.len())
2666 .body(body)?)
2667 },
2668 (
2669 http::StatusCode::from_u16(200u16).unwrap(),
2670 Some(mime::APPLICATION_JSON),
2671 ),
2672 ),
2673 crate::__combinators::Json::new,
2674 ))
2675}
2676future!(
2677 DeleteFineTuningCheckpointPermission,
2678 futures::future::AndThen<
2679 crate::__combinators::Send<Fut, B, E>,
2680 crate::__combinators::Json<
2681 B,
2682 E,
2683 crate::__types::DeleteFineTuningCheckpointPermissionResponse,
2684 >,
2685 fn(
2686 http::Response<B>,
2687 ) -> crate::__combinators::Json<
2688 B,
2689 E,
2690 crate::__types::DeleteFineTuningCheckpointPermissionResponse,
2691 >,
2692 >,
2693 crate::__types::DeleteFineTuningCheckpointPermissionResponse
2694);
2695#[doc = "Creates a fine-tuning job which begins the process of creating a new model from a given dataset.\n\nResponse includes details of the enqueued job including job status and the name of the fine-tuned models once complete.\n\n[Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization)\n"]
2696pub fn create_fine_tuning_job<C, Fut, B, E>(
2697 client: C,
2698 request: &crate::__types::CreateFineTuningJobRequest,
2699) -> CreateFineTuningJob<Fut, B, E>
2700where
2701 C: FnOnce(http::Request<String>) -> Fut,
2702 Fut: Future<Output = Result<http::Response<B>, E>>,
2703 B: http_body::Body,
2704{
2705 CreateFineTuningJob(futures::TryFutureExt::and_then(
2706 crate::__combinators::Send::new(
2707 client,
2708 || {
2709 let path = "/fine_tuning/jobs";
2710 let body = serde_json::to_string(request)?;
2711 Ok(http::Request::builder()
2712 .method(http::Method::POST)
2713 .uri(path)
2714 .header(http::header::CONTENT_LENGTH, body.len())
2715 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
2716 .body(body)?)
2717 },
2718 (
2719 http::StatusCode::from_u16(200u16).unwrap(),
2720 Some(mime::APPLICATION_JSON),
2721 ),
2722 ),
2723 crate::__combinators::Json::new,
2724 ))
2725}
2726future!(
2727 CreateFineTuningJob,
2728 futures::future::AndThen<
2729 crate::__combinators::Send<Fut, B, E>,
2730 crate::__combinators::Json<B, E, crate::__types::FineTuningJob>,
2731 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::FineTuningJob>,
2732 >,
2733 crate::__types::FineTuningJob
2734);
2735#[doc = "List your organization's fine-tuning jobs\n"]
2736pub fn list_paginated_fine_tuning_jobs<C, Fut, B, E>(
2737 client: C,
2738 params: &crate::__types::ListPaginatedFineTuningJobsParams,
2739) -> ListPaginatedFineTuningJobs<Fut, B, E>
2740where
2741 C: FnOnce(http::Request<String>) -> Fut,
2742 Fut: Future<Output = Result<http::Response<B>, E>>,
2743 B: http_body::Body,
2744{
2745 ListPaginatedFineTuningJobs(futures::TryFutureExt::and_then(
2746 crate::__combinators::Send::new(
2747 client,
2748 || {
2749 let path = {
2750 #[serde_with::serde_as]
2751 #[derive(serde :: Serialize)]
2752 struct Query<'a> {
2753 #[serde(rename = "after")]
2754 #[serde(skip_serializing_if = "Option::is_none")]
2755 after: &'a Option<String>,
2756 #[serde(rename = "limit")]
2757 #[serde(skip_serializing_if = "Option::is_none")]
2758 limit: &'a Option<i64>,
2759 #[serde(rename = "metadata")]
2760 #[serde(skip_serializing_if = "Option::is_none")]
2761 metadata: &'a Option<indexmap::IndexMap<String, String>>,
2762 #[serde(skip_serializing)]
2763 _phantom: std::marker::PhantomData<&'a ()>,
2764 }
2765 #[allow(clippy::useless_format)]
2766 let mut path = format!("/fine_tuning/jobs",);
2767 let crate::__types::ListPaginatedFineTuningJobsParams {
2768 after,
2769 limit,
2770 metadata,
2771 ..
2772 } = params;
2773 let query = serde_urlencoded::to_string(Query {
2774 after,
2775 limit,
2776 metadata,
2777 _phantom: std::marker::PhantomData,
2778 })?;
2779 if !query.is_empty() {
2780 path.push('?');
2781 path.push_str(&query);
2782 }
2783 path
2784 };
2785 let body = String::new();
2786 Ok(http::Request::builder()
2787 .method(http::Method::GET)
2788 .uri(path)
2789 .header(http::header::CONTENT_LENGTH, body.len())
2790 .body(body)?)
2791 },
2792 (
2793 http::StatusCode::from_u16(200u16).unwrap(),
2794 Some(mime::APPLICATION_JSON),
2795 ),
2796 ),
2797 crate::__combinators::Json::new,
2798 ))
2799}
2800future!(
2801 ListPaginatedFineTuningJobs,
2802 futures::future::AndThen<
2803 crate::__combinators::Send<Fut, B, E>,
2804 crate::__combinators::Json<B, E, crate::__types::ListPaginatedFineTuningJobsResponse>,
2805 fn(
2806 http::Response<B>,
2807 )
2808 -> crate::__combinators::Json<B, E, crate::__types::ListPaginatedFineTuningJobsResponse>,
2809 >,
2810 crate::__types::ListPaginatedFineTuningJobsResponse
2811);
2812#[doc = "Get info about a fine-tuning job.\n\n[Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization)\n"]
2813pub fn retrieve_fine_tuning_job<C, Fut, B, E>(
2814 client: C,
2815 params: &crate::__types::RetrieveFineTuningJobParams,
2816) -> RetrieveFineTuningJob<Fut, B, E>
2817where
2818 C: FnOnce(http::Request<String>) -> Fut,
2819 Fut: Future<Output = Result<http::Response<B>, E>>,
2820 B: http_body::Body,
2821{
2822 RetrieveFineTuningJob(futures::TryFutureExt::and_then(
2823 crate::__combinators::Send::new(
2824 client,
2825 || {
2826 let path = {
2827 #[serde_with::serde_as]
2828 #[derive(serde :: Serialize)]
2829 struct Query<'a> {
2830 #[serde(skip_serializing)]
2831 _phantom: std::marker::PhantomData<&'a ()>,
2832 }
2833 #[allow(clippy::useless_format)]
2834 let mut path = format!(
2835 "/fine_tuning/jobs/{fine_tuning_job_id}",
2836 fine_tuning_job_id = params.fine_tuning_job_id
2837 );
2838 let crate::__types::RetrieveFineTuningJobParams { .. } = params;
2839 let query = serde_urlencoded::to_string(Query {
2840 _phantom: std::marker::PhantomData,
2841 })?;
2842 if !query.is_empty() {
2843 path.push('?');
2844 path.push_str(&query);
2845 }
2846 path
2847 };
2848 let body = String::new();
2849 Ok(http::Request::builder()
2850 .method(http::Method::GET)
2851 .uri(path)
2852 .header(http::header::CONTENT_LENGTH, body.len())
2853 .body(body)?)
2854 },
2855 (
2856 http::StatusCode::from_u16(200u16).unwrap(),
2857 Some(mime::APPLICATION_JSON),
2858 ),
2859 ),
2860 crate::__combinators::Json::new,
2861 ))
2862}
2863future!(
2864 RetrieveFineTuningJob,
2865 futures::future::AndThen<
2866 crate::__combinators::Send<Fut, B, E>,
2867 crate::__combinators::Json<B, E, crate::__types::FineTuningJob>,
2868 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::FineTuningJob>,
2869 >,
2870 crate::__types::FineTuningJob
2871);
2872#[doc = "Immediately cancel a fine-tune job.\n"]
2873pub fn cancel_fine_tuning_job<C, Fut, B, E>(
2874 client: C,
2875 params: &crate::__types::CancelFineTuningJobParams,
2876) -> CancelFineTuningJob<Fut, B, E>
2877where
2878 C: FnOnce(http::Request<String>) -> Fut,
2879 Fut: Future<Output = Result<http::Response<B>, E>>,
2880 B: http_body::Body,
2881{
2882 CancelFineTuningJob(futures::TryFutureExt::and_then(
2883 crate::__combinators::Send::new(
2884 client,
2885 || {
2886 let path = {
2887 #[serde_with::serde_as]
2888 #[derive(serde :: Serialize)]
2889 struct Query<'a> {
2890 #[serde(skip_serializing)]
2891 _phantom: std::marker::PhantomData<&'a ()>,
2892 }
2893 #[allow(clippy::useless_format)]
2894 let mut path = format!(
2895 "/fine_tuning/jobs/{fine_tuning_job_id}/cancel",
2896 fine_tuning_job_id = params.fine_tuning_job_id
2897 );
2898 let crate::__types::CancelFineTuningJobParams { .. } = params;
2899 let query = serde_urlencoded::to_string(Query {
2900 _phantom: std::marker::PhantomData,
2901 })?;
2902 if !query.is_empty() {
2903 path.push('?');
2904 path.push_str(&query);
2905 }
2906 path
2907 };
2908 let body = String::new();
2909 Ok(http::Request::builder()
2910 .method(http::Method::POST)
2911 .uri(path)
2912 .header(http::header::CONTENT_LENGTH, body.len())
2913 .body(body)?)
2914 },
2915 (
2916 http::StatusCode::from_u16(200u16).unwrap(),
2917 Some(mime::APPLICATION_JSON),
2918 ),
2919 ),
2920 crate::__combinators::Json::new,
2921 ))
2922}
2923future!(
2924 CancelFineTuningJob,
2925 futures::future::AndThen<
2926 crate::__combinators::Send<Fut, B, E>,
2927 crate::__combinators::Json<B, E, crate::__types::FineTuningJob>,
2928 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::FineTuningJob>,
2929 >,
2930 crate::__types::FineTuningJob
2931);
2932#[doc = "List checkpoints for a fine-tuning job.\n"]
2933pub fn list_fine_tuning_job_checkpoints<C, Fut, B, E>(
2934 client: C,
2935 params: &crate::__types::ListFineTuningJobCheckpointsParams,
2936) -> ListFineTuningJobCheckpoints<Fut, B, E>
2937where
2938 C: FnOnce(http::Request<String>) -> Fut,
2939 Fut: Future<Output = Result<http::Response<B>, E>>,
2940 B: http_body::Body,
2941{
2942 ListFineTuningJobCheckpoints(futures::TryFutureExt::and_then(
2943 crate::__combinators::Send::new(
2944 client,
2945 || {
2946 let path = {
2947 #[serde_with::serde_as]
2948 #[derive(serde :: Serialize)]
2949 struct Query<'a> {
2950 #[serde(rename = "after")]
2951 #[serde(skip_serializing_if = "Option::is_none")]
2952 after: &'a Option<String>,
2953 #[serde(rename = "limit")]
2954 #[serde(skip_serializing_if = "Option::is_none")]
2955 limit: &'a Option<i64>,
2956 #[serde(skip_serializing)]
2957 _phantom: std::marker::PhantomData<&'a ()>,
2958 }
2959 #[allow(clippy::useless_format)]
2960 let mut path = format!(
2961 "/fine_tuning/jobs/{fine_tuning_job_id}/checkpoints",
2962 fine_tuning_job_id = params.fine_tuning_job_id
2963 );
2964 let crate::__types::ListFineTuningJobCheckpointsParams { after, limit, .. } =
2965 params;
2966 let query = serde_urlencoded::to_string(Query {
2967 after,
2968 limit,
2969 _phantom: std::marker::PhantomData,
2970 })?;
2971 if !query.is_empty() {
2972 path.push('?');
2973 path.push_str(&query);
2974 }
2975 path
2976 };
2977 let body = String::new();
2978 Ok(http::Request::builder()
2979 .method(http::Method::GET)
2980 .uri(path)
2981 .header(http::header::CONTENT_LENGTH, body.len())
2982 .body(body)?)
2983 },
2984 (
2985 http::StatusCode::from_u16(200u16).unwrap(),
2986 Some(mime::APPLICATION_JSON),
2987 ),
2988 ),
2989 crate::__combinators::Json::new,
2990 ))
2991}
2992future!(
2993 ListFineTuningJobCheckpoints,
2994 futures::future::AndThen<
2995 crate::__combinators::Send<Fut, B, E>,
2996 crate::__combinators::Json<B, E, crate::__types::ListFineTuningJobCheckpointsResponse>,
2997 fn(
2998 http::Response<B>,
2999 ) -> crate::__combinators::Json<
3000 B,
3001 E,
3002 crate::__types::ListFineTuningJobCheckpointsResponse,
3003 >,
3004 >,
3005 crate::__types::ListFineTuningJobCheckpointsResponse
3006);
3007#[doc = "Get status updates for a fine-tuning job.\n"]
3008pub fn list_fine_tuning_events<C, Fut, B, E>(
3009 client: C,
3010 params: &crate::__types::ListFineTuningEventsParams,
3011) -> ListFineTuningEvents<Fut, B, E>
3012where
3013 C: FnOnce(http::Request<String>) -> Fut,
3014 Fut: Future<Output = Result<http::Response<B>, E>>,
3015 B: http_body::Body,
3016{
3017 ListFineTuningEvents(futures::TryFutureExt::and_then(
3018 crate::__combinators::Send::new(
3019 client,
3020 || {
3021 let path = {
3022 #[serde_with::serde_as]
3023 #[derive(serde :: Serialize)]
3024 struct Query<'a> {
3025 #[serde(rename = "after")]
3026 #[serde(skip_serializing_if = "Option::is_none")]
3027 after: &'a Option<String>,
3028 #[serde(rename = "limit")]
3029 #[serde(skip_serializing_if = "Option::is_none")]
3030 limit: &'a Option<i64>,
3031 #[serde(skip_serializing)]
3032 _phantom: std::marker::PhantomData<&'a ()>,
3033 }
3034 #[allow(clippy::useless_format)]
3035 let mut path = format!(
3036 "/fine_tuning/jobs/{fine_tuning_job_id}/events",
3037 fine_tuning_job_id = params.fine_tuning_job_id
3038 );
3039 let crate::__types::ListFineTuningEventsParams { after, limit, .. } = params;
3040 let query = serde_urlencoded::to_string(Query {
3041 after,
3042 limit,
3043 _phantom: std::marker::PhantomData,
3044 })?;
3045 if !query.is_empty() {
3046 path.push('?');
3047 path.push_str(&query);
3048 }
3049 path
3050 };
3051 let body = String::new();
3052 Ok(http::Request::builder()
3053 .method(http::Method::GET)
3054 .uri(path)
3055 .header(http::header::CONTENT_LENGTH, body.len())
3056 .body(body)?)
3057 },
3058 (
3059 http::StatusCode::from_u16(200u16).unwrap(),
3060 Some(mime::APPLICATION_JSON),
3061 ),
3062 ),
3063 crate::__combinators::Json::new,
3064 ))
3065}
3066future!(
3067 ListFineTuningEvents,
3068 futures::future::AndThen<
3069 crate::__combinators::Send<Fut, B, E>,
3070 crate::__combinators::Json<B, E, crate::__types::ListFineTuningJobEventsResponse>,
3071 fn(
3072 http::Response<B>,
3073 )
3074 -> crate::__combinators::Json<B, E, crate::__types::ListFineTuningJobEventsResponse>,
3075 >,
3076 crate::__types::ListFineTuningJobEventsResponse
3077);
3078#[doc = "Pause a fine-tune job.\n"]
3079pub fn pause_fine_tuning_job<C, Fut, B, E>(
3080 client: C,
3081 params: &crate::__types::PauseFineTuningJobParams,
3082) -> PauseFineTuningJob<Fut, B, E>
3083where
3084 C: FnOnce(http::Request<String>) -> Fut,
3085 Fut: Future<Output = Result<http::Response<B>, E>>,
3086 B: http_body::Body,
3087{
3088 PauseFineTuningJob(futures::TryFutureExt::and_then(
3089 crate::__combinators::Send::new(
3090 client,
3091 || {
3092 let path = {
3093 #[serde_with::serde_as]
3094 #[derive(serde :: Serialize)]
3095 struct Query<'a> {
3096 #[serde(skip_serializing)]
3097 _phantom: std::marker::PhantomData<&'a ()>,
3098 }
3099 #[allow(clippy::useless_format)]
3100 let mut path = format!(
3101 "/fine_tuning/jobs/{fine_tuning_job_id}/pause",
3102 fine_tuning_job_id = params.fine_tuning_job_id
3103 );
3104 let crate::__types::PauseFineTuningJobParams { .. } = params;
3105 let query = serde_urlencoded::to_string(Query {
3106 _phantom: std::marker::PhantomData,
3107 })?;
3108 if !query.is_empty() {
3109 path.push('?');
3110 path.push_str(&query);
3111 }
3112 path
3113 };
3114 let body = String::new();
3115 Ok(http::Request::builder()
3116 .method(http::Method::POST)
3117 .uri(path)
3118 .header(http::header::CONTENT_LENGTH, body.len())
3119 .body(body)?)
3120 },
3121 (
3122 http::StatusCode::from_u16(200u16).unwrap(),
3123 Some(mime::APPLICATION_JSON),
3124 ),
3125 ),
3126 crate::__combinators::Json::new,
3127 ))
3128}
3129future!(
3130 PauseFineTuningJob,
3131 futures::future::AndThen<
3132 crate::__combinators::Send<Fut, B, E>,
3133 crate::__combinators::Json<B, E, crate::__types::FineTuningJob>,
3134 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::FineTuningJob>,
3135 >,
3136 crate::__types::FineTuningJob
3137);
3138#[doc = "Resume a fine-tune job.\n"]
3139pub fn resume_fine_tuning_job<C, Fut, B, E>(
3140 client: C,
3141 params: &crate::__types::ResumeFineTuningJobParams,
3142) -> ResumeFineTuningJob<Fut, B, E>
3143where
3144 C: FnOnce(http::Request<String>) -> Fut,
3145 Fut: Future<Output = Result<http::Response<B>, E>>,
3146 B: http_body::Body,
3147{
3148 ResumeFineTuningJob(futures::TryFutureExt::and_then(
3149 crate::__combinators::Send::new(
3150 client,
3151 || {
3152 let path = {
3153 #[serde_with::serde_as]
3154 #[derive(serde :: Serialize)]
3155 struct Query<'a> {
3156 #[serde(skip_serializing)]
3157 _phantom: std::marker::PhantomData<&'a ()>,
3158 }
3159 #[allow(clippy::useless_format)]
3160 let mut path = format!(
3161 "/fine_tuning/jobs/{fine_tuning_job_id}/resume",
3162 fine_tuning_job_id = params.fine_tuning_job_id
3163 );
3164 let crate::__types::ResumeFineTuningJobParams { .. } = params;
3165 let query = serde_urlencoded::to_string(Query {
3166 _phantom: std::marker::PhantomData,
3167 })?;
3168 if !query.is_empty() {
3169 path.push('?');
3170 path.push_str(&query);
3171 }
3172 path
3173 };
3174 let body = String::new();
3175 Ok(http::Request::builder()
3176 .method(http::Method::POST)
3177 .uri(path)
3178 .header(http::header::CONTENT_LENGTH, body.len())
3179 .body(body)?)
3180 },
3181 (
3182 http::StatusCode::from_u16(200u16).unwrap(),
3183 Some(mime::APPLICATION_JSON),
3184 ),
3185 ),
3186 crate::__combinators::Json::new,
3187 ))
3188}
3189future!(
3190 ResumeFineTuningJob,
3191 futures::future::AndThen<
3192 crate::__combinators::Send<Fut, B, E>,
3193 crate::__combinators::Json<B, E, crate::__types::FineTuningJob>,
3194 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::FineTuningJob>,
3195 >,
3196 crate::__types::FineTuningJob
3197);
3198#[doc = "Creates an image given a prompt. [Learn more](https://platform.openai.com/docs/guides/images).\n"]
3199pub fn create_image<C, Fut, B, E>(
3200 client: C,
3201 request: &crate::__types::CreateImageRequest,
3202) -> CreateImage<Fut, B, E>
3203where
3204 C: FnOnce(http::Request<String>) -> Fut,
3205 Fut: Future<Output = Result<http::Response<B>, E>>,
3206 B: http_body::Body,
3207{
3208 CreateImage(futures::TryFutureExt::and_then(
3209 crate::__combinators::Send::new(
3210 client,
3211 || {
3212 let path = "/images/generations";
3213 let body = serde_json::to_string(request)?;
3214 Ok(http::Request::builder()
3215 .method(http::Method::POST)
3216 .uri(path)
3217 .header(http::header::CONTENT_LENGTH, body.len())
3218 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
3219 .body(body)?)
3220 },
3221 (
3222 http::StatusCode::from_u16(200u16).unwrap(),
3223 Some(mime::APPLICATION_JSON),
3224 ),
3225 ),
3226 crate::__combinators::Json::new,
3227 ))
3228}
3229future!(
3230 CreateImage,
3231 futures::future::AndThen<
3232 crate::__combinators::Send<Fut, B, E>,
3233 crate::__combinators::Json<B, E, crate::__types::ImagesResponse>,
3234 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::ImagesResponse>,
3235 >,
3236 crate::__types::ImagesResponse
3237);
3238#[doc = "Lists the currently available models, and provides basic information about each one such as the owner and availability."]
3239pub fn list_models<C, Fut, B, E>(client: C) -> ListModels<Fut, B, E>
3240where
3241 C: FnOnce(http::Request<String>) -> Fut,
3242 Fut: Future<Output = Result<http::Response<B>, E>>,
3243 B: http_body::Body,
3244{
3245 ListModels(futures::TryFutureExt::and_then(
3246 crate::__combinators::Send::new(
3247 client,
3248 || {
3249 let path = "/models";
3250 let body = String::new();
3251 Ok(http::Request::builder()
3252 .method(http::Method::GET)
3253 .uri(path)
3254 .header(http::header::CONTENT_LENGTH, body.len())
3255 .body(body)?)
3256 },
3257 (
3258 http::StatusCode::from_u16(200u16).unwrap(),
3259 Some(mime::APPLICATION_JSON),
3260 ),
3261 ),
3262 crate::__combinators::Json::new,
3263 ))
3264}
3265future!(
3266 ListModels,
3267 futures::future::AndThen<
3268 crate::__combinators::Send<Fut, B, E>,
3269 crate::__combinators::Json<B, E, crate::__types::ListModelsResponse>,
3270 fn(
3271 http::Response<B>,
3272 ) -> crate::__combinators::Json<B, E, crate::__types::ListModelsResponse>,
3273 >,
3274 crate::__types::ListModelsResponse
3275);
3276#[doc = "Retrieves a model instance, providing basic information about the model such as the owner and permissioning."]
3277pub fn retrieve_model<C, Fut, B, E>(
3278 client: C,
3279 params: &crate::__types::RetrieveModelParams,
3280) -> RetrieveModel<Fut, B, E>
3281where
3282 C: FnOnce(http::Request<String>) -> Fut,
3283 Fut: Future<Output = Result<http::Response<B>, E>>,
3284 B: http_body::Body,
3285{
3286 RetrieveModel(futures::TryFutureExt::and_then(
3287 crate::__combinators::Send::new(
3288 client,
3289 || {
3290 let path = {
3291 #[serde_with::serde_as]
3292 #[derive(serde :: Serialize)]
3293 struct Query<'a> {
3294 #[serde(skip_serializing)]
3295 _phantom: std::marker::PhantomData<&'a ()>,
3296 }
3297 #[allow(clippy::useless_format)]
3298 let mut path = format!("/models/{model}", model = params.model);
3299 let crate::__types::RetrieveModelParams { .. } = params;
3300 let query = serde_urlencoded::to_string(Query {
3301 _phantom: std::marker::PhantomData,
3302 })?;
3303 if !query.is_empty() {
3304 path.push('?');
3305 path.push_str(&query);
3306 }
3307 path
3308 };
3309 let body = String::new();
3310 Ok(http::Request::builder()
3311 .method(http::Method::GET)
3312 .uri(path)
3313 .header(http::header::CONTENT_LENGTH, body.len())
3314 .body(body)?)
3315 },
3316 (
3317 http::StatusCode::from_u16(200u16).unwrap(),
3318 Some(mime::APPLICATION_JSON),
3319 ),
3320 ),
3321 crate::__combinators::Json::new,
3322 ))
3323}
3324future!(
3325 RetrieveModel,
3326 futures::future::AndThen<
3327 crate::__combinators::Send<Fut, B, E>,
3328 crate::__combinators::Json<B, E, crate::__types::Model>,
3329 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Model>,
3330 >,
3331 crate::__types::Model
3332);
3333#[doc = "Delete a fine-tuned model. You must have the Owner role in your organization to delete a model."]
3334pub fn delete_model<C, Fut, B, E>(
3335 client: C,
3336 params: &crate::__types::DeleteModelParams,
3337) -> DeleteModel<Fut, B, E>
3338where
3339 C: FnOnce(http::Request<String>) -> Fut,
3340 Fut: Future<Output = Result<http::Response<B>, E>>,
3341 B: http_body::Body,
3342{
3343 DeleteModel(futures::TryFutureExt::and_then(
3344 crate::__combinators::Send::new(
3345 client,
3346 || {
3347 let path = {
3348 #[serde_with::serde_as]
3349 #[derive(serde :: Serialize)]
3350 struct Query<'a> {
3351 #[serde(skip_serializing)]
3352 _phantom: std::marker::PhantomData<&'a ()>,
3353 }
3354 #[allow(clippy::useless_format)]
3355 let mut path = format!("/models/{model}", model = params.model);
3356 let crate::__types::DeleteModelParams { .. } = params;
3357 let query = serde_urlencoded::to_string(Query {
3358 _phantom: std::marker::PhantomData,
3359 })?;
3360 if !query.is_empty() {
3361 path.push('?');
3362 path.push_str(&query);
3363 }
3364 path
3365 };
3366 let body = String::new();
3367 Ok(http::Request::builder()
3368 .method(http::Method::DELETE)
3369 .uri(path)
3370 .header(http::header::CONTENT_LENGTH, body.len())
3371 .body(body)?)
3372 },
3373 (
3374 http::StatusCode::from_u16(200u16).unwrap(),
3375 Some(mime::APPLICATION_JSON),
3376 ),
3377 ),
3378 crate::__combinators::Json::new,
3379 ))
3380}
3381future!(
3382 DeleteModel,
3383 futures::future::AndThen<
3384 crate::__combinators::Send<Fut, B, E>,
3385 crate::__combinators::Json<B, E, crate::__types::DeleteModelResponse>,
3386 fn(
3387 http::Response<B>,
3388 ) -> crate::__combinators::Json<B, E, crate::__types::DeleteModelResponse>,
3389 >,
3390 crate::__types::DeleteModelResponse
3391);
3392#[doc = "Classifies if text and/or image inputs are potentially harmful. Learn\nmore in the [moderation guide](https://platform.openai.com/docs/guides/moderation).\n"]
3393pub fn create_moderation<C, Fut, B, E>(
3394 client: C,
3395 request: &crate::__types::CreateModerationRequest,
3396) -> CreateModeration<Fut, B, E>
3397where
3398 C: FnOnce(http::Request<String>) -> Fut,
3399 Fut: Future<Output = Result<http::Response<B>, E>>,
3400 B: http_body::Body,
3401{
3402 CreateModeration(futures::TryFutureExt::and_then(
3403 crate::__combinators::Send::new(
3404 client,
3405 || {
3406 let path = "/moderations";
3407 let body = serde_json::to_string(request)?;
3408 Ok(http::Request::builder()
3409 .method(http::Method::POST)
3410 .uri(path)
3411 .header(http::header::CONTENT_LENGTH, body.len())
3412 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
3413 .body(body)?)
3414 },
3415 (
3416 http::StatusCode::from_u16(200u16).unwrap(),
3417 Some(mime::APPLICATION_JSON),
3418 ),
3419 ),
3420 crate::__combinators::Json::new,
3421 ))
3422}
3423future!(
3424 CreateModeration,
3425 futures::future::AndThen<
3426 crate::__combinators::Send<Fut, B, E>,
3427 crate::__combinators::Json<B, E, crate::__types::CreateModerationResponse>,
3428 fn(
3429 http::Response<B>,
3430 ) -> crate::__combinators::Json<B, E, crate::__types::CreateModerationResponse>,
3431 >,
3432 crate::__types::CreateModerationResponse
3433);
3434#[doc = "List organization API keys"]
3435pub fn admin_api_keys_list<C, Fut, B, E>(
3436 client: C,
3437 params: &crate::__types::AdminApiKeysListParams,
3438) -> AdminApiKeysList<Fut, B, E>
3439where
3440 C: FnOnce(http::Request<String>) -> Fut,
3441 Fut: Future<Output = Result<http::Response<B>, E>>,
3442 B: http_body::Body,
3443{
3444 AdminApiKeysList(futures::TryFutureExt::and_then(
3445 crate::__combinators::Send::new(
3446 client,
3447 || {
3448 let path = {
3449 #[serde_with::serde_as]
3450 #[derive(serde :: Serialize)]
3451 struct Query<'a> {
3452 #[serde(rename = "after")]
3453 #[serde(skip_serializing_if = "Option::is_none")]
3454 after: &'a Option<String>,
3455 #[serde(rename = "order")]
3456 #[serde(skip_serializing_if = "Option::is_none")]
3457 order: &'a Option<crate::__types::AdminApiKeysListParamsOrder>,
3458 #[serde(rename = "limit")]
3459 #[serde(skip_serializing_if = "Option::is_none")]
3460 limit: &'a Option<i64>,
3461 #[serde(skip_serializing)]
3462 _phantom: std::marker::PhantomData<&'a ()>,
3463 }
3464 #[allow(clippy::useless_format)]
3465 let mut path = format!("/organization/admin_api_keys",);
3466 let crate::__types::AdminApiKeysListParams {
3467 after,
3468 order,
3469 limit,
3470 ..
3471 } = params;
3472 let query = serde_urlencoded::to_string(Query {
3473 after,
3474 order,
3475 limit,
3476 _phantom: std::marker::PhantomData,
3477 })?;
3478 if !query.is_empty() {
3479 path.push('?');
3480 path.push_str(&query);
3481 }
3482 path
3483 };
3484 let body = String::new();
3485 Ok(http::Request::builder()
3486 .method(http::Method::GET)
3487 .uri(path)
3488 .header(http::header::CONTENT_LENGTH, body.len())
3489 .body(body)?)
3490 },
3491 (
3492 http::StatusCode::from_u16(200u16).unwrap(),
3493 Some(mime::APPLICATION_JSON),
3494 ),
3495 ),
3496 crate::__combinators::Json::new,
3497 ))
3498}
3499future!(
3500 AdminApiKeysList,
3501 futures::future::AndThen<
3502 crate::__combinators::Send<Fut, B, E>,
3503 crate::__combinators::Json<B, E, crate::__types::ApiKeyList>,
3504 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::ApiKeyList>,
3505 >,
3506 crate::__types::ApiKeyList
3507);
3508#[doc = "Create an organization admin API key"]
3509pub fn admin_api_keys_create<C, Fut, B, E>(
3510 client: C,
3511 request: &crate::__types::AdminApiKeysCreateRequest,
3512) -> AdminApiKeysCreate<Fut, B, E>
3513where
3514 C: FnOnce(http::Request<String>) -> Fut,
3515 Fut: Future<Output = Result<http::Response<B>, E>>,
3516 B: http_body::Body,
3517{
3518 AdminApiKeysCreate(futures::TryFutureExt::and_then(
3519 crate::__combinators::Send::new(
3520 client,
3521 || {
3522 let path = "/organization/admin_api_keys";
3523 let body = serde_json::to_string(request)?;
3524 Ok(http::Request::builder()
3525 .method(http::Method::POST)
3526 .uri(path)
3527 .header(http::header::CONTENT_LENGTH, body.len())
3528 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
3529 .body(body)?)
3530 },
3531 (
3532 http::StatusCode::from_u16(200u16).unwrap(),
3533 Some(mime::APPLICATION_JSON),
3534 ),
3535 ),
3536 crate::__combinators::Json::new,
3537 ))
3538}
3539future!(
3540 AdminApiKeysCreate,
3541 futures::future::AndThen<
3542 crate::__combinators::Send<Fut, B, E>,
3543 crate::__combinators::Json<B, E, crate::__types::AdminApiKey>,
3544 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::AdminApiKey>,
3545 >,
3546 crate::__types::AdminApiKey
3547);
3548#[doc = "Retrieve a single organization API key"]
3549pub fn admin_api_keys_get<C, Fut, B, E>(
3550 client: C,
3551 params: &crate::__types::AdminApiKeysGetParams,
3552) -> AdminApiKeysGet<Fut, B, E>
3553where
3554 C: FnOnce(http::Request<String>) -> Fut,
3555 Fut: Future<Output = Result<http::Response<B>, E>>,
3556 B: http_body::Body,
3557{
3558 AdminApiKeysGet(futures::TryFutureExt::and_then(
3559 crate::__combinators::Send::new(
3560 client,
3561 || {
3562 let path = {
3563 #[serde_with::serde_as]
3564 #[derive(serde :: Serialize)]
3565 struct Query<'a> {
3566 #[serde(skip_serializing)]
3567 _phantom: std::marker::PhantomData<&'a ()>,
3568 }
3569 #[allow(clippy::useless_format)]
3570 let mut path = format!(
3571 "/organization/admin_api_keys/{key_id}",
3572 key_id = params.key_id
3573 );
3574 let crate::__types::AdminApiKeysGetParams { .. } = params;
3575 let query = serde_urlencoded::to_string(Query {
3576 _phantom: std::marker::PhantomData,
3577 })?;
3578 if !query.is_empty() {
3579 path.push('?');
3580 path.push_str(&query);
3581 }
3582 path
3583 };
3584 let body = String::new();
3585 Ok(http::Request::builder()
3586 .method(http::Method::GET)
3587 .uri(path)
3588 .header(http::header::CONTENT_LENGTH, body.len())
3589 .body(body)?)
3590 },
3591 (
3592 http::StatusCode::from_u16(200u16).unwrap(),
3593 Some(mime::APPLICATION_JSON),
3594 ),
3595 ),
3596 crate::__combinators::Json::new,
3597 ))
3598}
3599future!(
3600 AdminApiKeysGet,
3601 futures::future::AndThen<
3602 crate::__combinators::Send<Fut, B, E>,
3603 crate::__combinators::Json<B, E, crate::__types::AdminApiKey>,
3604 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::AdminApiKey>,
3605 >,
3606 crate::__types::AdminApiKey
3607);
3608#[doc = "Delete an organization admin API key"]
3609pub fn admin_api_keys_delete<C, Fut, B, E>(
3610 client: C,
3611 params: &crate::__types::AdminApiKeysDeleteParams,
3612) -> AdminApiKeysDelete<Fut, B, E>
3613where
3614 C: FnOnce(http::Request<String>) -> Fut,
3615 Fut: Future<Output = Result<http::Response<B>, E>>,
3616 B: http_body::Body,
3617{
3618 AdminApiKeysDelete(futures::TryFutureExt::and_then(
3619 crate::__combinators::Send::new(
3620 client,
3621 || {
3622 let path = {
3623 #[serde_with::serde_as]
3624 #[derive(serde :: Serialize)]
3625 struct Query<'a> {
3626 #[serde(skip_serializing)]
3627 _phantom: std::marker::PhantomData<&'a ()>,
3628 }
3629 #[allow(clippy::useless_format)]
3630 let mut path = format!(
3631 "/organization/admin_api_keys/{key_id}",
3632 key_id = params.key_id
3633 );
3634 let crate::__types::AdminApiKeysDeleteParams { .. } = params;
3635 let query = serde_urlencoded::to_string(Query {
3636 _phantom: std::marker::PhantomData,
3637 })?;
3638 if !query.is_empty() {
3639 path.push('?');
3640 path.push_str(&query);
3641 }
3642 path
3643 };
3644 let body = String::new();
3645 Ok(http::Request::builder()
3646 .method(http::Method::DELETE)
3647 .uri(path)
3648 .header(http::header::CONTENT_LENGTH, body.len())
3649 .body(body)?)
3650 },
3651 (
3652 http::StatusCode::from_u16(200u16).unwrap(),
3653 Some(mime::APPLICATION_JSON),
3654 ),
3655 ),
3656 crate::__combinators::Json::new,
3657 ))
3658}
3659future!(
3660 AdminApiKeysDelete,
3661 futures::future::AndThen<
3662 crate::__combinators::Send<Fut, B, E>,
3663 crate::__combinators::Json<B, E, crate::__types::AdminApiKeysDeleteResponse>,
3664 fn(
3665 http::Response<B>,
3666 ) -> crate::__combinators::Json<B, E, crate::__types::AdminApiKeysDeleteResponse>,
3667 >,
3668 crate::__types::AdminApiKeysDeleteResponse
3669);
3670#[doc = "List user actions and configuration changes within this organization."]
3671pub fn list_audit_logs<C, Fut, B, E>(
3672 client: C,
3673 params: &crate::__types::ListAuditLogsParams,
3674) -> ListAuditLogs<Fut, B, E>
3675where
3676 C: FnOnce(http::Request<String>) -> Fut,
3677 Fut: Future<Output = Result<http::Response<B>, E>>,
3678 B: http_body::Body,
3679{
3680 ListAuditLogs(futures::TryFutureExt::and_then(
3681 crate::__combinators::Send::new(
3682 client,
3683 || {
3684 let path = {
3685 #[serde_with::serde_as]
3686 #[derive(serde :: Serialize)]
3687 struct Query<'a> {
3688 #[serde(rename = "effective_at")]
3689 #[serde(skip_serializing_if = "Option::is_none")]
3690 effective_at: &'a Option<crate::__types::ListAuditLogsParamsEffectiveAt>,
3691 #[serde(rename = "project_ids[]")]
3692 #[serde(skip_serializing_if = "Option::is_none")]
3693 project_ids: &'a Option<Vec<String>>,
3694 #[serde(rename = "event_types[]")]
3695 #[serde(skip_serializing_if = "Option::is_none")]
3696 event_types: &'a Option<Vec<crate::__types::AuditLogEventType>>,
3697 #[serde(rename = "actor_ids[]")]
3698 #[serde(skip_serializing_if = "Option::is_none")]
3699 actor_ids: &'a Option<Vec<String>>,
3700 #[serde(rename = "actor_emails[]")]
3701 #[serde(skip_serializing_if = "Option::is_none")]
3702 actor_emails: &'a Option<Vec<String>>,
3703 #[serde(rename = "resource_ids[]")]
3704 #[serde(skip_serializing_if = "Option::is_none")]
3705 resource_ids: &'a Option<Vec<String>>,
3706 #[serde(rename = "limit")]
3707 #[serde(skip_serializing_if = "Option::is_none")]
3708 limit: &'a Option<i64>,
3709 #[serde(rename = "after")]
3710 #[serde(skip_serializing_if = "Option::is_none")]
3711 after: &'a Option<String>,
3712 #[serde(rename = "before")]
3713 #[serde(skip_serializing_if = "Option::is_none")]
3714 before: &'a Option<String>,
3715 #[serde(skip_serializing)]
3716 _phantom: std::marker::PhantomData<&'a ()>,
3717 }
3718 #[allow(clippy::useless_format)]
3719 let mut path = format!("/organization/audit_logs",);
3720 let crate::__types::ListAuditLogsParams {
3721 effective_at,
3722 project_ids,
3723 event_types,
3724 actor_ids,
3725 actor_emails,
3726 resource_ids,
3727 limit,
3728 after,
3729 before,
3730 ..
3731 } = params;
3732 let query = serde_urlencoded::to_string(Query {
3733 effective_at,
3734 project_ids,
3735 event_types,
3736 actor_ids,
3737 actor_emails,
3738 resource_ids,
3739 limit,
3740 after,
3741 before,
3742 _phantom: std::marker::PhantomData,
3743 })?;
3744 if !query.is_empty() {
3745 path.push('?');
3746 path.push_str(&query);
3747 }
3748 path
3749 };
3750 let body = String::new();
3751 Ok(http::Request::builder()
3752 .method(http::Method::GET)
3753 .uri(path)
3754 .header(http::header::CONTENT_LENGTH, body.len())
3755 .body(body)?)
3756 },
3757 (
3758 http::StatusCode::from_u16(200u16).unwrap(),
3759 Some(mime::APPLICATION_JSON),
3760 ),
3761 ),
3762 crate::__combinators::Json::new,
3763 ))
3764}
3765future!(
3766 ListAuditLogs,
3767 futures::future::AndThen<
3768 crate::__combinators::Send<Fut, B, E>,
3769 crate::__combinators::Json<B, E, crate::__types::ListAuditLogsResponse>,
3770 fn(
3771 http::Response<B>,
3772 ) -> crate::__combinators::Json<B, E, crate::__types::ListAuditLogsResponse>,
3773 >,
3774 crate::__types::ListAuditLogsResponse
3775);
3776#[doc = "List uploaded certificates for this organization."]
3777pub fn list_organization_certificates<C, Fut, B, E>(
3778 client: C,
3779 params: &crate::__types::ListOrganizationCertificatesParams,
3780) -> ListOrganizationCertificates<Fut, B, E>
3781where
3782 C: FnOnce(http::Request<String>) -> Fut,
3783 Fut: Future<Output = Result<http::Response<B>, E>>,
3784 B: http_body::Body,
3785{
3786 ListOrganizationCertificates(futures::TryFutureExt::and_then(
3787 crate::__combinators::Send::new(
3788 client,
3789 || {
3790 let path = {
3791 #[serde_with::serde_as]
3792 #[derive(serde :: Serialize)]
3793 struct Query<'a> {
3794 #[serde(rename = "limit")]
3795 #[serde(skip_serializing_if = "Option::is_none")]
3796 limit: &'a Option<i64>,
3797 #[serde(rename = "after")]
3798 #[serde(skip_serializing_if = "Option::is_none")]
3799 after: &'a Option<String>,
3800 #[serde(rename = "order")]
3801 #[serde(skip_serializing_if = "Option::is_none")]
3802 order: &'a Option<crate::__types::ListOrganizationCertificatesParamsOrder>,
3803 #[serde(skip_serializing)]
3804 _phantom: std::marker::PhantomData<&'a ()>,
3805 }
3806 #[allow(clippy::useless_format)]
3807 let mut path = format!("/organization/certificates",);
3808 let crate::__types::ListOrganizationCertificatesParams {
3809 limit,
3810 after,
3811 order,
3812 ..
3813 } = params;
3814 let query = serde_urlencoded::to_string(Query {
3815 limit,
3816 after,
3817 order,
3818 _phantom: std::marker::PhantomData,
3819 })?;
3820 if !query.is_empty() {
3821 path.push('?');
3822 path.push_str(&query);
3823 }
3824 path
3825 };
3826 let body = String::new();
3827 Ok(http::Request::builder()
3828 .method(http::Method::GET)
3829 .uri(path)
3830 .header(http::header::CONTENT_LENGTH, body.len())
3831 .body(body)?)
3832 },
3833 (
3834 http::StatusCode::from_u16(200u16).unwrap(),
3835 Some(mime::APPLICATION_JSON),
3836 ),
3837 ),
3838 crate::__combinators::Json::new,
3839 ))
3840}
3841future!(
3842 ListOrganizationCertificates,
3843 futures::future::AndThen<
3844 crate::__combinators::Send<Fut, B, E>,
3845 crate::__combinators::Json<B, E, crate::__types::ListCertificatesResponse>,
3846 fn(
3847 http::Response<B>,
3848 ) -> crate::__combinators::Json<B, E, crate::__types::ListCertificatesResponse>,
3849 >,
3850 crate::__types::ListCertificatesResponse
3851);
3852#[doc = "Upload a certificate to the organization. This does **not** automatically activate the certificate.\n\nOrganizations can upload up to 50 certificates.\n"]
3853pub fn upload_certificate<C, Fut, B, E>(
3854 client: C,
3855 request: &crate::__types::UploadCertificateRequest,
3856) -> UploadCertificate<Fut, B, E>
3857where
3858 C: FnOnce(http::Request<String>) -> Fut,
3859 Fut: Future<Output = Result<http::Response<B>, E>>,
3860 B: http_body::Body,
3861{
3862 UploadCertificate(futures::TryFutureExt::and_then(
3863 crate::__combinators::Send::new(
3864 client,
3865 || {
3866 let path = "/organization/certificates";
3867 let body = serde_json::to_string(request)?;
3868 Ok(http::Request::builder()
3869 .method(http::Method::POST)
3870 .uri(path)
3871 .header(http::header::CONTENT_LENGTH, body.len())
3872 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
3873 .body(body)?)
3874 },
3875 (
3876 http::StatusCode::from_u16(200u16).unwrap(),
3877 Some(mime::APPLICATION_JSON),
3878 ),
3879 ),
3880 crate::__combinators::Json::new,
3881 ))
3882}
3883future!(
3884 UploadCertificate,
3885 futures::future::AndThen<
3886 crate::__combinators::Send<Fut, B, E>,
3887 crate::__combinators::Json<B, E, crate::__types::Certificate>,
3888 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Certificate>,
3889 >,
3890 crate::__types::Certificate
3891);
3892#[doc = "Activate certificates at the organization level.\n\nYou can atomically and idempotently activate up to 10 certificates at a time.\n"]
3893pub fn activate_organization_certificates<C, Fut, B, E>(
3894 client: C,
3895 request: &crate::__types::ToggleCertificatesRequest,
3896) -> ActivateOrganizationCertificates<Fut, B, E>
3897where
3898 C: FnOnce(http::Request<String>) -> Fut,
3899 Fut: Future<Output = Result<http::Response<B>, E>>,
3900 B: http_body::Body,
3901{
3902 ActivateOrganizationCertificates(futures::TryFutureExt::and_then(
3903 crate::__combinators::Send::new(
3904 client,
3905 || {
3906 let path = "/organization/certificates/activate";
3907 let body = serde_json::to_string(request)?;
3908 Ok(http::Request::builder()
3909 .method(http::Method::POST)
3910 .uri(path)
3911 .header(http::header::CONTENT_LENGTH, body.len())
3912 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
3913 .body(body)?)
3914 },
3915 (
3916 http::StatusCode::from_u16(200u16).unwrap(),
3917 Some(mime::APPLICATION_JSON),
3918 ),
3919 ),
3920 crate::__combinators::Json::new,
3921 ))
3922}
3923future!(
3924 ActivateOrganizationCertificates,
3925 futures::future::AndThen<
3926 crate::__combinators::Send<Fut, B, E>,
3927 crate::__combinators::Json<B, E, crate::__types::ListCertificatesResponse>,
3928 fn(
3929 http::Response<B>,
3930 ) -> crate::__combinators::Json<B, E, crate::__types::ListCertificatesResponse>,
3931 >,
3932 crate::__types::ListCertificatesResponse
3933);
3934#[doc = "Deactivate certificates at the organization level.\n\nYou can atomically and idempotently deactivate up to 10 certificates at a time.\n"]
3935pub fn deactivate_organization_certificates<C, Fut, B, E>(
3936 client: C,
3937 request: &crate::__types::ToggleCertificatesRequest,
3938) -> DeactivateOrganizationCertificates<Fut, B, E>
3939where
3940 C: FnOnce(http::Request<String>) -> Fut,
3941 Fut: Future<Output = Result<http::Response<B>, E>>,
3942 B: http_body::Body,
3943{
3944 DeactivateOrganizationCertificates(futures::TryFutureExt::and_then(
3945 crate::__combinators::Send::new(
3946 client,
3947 || {
3948 let path = "/organization/certificates/deactivate";
3949 let body = serde_json::to_string(request)?;
3950 Ok(http::Request::builder()
3951 .method(http::Method::POST)
3952 .uri(path)
3953 .header(http::header::CONTENT_LENGTH, body.len())
3954 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
3955 .body(body)?)
3956 },
3957 (
3958 http::StatusCode::from_u16(200u16).unwrap(),
3959 Some(mime::APPLICATION_JSON),
3960 ),
3961 ),
3962 crate::__combinators::Json::new,
3963 ))
3964}
3965future!(
3966 DeactivateOrganizationCertificates,
3967 futures::future::AndThen<
3968 crate::__combinators::Send<Fut, B, E>,
3969 crate::__combinators::Json<B, E, crate::__types::ListCertificatesResponse>,
3970 fn(
3971 http::Response<B>,
3972 ) -> crate::__combinators::Json<B, E, crate::__types::ListCertificatesResponse>,
3973 >,
3974 crate::__types::ListCertificatesResponse
3975);
3976#[doc = "Get a certificate that has been uploaded to the organization.\n\nYou can get a certificate regardless of whether it is active or not.\n"]
3977pub fn get_certificate<C, Fut, B, E>(
3978 client: C,
3979 params: &crate::__types::GetCertificateParams,
3980) -> GetCertificate<Fut, B, E>
3981where
3982 C: FnOnce(http::Request<String>) -> Fut,
3983 Fut: Future<Output = Result<http::Response<B>, E>>,
3984 B: http_body::Body,
3985{
3986 GetCertificate(futures::TryFutureExt::and_then(
3987 crate::__combinators::Send::new(
3988 client,
3989 || {
3990 let path = {
3991 #[serde_with::serde_as]
3992 #[derive(serde :: Serialize)]
3993 struct Query<'a> {
3994 #[serde(rename = "include")]
3995 #[serde(skip_serializing_if = "Option::is_none")]
3996 include: &'a Option<Vec<crate::__types::GetCertificateParamsInclude>>,
3997 #[serde(skip_serializing)]
3998 _phantom: std::marker::PhantomData<&'a ()>,
3999 }
4000 #[allow(clippy::useless_format)]
4001 let mut path = format!(
4002 "/organization/certificates/{certificate_id}",
4003 certificate_id = params.certificate_id
4004 );
4005 let crate::__types::GetCertificateParams { include, .. } = params;
4006 let query = serde_urlencoded::to_string(Query {
4007 include,
4008 _phantom: std::marker::PhantomData,
4009 })?;
4010 if !query.is_empty() {
4011 path.push('?');
4012 path.push_str(&query);
4013 }
4014 path
4015 };
4016 let body = String::new();
4017 Ok(http::Request::builder()
4018 .method(http::Method::GET)
4019 .uri(path)
4020 .header(http::header::CONTENT_LENGTH, body.len())
4021 .body(body)?)
4022 },
4023 (
4024 http::StatusCode::from_u16(200u16).unwrap(),
4025 Some(mime::APPLICATION_JSON),
4026 ),
4027 ),
4028 crate::__combinators::Json::new,
4029 ))
4030}
4031future!(
4032 GetCertificate,
4033 futures::future::AndThen<
4034 crate::__combinators::Send<Fut, B, E>,
4035 crate::__combinators::Json<B, E, crate::__types::Certificate>,
4036 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Certificate>,
4037 >,
4038 crate::__types::Certificate
4039);
4040#[doc = "Modify a certificate. Note that only the name can be modified.\n"]
4041pub fn modify_certificate<C, Fut, B, E>(
4042 client: C,
4043 request: &crate::__types::ModifyCertificateRequest,
4044) -> ModifyCertificate<Fut, B, E>
4045where
4046 C: FnOnce(http::Request<String>) -> Fut,
4047 Fut: Future<Output = Result<http::Response<B>, E>>,
4048 B: http_body::Body,
4049{
4050 ModifyCertificate(futures::TryFutureExt::and_then(
4051 crate::__combinators::Send::new(
4052 client,
4053 || {
4054 let path = "/organization/certificates/{certificate_id}";
4055 let body = serde_json::to_string(request)?;
4056 Ok(http::Request::builder()
4057 .method(http::Method::POST)
4058 .uri(path)
4059 .header(http::header::CONTENT_LENGTH, body.len())
4060 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
4061 .body(body)?)
4062 },
4063 (
4064 http::StatusCode::from_u16(200u16).unwrap(),
4065 Some(mime::APPLICATION_JSON),
4066 ),
4067 ),
4068 crate::__combinators::Json::new,
4069 ))
4070}
4071future!(
4072 ModifyCertificate,
4073 futures::future::AndThen<
4074 crate::__combinators::Send<Fut, B, E>,
4075 crate::__combinators::Json<B, E, crate::__types::Certificate>,
4076 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Certificate>,
4077 >,
4078 crate::__types::Certificate
4079);
4080#[doc = "Delete a certificate from the organization.\n\nThe certificate must be inactive for the organization and all projects.\n"]
4081pub fn delete_certificate<C, Fut, B, E>(client: C) -> DeleteCertificate<Fut, B, E>
4082where
4083 C: FnOnce(http::Request<String>) -> Fut,
4084 Fut: Future<Output = Result<http::Response<B>, E>>,
4085 B: http_body::Body,
4086{
4087 DeleteCertificate(futures::TryFutureExt::and_then(
4088 crate::__combinators::Send::new(
4089 client,
4090 || {
4091 let path = "/organization/certificates/{certificate_id}";
4092 let body = String::new();
4093 Ok(http::Request::builder()
4094 .method(http::Method::DELETE)
4095 .uri(path)
4096 .header(http::header::CONTENT_LENGTH, body.len())
4097 .body(body)?)
4098 },
4099 (
4100 http::StatusCode::from_u16(200u16).unwrap(),
4101 Some(mime::APPLICATION_JSON),
4102 ),
4103 ),
4104 crate::__combinators::Json::new,
4105 ))
4106}
4107future!(
4108 DeleteCertificate,
4109 futures::future::AndThen<
4110 crate::__combinators::Send<Fut, B, E>,
4111 crate::__combinators::Json<B, E, crate::__types::DeleteCertificateResponse>,
4112 fn(
4113 http::Response<B>,
4114 ) -> crate::__combinators::Json<B, E, crate::__types::DeleteCertificateResponse>,
4115 >,
4116 crate::__types::DeleteCertificateResponse
4117);
4118#[doc = "Get costs details for the organization."]
4119pub fn usage_costs<C, Fut, B, E>(
4120 client: C,
4121 params: &crate::__types::UsageCostsParams,
4122) -> UsageCosts<Fut, B, E>
4123where
4124 C: FnOnce(http::Request<String>) -> Fut,
4125 Fut: Future<Output = Result<http::Response<B>, E>>,
4126 B: http_body::Body,
4127{
4128 UsageCosts(futures::TryFutureExt::and_then(
4129 crate::__combinators::Send::new(
4130 client,
4131 || {
4132 let path = {
4133 #[serde_with::serde_as]
4134 #[derive(serde :: Serialize)]
4135 struct Query<'a> {
4136 #[serde(rename = "start_time")]
4137 start_time: &'a i64,
4138 #[serde(rename = "end_time")]
4139 #[serde(skip_serializing_if = "Option::is_none")]
4140 end_time: &'a Option<i64>,
4141 #[serde(rename = "bucket_width")]
4142 #[serde(skip_serializing_if = "Option::is_none")]
4143 bucket_width: &'a Option<crate::__types::UsageCostsParamsBucketWidth>,
4144 #[serde(rename = "project_ids")]
4145 #[serde(skip_serializing_if = "Option::is_none")]
4146 project_ids: &'a Option<Vec<String>>,
4147 #[serde(rename = "group_by")]
4148 #[serde(skip_serializing_if = "Option::is_none")]
4149 group_by: &'a Option<Vec<crate::__types::UsageCostsParamsGroupBy>>,
4150 #[serde(rename = "limit")]
4151 #[serde(skip_serializing_if = "Option::is_none")]
4152 limit: &'a Option<i64>,
4153 #[serde(rename = "page")]
4154 #[serde(skip_serializing_if = "Option::is_none")]
4155 page: &'a Option<String>,
4156 #[serde(skip_serializing)]
4157 _phantom: std::marker::PhantomData<&'a ()>,
4158 }
4159 #[allow(clippy::useless_format)]
4160 let mut path = format!("/organization/costs",);
4161 let crate::__types::UsageCostsParams {
4162 start_time,
4163 end_time,
4164 bucket_width,
4165 project_ids,
4166 group_by,
4167 limit,
4168 page,
4169 ..
4170 } = params;
4171 let query = serde_urlencoded::to_string(Query {
4172 start_time,
4173 end_time,
4174 bucket_width,
4175 project_ids,
4176 group_by,
4177 limit,
4178 page,
4179 _phantom: std::marker::PhantomData,
4180 })?;
4181 if !query.is_empty() {
4182 path.push('?');
4183 path.push_str(&query);
4184 }
4185 path
4186 };
4187 let body = String::new();
4188 Ok(http::Request::builder()
4189 .method(http::Method::GET)
4190 .uri(path)
4191 .header(http::header::CONTENT_LENGTH, body.len())
4192 .body(body)?)
4193 },
4194 (
4195 http::StatusCode::from_u16(200u16).unwrap(),
4196 Some(mime::APPLICATION_JSON),
4197 ),
4198 ),
4199 crate::__combinators::Json::new,
4200 ))
4201}
4202future!(
4203 UsageCosts,
4204 futures::future::AndThen<
4205 crate::__combinators::Send<Fut, B, E>,
4206 crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
4207 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
4208 >,
4209 crate::__types::UsageResponse
4210);
4211#[doc = "Returns a list of invites in the organization."]
4212pub fn list_invites<C, Fut, B, E>(
4213 client: C,
4214 params: &crate::__types::ListInvitesParams,
4215) -> ListInvites<Fut, B, E>
4216where
4217 C: FnOnce(http::Request<String>) -> Fut,
4218 Fut: Future<Output = Result<http::Response<B>, E>>,
4219 B: http_body::Body,
4220{
4221 ListInvites(futures::TryFutureExt::and_then(
4222 crate::__combinators::Send::new(
4223 client,
4224 || {
4225 let path = {
4226 #[serde_with::serde_as]
4227 #[derive(serde :: Serialize)]
4228 struct Query<'a> {
4229 #[serde(rename = "limit")]
4230 #[serde(skip_serializing_if = "Option::is_none")]
4231 limit: &'a Option<i64>,
4232 #[serde(rename = "after")]
4233 #[serde(skip_serializing_if = "Option::is_none")]
4234 after: &'a Option<String>,
4235 #[serde(skip_serializing)]
4236 _phantom: std::marker::PhantomData<&'a ()>,
4237 }
4238 #[allow(clippy::useless_format)]
4239 let mut path = format!("/organization/invites",);
4240 let crate::__types::ListInvitesParams { limit, after, .. } = params;
4241 let query = serde_urlencoded::to_string(Query {
4242 limit,
4243 after,
4244 _phantom: std::marker::PhantomData,
4245 })?;
4246 if !query.is_empty() {
4247 path.push('?');
4248 path.push_str(&query);
4249 }
4250 path
4251 };
4252 let body = String::new();
4253 Ok(http::Request::builder()
4254 .method(http::Method::GET)
4255 .uri(path)
4256 .header(http::header::CONTENT_LENGTH, body.len())
4257 .body(body)?)
4258 },
4259 (
4260 http::StatusCode::from_u16(200u16).unwrap(),
4261 Some(mime::APPLICATION_JSON),
4262 ),
4263 ),
4264 crate::__combinators::Json::new,
4265 ))
4266}
4267future!(
4268 ListInvites,
4269 futures::future::AndThen<
4270 crate::__combinators::Send<Fut, B, E>,
4271 crate::__combinators::Json<B, E, crate::__types::InviteListResponse>,
4272 fn(
4273 http::Response<B>,
4274 ) -> crate::__combinators::Json<B, E, crate::__types::InviteListResponse>,
4275 >,
4276 crate::__types::InviteListResponse
4277);
4278#[doc = "Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization."]
4279pub fn invite_user<C, Fut, B, E>(
4280 client: C,
4281 request: &crate::__types::InviteRequest,
4282) -> InviteUser<Fut, B, E>
4283where
4284 C: FnOnce(http::Request<String>) -> Fut,
4285 Fut: Future<Output = Result<http::Response<B>, E>>,
4286 B: http_body::Body,
4287{
4288 InviteUser(futures::TryFutureExt::and_then(
4289 crate::__combinators::Send::new(
4290 client,
4291 || {
4292 let path = "/organization/invites";
4293 let body = serde_json::to_string(request)?;
4294 Ok(http::Request::builder()
4295 .method(http::Method::POST)
4296 .uri(path)
4297 .header(http::header::CONTENT_LENGTH, body.len())
4298 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
4299 .body(body)?)
4300 },
4301 (
4302 http::StatusCode::from_u16(200u16).unwrap(),
4303 Some(mime::APPLICATION_JSON),
4304 ),
4305 ),
4306 crate::__combinators::Json::new,
4307 ))
4308}
4309future!(
4310 InviteUser,
4311 futures::future::AndThen<
4312 crate::__combinators::Send<Fut, B, E>,
4313 crate::__combinators::Json<B, E, crate::__types::Invite>,
4314 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Invite>,
4315 >,
4316 crate::__types::Invite
4317);
4318#[doc = "Retrieves an invite."]
4319pub fn retrieve_invite<C, Fut, B, E>(
4320 client: C,
4321 params: &crate::__types::RetrieveInviteParams,
4322) -> RetrieveInvite<Fut, B, E>
4323where
4324 C: FnOnce(http::Request<String>) -> Fut,
4325 Fut: Future<Output = Result<http::Response<B>, E>>,
4326 B: http_body::Body,
4327{
4328 RetrieveInvite(futures::TryFutureExt::and_then(
4329 crate::__combinators::Send::new(
4330 client,
4331 || {
4332 let path = {
4333 #[serde_with::serde_as]
4334 #[derive(serde :: Serialize)]
4335 struct Query<'a> {
4336 #[serde(skip_serializing)]
4337 _phantom: std::marker::PhantomData<&'a ()>,
4338 }
4339 #[allow(clippy::useless_format)]
4340 let mut path = format!(
4341 "/organization/invites/{invite_id}",
4342 invite_id = params.invite_id
4343 );
4344 let crate::__types::RetrieveInviteParams { .. } = params;
4345 let query = serde_urlencoded::to_string(Query {
4346 _phantom: std::marker::PhantomData,
4347 })?;
4348 if !query.is_empty() {
4349 path.push('?');
4350 path.push_str(&query);
4351 }
4352 path
4353 };
4354 let body = String::new();
4355 Ok(http::Request::builder()
4356 .method(http::Method::GET)
4357 .uri(path)
4358 .header(http::header::CONTENT_LENGTH, body.len())
4359 .body(body)?)
4360 },
4361 (
4362 http::StatusCode::from_u16(200u16).unwrap(),
4363 Some(mime::APPLICATION_JSON),
4364 ),
4365 ),
4366 crate::__combinators::Json::new,
4367 ))
4368}
4369future!(
4370 RetrieveInvite,
4371 futures::future::AndThen<
4372 crate::__combinators::Send<Fut, B, E>,
4373 crate::__combinators::Json<B, E, crate::__types::Invite>,
4374 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Invite>,
4375 >,
4376 crate::__types::Invite
4377);
4378#[doc = "Delete an invite. If the invite has already been accepted, it cannot be deleted."]
4379pub fn delete_invite<C, Fut, B, E>(
4380 client: C,
4381 params: &crate::__types::DeleteInviteParams,
4382) -> DeleteInvite<Fut, B, E>
4383where
4384 C: FnOnce(http::Request<String>) -> Fut,
4385 Fut: Future<Output = Result<http::Response<B>, E>>,
4386 B: http_body::Body,
4387{
4388 DeleteInvite(futures::TryFutureExt::and_then(
4389 crate::__combinators::Send::new(
4390 client,
4391 || {
4392 let path = {
4393 #[serde_with::serde_as]
4394 #[derive(serde :: Serialize)]
4395 struct Query<'a> {
4396 #[serde(skip_serializing)]
4397 _phantom: std::marker::PhantomData<&'a ()>,
4398 }
4399 #[allow(clippy::useless_format)]
4400 let mut path = format!(
4401 "/organization/invites/{invite_id}",
4402 invite_id = params.invite_id
4403 );
4404 let crate::__types::DeleteInviteParams { .. } = params;
4405 let query = serde_urlencoded::to_string(Query {
4406 _phantom: std::marker::PhantomData,
4407 })?;
4408 if !query.is_empty() {
4409 path.push('?');
4410 path.push_str(&query);
4411 }
4412 path
4413 };
4414 let body = String::new();
4415 Ok(http::Request::builder()
4416 .method(http::Method::DELETE)
4417 .uri(path)
4418 .header(http::header::CONTENT_LENGTH, body.len())
4419 .body(body)?)
4420 },
4421 (
4422 http::StatusCode::from_u16(200u16).unwrap(),
4423 Some(mime::APPLICATION_JSON),
4424 ),
4425 ),
4426 crate::__combinators::Json::new,
4427 ))
4428}
4429future!(
4430 DeleteInvite,
4431 futures::future::AndThen<
4432 crate::__combinators::Send<Fut, B, E>,
4433 crate::__combinators::Json<B, E, crate::__types::InviteDeleteResponse>,
4434 fn(
4435 http::Response<B>,
4436 ) -> crate::__combinators::Json<B, E, crate::__types::InviteDeleteResponse>,
4437 >,
4438 crate::__types::InviteDeleteResponse
4439);
4440#[doc = "Returns a list of projects."]
4441pub fn list_projects<C, Fut, B, E>(
4442 client: C,
4443 params: &crate::__types::ListProjectsParams,
4444) -> ListProjects<Fut, B, E>
4445where
4446 C: FnOnce(http::Request<String>) -> Fut,
4447 Fut: Future<Output = Result<http::Response<B>, E>>,
4448 B: http_body::Body,
4449{
4450 ListProjects(futures::TryFutureExt::and_then(
4451 crate::__combinators::Send::new(
4452 client,
4453 || {
4454 let path = {
4455 #[serde_with::serde_as]
4456 #[derive(serde :: Serialize)]
4457 struct Query<'a> {
4458 #[serde(rename = "limit")]
4459 #[serde(skip_serializing_if = "Option::is_none")]
4460 limit: &'a Option<i64>,
4461 #[serde(rename = "after")]
4462 #[serde(skip_serializing_if = "Option::is_none")]
4463 after: &'a Option<String>,
4464 #[serde(rename = "include_archived")]
4465 #[serde(skip_serializing_if = "Option::is_none")]
4466 include_archived: &'a Option<bool>,
4467 #[serde(skip_serializing)]
4468 _phantom: std::marker::PhantomData<&'a ()>,
4469 }
4470 #[allow(clippy::useless_format)]
4471 let mut path = format!("/organization/projects",);
4472 let crate::__types::ListProjectsParams {
4473 limit,
4474 after,
4475 include_archived,
4476 ..
4477 } = params;
4478 let query = serde_urlencoded::to_string(Query {
4479 limit,
4480 after,
4481 include_archived,
4482 _phantom: std::marker::PhantomData,
4483 })?;
4484 if !query.is_empty() {
4485 path.push('?');
4486 path.push_str(&query);
4487 }
4488 path
4489 };
4490 let body = String::new();
4491 Ok(http::Request::builder()
4492 .method(http::Method::GET)
4493 .uri(path)
4494 .header(http::header::CONTENT_LENGTH, body.len())
4495 .body(body)?)
4496 },
4497 (
4498 http::StatusCode::from_u16(200u16).unwrap(),
4499 Some(mime::APPLICATION_JSON),
4500 ),
4501 ),
4502 crate::__combinators::Json::new,
4503 ))
4504}
4505future!(
4506 ListProjects,
4507 futures::future::AndThen<
4508 crate::__combinators::Send<Fut, B, E>,
4509 crate::__combinators::Json<B, E, crate::__types::ProjectListResponse>,
4510 fn(
4511 http::Response<B>,
4512 ) -> crate::__combinators::Json<B, E, crate::__types::ProjectListResponse>,
4513 >,
4514 crate::__types::ProjectListResponse
4515);
4516#[doc = "Create a new project in the organization. Projects can be created and archived, but cannot be deleted."]
4517pub fn create_project<C, Fut, B, E>(
4518 client: C,
4519 request: &crate::__types::ProjectCreateRequest,
4520) -> CreateProject<Fut, B, E>
4521where
4522 C: FnOnce(http::Request<String>) -> Fut,
4523 Fut: Future<Output = Result<http::Response<B>, E>>,
4524 B: http_body::Body,
4525{
4526 CreateProject(futures::TryFutureExt::and_then(
4527 crate::__combinators::Send::new(
4528 client,
4529 || {
4530 let path = "/organization/projects";
4531 let body = serde_json::to_string(request)?;
4532 Ok(http::Request::builder()
4533 .method(http::Method::POST)
4534 .uri(path)
4535 .header(http::header::CONTENT_LENGTH, body.len())
4536 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
4537 .body(body)?)
4538 },
4539 (
4540 http::StatusCode::from_u16(200u16).unwrap(),
4541 Some(mime::APPLICATION_JSON),
4542 ),
4543 ),
4544 crate::__combinators::Json::new,
4545 ))
4546}
4547future!(
4548 CreateProject,
4549 futures::future::AndThen<
4550 crate::__combinators::Send<Fut, B, E>,
4551 crate::__combinators::Json<B, E, crate::__types::Project>,
4552 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Project>,
4553 >,
4554 crate::__types::Project
4555);
4556#[doc = "Retrieves a project."]
4557pub fn retrieve_project<C, Fut, B, E>(
4558 client: C,
4559 params: &crate::__types::RetrieveProjectParams,
4560) -> RetrieveProject<Fut, B, E>
4561where
4562 C: FnOnce(http::Request<String>) -> Fut,
4563 Fut: Future<Output = Result<http::Response<B>, E>>,
4564 B: http_body::Body,
4565{
4566 RetrieveProject(futures::TryFutureExt::and_then(
4567 crate::__combinators::Send::new(
4568 client,
4569 || {
4570 let path = {
4571 #[serde_with::serde_as]
4572 #[derive(serde :: Serialize)]
4573 struct Query<'a> {
4574 #[serde(skip_serializing)]
4575 _phantom: std::marker::PhantomData<&'a ()>,
4576 }
4577 #[allow(clippy::useless_format)]
4578 let mut path = format!(
4579 "/organization/projects/{project_id}",
4580 project_id = params.project_id
4581 );
4582 let crate::__types::RetrieveProjectParams { .. } = params;
4583 let query = serde_urlencoded::to_string(Query {
4584 _phantom: std::marker::PhantomData,
4585 })?;
4586 if !query.is_empty() {
4587 path.push('?');
4588 path.push_str(&query);
4589 }
4590 path
4591 };
4592 let body = String::new();
4593 Ok(http::Request::builder()
4594 .method(http::Method::GET)
4595 .uri(path)
4596 .header(http::header::CONTENT_LENGTH, body.len())
4597 .body(body)?)
4598 },
4599 (
4600 http::StatusCode::from_u16(200u16).unwrap(),
4601 Some(mime::APPLICATION_JSON),
4602 ),
4603 ),
4604 crate::__combinators::Json::new,
4605 ))
4606}
4607future!(
4608 RetrieveProject,
4609 futures::future::AndThen<
4610 crate::__combinators::Send<Fut, B, E>,
4611 crate::__combinators::Json<B, E, crate::__types::Project>,
4612 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Project>,
4613 >,
4614 crate::__types::Project
4615);
4616#[doc = "Modifies a project in the organization."]
4617pub fn modify_project<C, Fut, B, E>(
4618 client: C,
4619 params: &crate::__types::ModifyProjectParams,
4620 request: &crate::__types::ProjectUpdateRequest,
4621) -> ModifyProject<Fut, B, E>
4622where
4623 C: FnOnce(http::Request<String>) -> Fut,
4624 Fut: Future<Output = Result<http::Response<B>, E>>,
4625 B: http_body::Body,
4626{
4627 ModifyProject(futures::TryFutureExt::and_then(
4628 crate::__combinators::Send::new(
4629 client,
4630 || {
4631 let path = {
4632 #[serde_with::serde_as]
4633 #[derive(serde :: Serialize)]
4634 struct Query<'a> {
4635 #[serde(skip_serializing)]
4636 _phantom: std::marker::PhantomData<&'a ()>,
4637 }
4638 #[allow(clippy::useless_format)]
4639 let mut path = format!(
4640 "/organization/projects/{project_id}",
4641 project_id = params.project_id
4642 );
4643 let crate::__types::ModifyProjectParams { .. } = params;
4644 let query = serde_urlencoded::to_string(Query {
4645 _phantom: std::marker::PhantomData,
4646 })?;
4647 if !query.is_empty() {
4648 path.push('?');
4649 path.push_str(&query);
4650 }
4651 path
4652 };
4653 let body = serde_json::to_string(request)?;
4654 Ok(http::Request::builder()
4655 .method(http::Method::POST)
4656 .uri(path)
4657 .header(http::header::CONTENT_LENGTH, body.len())
4658 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
4659 .body(body)?)
4660 },
4661 (
4662 http::StatusCode::from_u16(200u16).unwrap(),
4663 Some(mime::APPLICATION_JSON),
4664 ),
4665 ),
4666 crate::__combinators::Json::new,
4667 ))
4668}
4669future!(
4670 ModifyProject,
4671 futures::future::AndThen<
4672 crate::__combinators::Send<Fut, B, E>,
4673 crate::__combinators::Json<B, E, crate::__types::Project>,
4674 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Project>,
4675 >,
4676 crate::__types::Project
4677);
4678#[doc = "Returns a list of API keys in the project."]
4679pub fn list_project_api_keys<C, Fut, B, E>(
4680 client: C,
4681 params: &crate::__types::ListProjectApiKeysParams,
4682) -> ListProjectApiKeys<Fut, B, E>
4683where
4684 C: FnOnce(http::Request<String>) -> Fut,
4685 Fut: Future<Output = Result<http::Response<B>, E>>,
4686 B: http_body::Body,
4687{
4688 ListProjectApiKeys(futures::TryFutureExt::and_then(
4689 crate::__combinators::Send::new(
4690 client,
4691 || {
4692 let path = {
4693 #[serde_with::serde_as]
4694 #[derive(serde :: Serialize)]
4695 struct Query<'a> {
4696 #[serde(rename = "limit")]
4697 #[serde(skip_serializing_if = "Option::is_none")]
4698 limit: &'a Option<i64>,
4699 #[serde(rename = "after")]
4700 #[serde(skip_serializing_if = "Option::is_none")]
4701 after: &'a Option<String>,
4702 #[serde(skip_serializing)]
4703 _phantom: std::marker::PhantomData<&'a ()>,
4704 }
4705 #[allow(clippy::useless_format)]
4706 let mut path = format!(
4707 "/organization/projects/{project_id}/api_keys",
4708 project_id = params.project_id
4709 );
4710 let crate::__types::ListProjectApiKeysParams { limit, after, .. } = params;
4711 let query = serde_urlencoded::to_string(Query {
4712 limit,
4713 after,
4714 _phantom: std::marker::PhantomData,
4715 })?;
4716 if !query.is_empty() {
4717 path.push('?');
4718 path.push_str(&query);
4719 }
4720 path
4721 };
4722 let body = String::new();
4723 Ok(http::Request::builder()
4724 .method(http::Method::GET)
4725 .uri(path)
4726 .header(http::header::CONTENT_LENGTH, body.len())
4727 .body(body)?)
4728 },
4729 (
4730 http::StatusCode::from_u16(200u16).unwrap(),
4731 Some(mime::APPLICATION_JSON),
4732 ),
4733 ),
4734 crate::__combinators::Json::new,
4735 ))
4736}
4737future!(
4738 ListProjectApiKeys,
4739 futures::future::AndThen<
4740 crate::__combinators::Send<Fut, B, E>,
4741 crate::__combinators::Json<B, E, crate::__types::ProjectApiKeyListResponse>,
4742 fn(
4743 http::Response<B>,
4744 ) -> crate::__combinators::Json<B, E, crate::__types::ProjectApiKeyListResponse>,
4745 >,
4746 crate::__types::ProjectApiKeyListResponse
4747);
4748#[doc = "Retrieves an API key in the project."]
4749pub fn retrieve_project_api_key<C, Fut, B, E>(
4750 client: C,
4751 params: &crate::__types::RetrieveProjectApiKeyParams,
4752) -> RetrieveProjectApiKey<Fut, B, E>
4753where
4754 C: FnOnce(http::Request<String>) -> Fut,
4755 Fut: Future<Output = Result<http::Response<B>, E>>,
4756 B: http_body::Body,
4757{
4758 RetrieveProjectApiKey(futures::TryFutureExt::and_then(
4759 crate::__combinators::Send::new(
4760 client,
4761 || {
4762 let path = {
4763 #[serde_with::serde_as]
4764 #[derive(serde :: Serialize)]
4765 struct Query<'a> {
4766 #[serde(skip_serializing)]
4767 _phantom: std::marker::PhantomData<&'a ()>,
4768 }
4769 #[allow(clippy::useless_format)]
4770 let mut path = format!(
4771 "/organization/projects/{project_id}/api_keys/{key_id}",
4772 project_id = params.project_id,
4773 key_id = params.key_id
4774 );
4775 let crate::__types::RetrieveProjectApiKeyParams { .. } = params;
4776 let query = serde_urlencoded::to_string(Query {
4777 _phantom: std::marker::PhantomData,
4778 })?;
4779 if !query.is_empty() {
4780 path.push('?');
4781 path.push_str(&query);
4782 }
4783 path
4784 };
4785 let body = String::new();
4786 Ok(http::Request::builder()
4787 .method(http::Method::GET)
4788 .uri(path)
4789 .header(http::header::CONTENT_LENGTH, body.len())
4790 .body(body)?)
4791 },
4792 (
4793 http::StatusCode::from_u16(200u16).unwrap(),
4794 Some(mime::APPLICATION_JSON),
4795 ),
4796 ),
4797 crate::__combinators::Json::new,
4798 ))
4799}
4800future!(
4801 RetrieveProjectApiKey,
4802 futures::future::AndThen<
4803 crate::__combinators::Send<Fut, B, E>,
4804 crate::__combinators::Json<B, E, crate::__types::ProjectApiKey>,
4805 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::ProjectApiKey>,
4806 >,
4807 crate::__types::ProjectApiKey
4808);
4809#[doc = "Deletes an API key from the project."]
4810pub fn delete_project_api_key<C, Fut, B, E>(
4811 client: C,
4812 params: &crate::__types::DeleteProjectApiKeyParams,
4813) -> DeleteProjectApiKey<Fut, B, E>
4814where
4815 C: FnOnce(http::Request<String>) -> Fut,
4816 Fut: Future<Output = Result<http::Response<B>, E>>,
4817 B: http_body::Body,
4818{
4819 DeleteProjectApiKey(futures::TryFutureExt::and_then(
4820 crate::__combinators::Send::new(
4821 client,
4822 || {
4823 let path = {
4824 #[serde_with::serde_as]
4825 #[derive(serde :: Serialize)]
4826 struct Query<'a> {
4827 #[serde(skip_serializing)]
4828 _phantom: std::marker::PhantomData<&'a ()>,
4829 }
4830 #[allow(clippy::useless_format)]
4831 let mut path = format!(
4832 "/organization/projects/{project_id}/api_keys/{key_id}",
4833 project_id = params.project_id,
4834 key_id = params.key_id
4835 );
4836 let crate::__types::DeleteProjectApiKeyParams { .. } = params;
4837 let query = serde_urlencoded::to_string(Query {
4838 _phantom: std::marker::PhantomData,
4839 })?;
4840 if !query.is_empty() {
4841 path.push('?');
4842 path.push_str(&query);
4843 }
4844 path
4845 };
4846 let body = String::new();
4847 Ok(http::Request::builder()
4848 .method(http::Method::DELETE)
4849 .uri(path)
4850 .header(http::header::CONTENT_LENGTH, body.len())
4851 .body(body)?)
4852 },
4853 (
4854 http::StatusCode::from_u16(200u16).unwrap(),
4855 Some(mime::APPLICATION_JSON),
4856 ),
4857 ),
4858 crate::__combinators::Json::new,
4859 ))
4860}
4861future!(
4862 DeleteProjectApiKey,
4863 futures::future::AndThen<
4864 crate::__combinators::Send<Fut, B, E>,
4865 crate::__combinators::Json<B, E, crate::__types::ProjectApiKeyDeleteResponse>,
4866 fn(
4867 http::Response<B>,
4868 )
4869 -> crate::__combinators::Json<B, E, crate::__types::ProjectApiKeyDeleteResponse>,
4870 >,
4871 crate::__types::ProjectApiKeyDeleteResponse
4872);
4873#[doc = "Archives a project in the organization. Archived projects cannot be used or updated."]
4874pub fn archive_project<C, Fut, B, E>(
4875 client: C,
4876 params: &crate::__types::ArchiveProjectParams,
4877) -> ArchiveProject<Fut, B, E>
4878where
4879 C: FnOnce(http::Request<String>) -> Fut,
4880 Fut: Future<Output = Result<http::Response<B>, E>>,
4881 B: http_body::Body,
4882{
4883 ArchiveProject(futures::TryFutureExt::and_then(
4884 crate::__combinators::Send::new(
4885 client,
4886 || {
4887 let path = {
4888 #[serde_with::serde_as]
4889 #[derive(serde :: Serialize)]
4890 struct Query<'a> {
4891 #[serde(skip_serializing)]
4892 _phantom: std::marker::PhantomData<&'a ()>,
4893 }
4894 #[allow(clippy::useless_format)]
4895 let mut path = format!(
4896 "/organization/projects/{project_id}/archive",
4897 project_id = params.project_id
4898 );
4899 let crate::__types::ArchiveProjectParams { .. } = params;
4900 let query = serde_urlencoded::to_string(Query {
4901 _phantom: std::marker::PhantomData,
4902 })?;
4903 if !query.is_empty() {
4904 path.push('?');
4905 path.push_str(&query);
4906 }
4907 path
4908 };
4909 let body = String::new();
4910 Ok(http::Request::builder()
4911 .method(http::Method::POST)
4912 .uri(path)
4913 .header(http::header::CONTENT_LENGTH, body.len())
4914 .body(body)?)
4915 },
4916 (
4917 http::StatusCode::from_u16(200u16).unwrap(),
4918 Some(mime::APPLICATION_JSON),
4919 ),
4920 ),
4921 crate::__combinators::Json::new,
4922 ))
4923}
4924future!(
4925 ArchiveProject,
4926 futures::future::AndThen<
4927 crate::__combinators::Send<Fut, B, E>,
4928 crate::__combinators::Json<B, E, crate::__types::Project>,
4929 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Project>,
4930 >,
4931 crate::__types::Project
4932);
4933#[doc = "List certificates for this project."]
4934pub fn list_project_certificates<C, Fut, B, E>(
4935 client: C,
4936 params: &crate::__types::ListProjectCertificatesParams,
4937) -> ListProjectCertificates<Fut, B, E>
4938where
4939 C: FnOnce(http::Request<String>) -> Fut,
4940 Fut: Future<Output = Result<http::Response<B>, E>>,
4941 B: http_body::Body,
4942{
4943 ListProjectCertificates(futures::TryFutureExt::and_then(
4944 crate::__combinators::Send::new(
4945 client,
4946 || {
4947 let path = {
4948 #[serde_with::serde_as]
4949 #[derive(serde :: Serialize)]
4950 struct Query<'a> {
4951 #[serde(rename = "limit")]
4952 #[serde(skip_serializing_if = "Option::is_none")]
4953 limit: &'a Option<i64>,
4954 #[serde(rename = "after")]
4955 #[serde(skip_serializing_if = "Option::is_none")]
4956 after: &'a Option<String>,
4957 #[serde(rename = "order")]
4958 #[serde(skip_serializing_if = "Option::is_none")]
4959 order: &'a Option<crate::__types::ListProjectCertificatesParamsOrder>,
4960 #[serde(skip_serializing)]
4961 _phantom: std::marker::PhantomData<&'a ()>,
4962 }
4963 #[allow(clippy::useless_format)]
4964 let mut path = format!(
4965 "/organization/projects/{project_id}/certificates",
4966 project_id = params.project_id
4967 );
4968 let crate::__types::ListProjectCertificatesParams {
4969 limit,
4970 after,
4971 order,
4972 ..
4973 } = params;
4974 let query = serde_urlencoded::to_string(Query {
4975 limit,
4976 after,
4977 order,
4978 _phantom: std::marker::PhantomData,
4979 })?;
4980 if !query.is_empty() {
4981 path.push('?');
4982 path.push_str(&query);
4983 }
4984 path
4985 };
4986 let body = String::new();
4987 Ok(http::Request::builder()
4988 .method(http::Method::GET)
4989 .uri(path)
4990 .header(http::header::CONTENT_LENGTH, body.len())
4991 .body(body)?)
4992 },
4993 (
4994 http::StatusCode::from_u16(200u16).unwrap(),
4995 Some(mime::APPLICATION_JSON),
4996 ),
4997 ),
4998 crate::__combinators::Json::new,
4999 ))
5000}
5001future!(
5002 ListProjectCertificates,
5003 futures::future::AndThen<
5004 crate::__combinators::Send<Fut, B, E>,
5005 crate::__combinators::Json<B, E, crate::__types::ListCertificatesResponse>,
5006 fn(
5007 http::Response<B>,
5008 ) -> crate::__combinators::Json<B, E, crate::__types::ListCertificatesResponse>,
5009 >,
5010 crate::__types::ListCertificatesResponse
5011);
5012#[doc = "Activate certificates at the project level.\n\nYou can atomically and idempotently activate up to 10 certificates at a time.\n"]
5013pub fn activate_project_certificates<C, Fut, B, E>(
5014 client: C,
5015 params: &crate::__types::ActivateProjectCertificatesParams,
5016 request: &crate::__types::ToggleCertificatesRequest,
5017) -> ActivateProjectCertificates<Fut, B, E>
5018where
5019 C: FnOnce(http::Request<String>) -> Fut,
5020 Fut: Future<Output = Result<http::Response<B>, E>>,
5021 B: http_body::Body,
5022{
5023 ActivateProjectCertificates(futures::TryFutureExt::and_then(
5024 crate::__combinators::Send::new(
5025 client,
5026 || {
5027 let path = {
5028 #[serde_with::serde_as]
5029 #[derive(serde :: Serialize)]
5030 struct Query<'a> {
5031 #[serde(skip_serializing)]
5032 _phantom: std::marker::PhantomData<&'a ()>,
5033 }
5034 #[allow(clippy::useless_format)]
5035 let mut path = format!(
5036 "/organization/projects/{project_id}/certificates/activate",
5037 project_id = params.project_id
5038 );
5039 let crate::__types::ActivateProjectCertificatesParams { .. } = params;
5040 let query = serde_urlencoded::to_string(Query {
5041 _phantom: std::marker::PhantomData,
5042 })?;
5043 if !query.is_empty() {
5044 path.push('?');
5045 path.push_str(&query);
5046 }
5047 path
5048 };
5049 let body = serde_json::to_string(request)?;
5050 Ok(http::Request::builder()
5051 .method(http::Method::POST)
5052 .uri(path)
5053 .header(http::header::CONTENT_LENGTH, body.len())
5054 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
5055 .body(body)?)
5056 },
5057 (
5058 http::StatusCode::from_u16(200u16).unwrap(),
5059 Some(mime::APPLICATION_JSON),
5060 ),
5061 ),
5062 crate::__combinators::Json::new,
5063 ))
5064}
5065future!(
5066 ActivateProjectCertificates,
5067 futures::future::AndThen<
5068 crate::__combinators::Send<Fut, B, E>,
5069 crate::__combinators::Json<B, E, crate::__types::ListCertificatesResponse>,
5070 fn(
5071 http::Response<B>,
5072 ) -> crate::__combinators::Json<B, E, crate::__types::ListCertificatesResponse>,
5073 >,
5074 crate::__types::ListCertificatesResponse
5075);
5076#[doc = "Deactivate certificates at the project level. You can atomically and \nidempotently deactivate up to 10 certificates at a time.\n"]
5077pub fn deactivate_project_certificates<C, Fut, B, E>(
5078 client: C,
5079 params: &crate::__types::DeactivateProjectCertificatesParams,
5080 request: &crate::__types::ToggleCertificatesRequest,
5081) -> DeactivateProjectCertificates<Fut, B, E>
5082where
5083 C: FnOnce(http::Request<String>) -> Fut,
5084 Fut: Future<Output = Result<http::Response<B>, E>>,
5085 B: http_body::Body,
5086{
5087 DeactivateProjectCertificates(futures::TryFutureExt::and_then(
5088 crate::__combinators::Send::new(
5089 client,
5090 || {
5091 let path = {
5092 #[serde_with::serde_as]
5093 #[derive(serde :: Serialize)]
5094 struct Query<'a> {
5095 #[serde(skip_serializing)]
5096 _phantom: std::marker::PhantomData<&'a ()>,
5097 }
5098 #[allow(clippy::useless_format)]
5099 let mut path = format!(
5100 "/organization/projects/{project_id}/certificates/deactivate",
5101 project_id = params.project_id
5102 );
5103 let crate::__types::DeactivateProjectCertificatesParams { .. } = params;
5104 let query = serde_urlencoded::to_string(Query {
5105 _phantom: std::marker::PhantomData,
5106 })?;
5107 if !query.is_empty() {
5108 path.push('?');
5109 path.push_str(&query);
5110 }
5111 path
5112 };
5113 let body = serde_json::to_string(request)?;
5114 Ok(http::Request::builder()
5115 .method(http::Method::POST)
5116 .uri(path)
5117 .header(http::header::CONTENT_LENGTH, body.len())
5118 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
5119 .body(body)?)
5120 },
5121 (
5122 http::StatusCode::from_u16(200u16).unwrap(),
5123 Some(mime::APPLICATION_JSON),
5124 ),
5125 ),
5126 crate::__combinators::Json::new,
5127 ))
5128}
5129future!(
5130 DeactivateProjectCertificates,
5131 futures::future::AndThen<
5132 crate::__combinators::Send<Fut, B, E>,
5133 crate::__combinators::Json<B, E, crate::__types::ListCertificatesResponse>,
5134 fn(
5135 http::Response<B>,
5136 ) -> crate::__combinators::Json<B, E, crate::__types::ListCertificatesResponse>,
5137 >,
5138 crate::__types::ListCertificatesResponse
5139);
5140#[doc = "Returns the rate limits per model for a project."]
5141pub fn list_project_rate_limits<C, Fut, B, E>(
5142 client: C,
5143 params: &crate::__types::ListProjectRateLimitsParams,
5144) -> ListProjectRateLimits<Fut, B, E>
5145where
5146 C: FnOnce(http::Request<String>) -> Fut,
5147 Fut: Future<Output = Result<http::Response<B>, E>>,
5148 B: http_body::Body,
5149{
5150 ListProjectRateLimits(futures::TryFutureExt::and_then(
5151 crate::__combinators::Send::new(
5152 client,
5153 || {
5154 let path = {
5155 #[serde_with::serde_as]
5156 #[derive(serde :: Serialize)]
5157 struct Query<'a> {
5158 #[serde(rename = "limit")]
5159 #[serde(skip_serializing_if = "Option::is_none")]
5160 limit: &'a Option<i64>,
5161 #[serde(rename = "after")]
5162 #[serde(skip_serializing_if = "Option::is_none")]
5163 after: &'a Option<String>,
5164 #[serde(rename = "before")]
5165 #[serde(skip_serializing_if = "Option::is_none")]
5166 before: &'a Option<String>,
5167 #[serde(skip_serializing)]
5168 _phantom: std::marker::PhantomData<&'a ()>,
5169 }
5170 #[allow(clippy::useless_format)]
5171 let mut path = format!(
5172 "/organization/projects/{project_id}/rate_limits",
5173 project_id = params.project_id
5174 );
5175 let crate::__types::ListProjectRateLimitsParams {
5176 limit,
5177 after,
5178 before,
5179 ..
5180 } = params;
5181 let query = serde_urlencoded::to_string(Query {
5182 limit,
5183 after,
5184 before,
5185 _phantom: std::marker::PhantomData,
5186 })?;
5187 if !query.is_empty() {
5188 path.push('?');
5189 path.push_str(&query);
5190 }
5191 path
5192 };
5193 let body = String::new();
5194 Ok(http::Request::builder()
5195 .method(http::Method::GET)
5196 .uri(path)
5197 .header(http::header::CONTENT_LENGTH, body.len())
5198 .body(body)?)
5199 },
5200 (
5201 http::StatusCode::from_u16(200u16).unwrap(),
5202 Some(mime::APPLICATION_JSON),
5203 ),
5204 ),
5205 crate::__combinators::Json::new,
5206 ))
5207}
5208future!(
5209 ListProjectRateLimits,
5210 futures::future::AndThen<
5211 crate::__combinators::Send<Fut, B, E>,
5212 crate::__combinators::Json<B, E, crate::__types::ProjectRateLimitListResponse>,
5213 fn(
5214 http::Response<B>,
5215 )
5216 -> crate::__combinators::Json<B, E, crate::__types::ProjectRateLimitListResponse>,
5217 >,
5218 crate::__types::ProjectRateLimitListResponse
5219);
5220#[doc = "Updates a project rate limit."]
5221pub fn update_project_rate_limits<C, Fut, B, E>(
5222 client: C,
5223 params: &crate::__types::UpdateProjectRateLimitsParams,
5224 request: &crate::__types::ProjectRateLimitUpdateRequest,
5225) -> UpdateProjectRateLimits<Fut, B, E>
5226where
5227 C: FnOnce(http::Request<String>) -> Fut,
5228 Fut: Future<Output = Result<http::Response<B>, E>>,
5229 B: http_body::Body,
5230{
5231 UpdateProjectRateLimits(futures::TryFutureExt::and_then(
5232 crate::__combinators::Send::new(
5233 client,
5234 || {
5235 let path = {
5236 #[serde_with::serde_as]
5237 #[derive(serde :: Serialize)]
5238 struct Query<'a> {
5239 #[serde(skip_serializing)]
5240 _phantom: std::marker::PhantomData<&'a ()>,
5241 }
5242 #[allow(clippy::useless_format)]
5243 let mut path = format!(
5244 "/organization/projects/{project_id}/rate_limits/{rate_limit_id}",
5245 project_id = params.project_id,
5246 rate_limit_id = params.rate_limit_id
5247 );
5248 let crate::__types::UpdateProjectRateLimitsParams { .. } = params;
5249 let query = serde_urlencoded::to_string(Query {
5250 _phantom: std::marker::PhantomData,
5251 })?;
5252 if !query.is_empty() {
5253 path.push('?');
5254 path.push_str(&query);
5255 }
5256 path
5257 };
5258 let body = serde_json::to_string(request)?;
5259 Ok(http::Request::builder()
5260 .method(http::Method::POST)
5261 .uri(path)
5262 .header(http::header::CONTENT_LENGTH, body.len())
5263 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
5264 .body(body)?)
5265 },
5266 (
5267 http::StatusCode::from_u16(200u16).unwrap(),
5268 Some(mime::APPLICATION_JSON),
5269 ),
5270 ),
5271 crate::__combinators::Json::new,
5272 ))
5273}
5274future!(
5275 UpdateProjectRateLimits,
5276 futures::future::AndThen<
5277 crate::__combinators::Send<Fut, B, E>,
5278 crate::__combinators::Json<B, E, crate::__types::ProjectRateLimit>,
5279 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::ProjectRateLimit>,
5280 >,
5281 crate::__types::ProjectRateLimit
5282);
5283#[doc = "Returns a list of service accounts in the project."]
5284pub fn list_project_service_accounts<C, Fut, B, E>(
5285 client: C,
5286 params: &crate::__types::ListProjectServiceAccountsParams,
5287) -> ListProjectServiceAccounts<Fut, B, E>
5288where
5289 C: FnOnce(http::Request<String>) -> Fut,
5290 Fut: Future<Output = Result<http::Response<B>, E>>,
5291 B: http_body::Body,
5292{
5293 ListProjectServiceAccounts(futures::TryFutureExt::and_then(
5294 crate::__combinators::Send::new(
5295 client,
5296 || {
5297 let path = {
5298 #[serde_with::serde_as]
5299 #[derive(serde :: Serialize)]
5300 struct Query<'a> {
5301 #[serde(rename = "limit")]
5302 #[serde(skip_serializing_if = "Option::is_none")]
5303 limit: &'a Option<i64>,
5304 #[serde(rename = "after")]
5305 #[serde(skip_serializing_if = "Option::is_none")]
5306 after: &'a Option<String>,
5307 #[serde(skip_serializing)]
5308 _phantom: std::marker::PhantomData<&'a ()>,
5309 }
5310 #[allow(clippy::useless_format)]
5311 let mut path = format!(
5312 "/organization/projects/{project_id}/service_accounts",
5313 project_id = params.project_id
5314 );
5315 let crate::__types::ListProjectServiceAccountsParams { limit, after, .. } =
5316 params;
5317 let query = serde_urlencoded::to_string(Query {
5318 limit,
5319 after,
5320 _phantom: std::marker::PhantomData,
5321 })?;
5322 if !query.is_empty() {
5323 path.push('?');
5324 path.push_str(&query);
5325 }
5326 path
5327 };
5328 let body = String::new();
5329 Ok(http::Request::builder()
5330 .method(http::Method::GET)
5331 .uri(path)
5332 .header(http::header::CONTENT_LENGTH, body.len())
5333 .body(body)?)
5334 },
5335 (
5336 http::StatusCode::from_u16(200u16).unwrap(),
5337 Some(mime::APPLICATION_JSON),
5338 ),
5339 ),
5340 crate::__combinators::Json::new,
5341 ))
5342}
5343future!(
5344 ListProjectServiceAccounts,
5345 futures::future::AndThen<
5346 crate::__combinators::Send<Fut, B, E>,
5347 crate::__combinators::Json<B, E, crate::__types::ProjectServiceAccountListResponse>,
5348 fn(
5349 http::Response<B>,
5350 )
5351 -> crate::__combinators::Json<B, E, crate::__types::ProjectServiceAccountListResponse>,
5352 >,
5353 crate::__types::ProjectServiceAccountListResponse
5354);
5355#[doc = "Creates a new service account in the project. This also returns an unredacted API key for the service account."]
5356pub fn create_project_service_account<C, Fut, B, E>(
5357 client: C,
5358 params: &crate::__types::CreateProjectServiceAccountParams,
5359 request: &crate::__types::ProjectServiceAccountCreateRequest,
5360) -> CreateProjectServiceAccount<Fut, B, E>
5361where
5362 C: FnOnce(http::Request<String>) -> Fut,
5363 Fut: Future<Output = Result<http::Response<B>, E>>,
5364 B: http_body::Body,
5365{
5366 CreateProjectServiceAccount(futures::TryFutureExt::and_then(
5367 crate::__combinators::Send::new(
5368 client,
5369 || {
5370 let path = {
5371 #[serde_with::serde_as]
5372 #[derive(serde :: Serialize)]
5373 struct Query<'a> {
5374 #[serde(skip_serializing)]
5375 _phantom: std::marker::PhantomData<&'a ()>,
5376 }
5377 #[allow(clippy::useless_format)]
5378 let mut path = format!(
5379 "/organization/projects/{project_id}/service_accounts",
5380 project_id = params.project_id
5381 );
5382 let crate::__types::CreateProjectServiceAccountParams { .. } = params;
5383 let query = serde_urlencoded::to_string(Query {
5384 _phantom: std::marker::PhantomData,
5385 })?;
5386 if !query.is_empty() {
5387 path.push('?');
5388 path.push_str(&query);
5389 }
5390 path
5391 };
5392 let body = serde_json::to_string(request)?;
5393 Ok(http::Request::builder()
5394 .method(http::Method::POST)
5395 .uri(path)
5396 .header(http::header::CONTENT_LENGTH, body.len())
5397 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
5398 .body(body)?)
5399 },
5400 (
5401 http::StatusCode::from_u16(200u16).unwrap(),
5402 Some(mime::APPLICATION_JSON),
5403 ),
5404 ),
5405 crate::__combinators::Json::new,
5406 ))
5407}
5408future!(
5409 CreateProjectServiceAccount,
5410 futures::future::AndThen<
5411 crate::__combinators::Send<Fut, B, E>,
5412 crate::__combinators::Json<B, E, crate::__types::ProjectServiceAccountCreateResponse>,
5413 fn(
5414 http::Response<B>,
5415 )
5416 -> crate::__combinators::Json<B, E, crate::__types::ProjectServiceAccountCreateResponse>,
5417 >,
5418 crate::__types::ProjectServiceAccountCreateResponse
5419);
5420#[doc = "Retrieves a service account in the project."]
5421pub fn retrieve_project_service_account<C, Fut, B, E>(
5422 client: C,
5423 params: &crate::__types::RetrieveProjectServiceAccountParams,
5424) -> RetrieveProjectServiceAccount<Fut, B, E>
5425where
5426 C: FnOnce(http::Request<String>) -> Fut,
5427 Fut: Future<Output = Result<http::Response<B>, E>>,
5428 B: http_body::Body,
5429{
5430 RetrieveProjectServiceAccount(futures::TryFutureExt::and_then(
5431 crate::__combinators::Send::new(
5432 client,
5433 || {
5434 let path = {
5435 #[serde_with::serde_as]
5436 #[derive(serde :: Serialize)]
5437 struct Query<'a> {
5438 #[serde(skip_serializing)]
5439 _phantom: std::marker::PhantomData<&'a ()>,
5440 }
5441 #[allow(clippy::useless_format)]
5442 let mut path = format!(
5443 "/organization/projects/{project_id}/service_accounts/{service_account_id}",
5444 project_id = params.project_id,
5445 service_account_id = params.service_account_id
5446 );
5447 let crate::__types::RetrieveProjectServiceAccountParams { .. } = params;
5448 let query = serde_urlencoded::to_string(Query {
5449 _phantom: std::marker::PhantomData,
5450 })?;
5451 if !query.is_empty() {
5452 path.push('?');
5453 path.push_str(&query);
5454 }
5455 path
5456 };
5457 let body = String::new();
5458 Ok(http::Request::builder()
5459 .method(http::Method::GET)
5460 .uri(path)
5461 .header(http::header::CONTENT_LENGTH, body.len())
5462 .body(body)?)
5463 },
5464 (
5465 http::StatusCode::from_u16(200u16).unwrap(),
5466 Some(mime::APPLICATION_JSON),
5467 ),
5468 ),
5469 crate::__combinators::Json::new,
5470 ))
5471}
5472future!(
5473 RetrieveProjectServiceAccount,
5474 futures::future::AndThen<
5475 crate::__combinators::Send<Fut, B, E>,
5476 crate::__combinators::Json<B, E, crate::__types::ProjectServiceAccount>,
5477 fn(
5478 http::Response<B>,
5479 ) -> crate::__combinators::Json<B, E, crate::__types::ProjectServiceAccount>,
5480 >,
5481 crate::__types::ProjectServiceAccount
5482);
5483#[doc = "Deletes a service account from the project."]
5484pub fn delete_project_service_account<C, Fut, B, E>(
5485 client: C,
5486 params: &crate::__types::DeleteProjectServiceAccountParams,
5487) -> DeleteProjectServiceAccount<Fut, B, E>
5488where
5489 C: FnOnce(http::Request<String>) -> Fut,
5490 Fut: Future<Output = Result<http::Response<B>, E>>,
5491 B: http_body::Body,
5492{
5493 DeleteProjectServiceAccount(futures::TryFutureExt::and_then(
5494 crate::__combinators::Send::new(
5495 client,
5496 || {
5497 let path = {
5498 #[serde_with::serde_as]
5499 #[derive(serde :: Serialize)]
5500 struct Query<'a> {
5501 #[serde(skip_serializing)]
5502 _phantom: std::marker::PhantomData<&'a ()>,
5503 }
5504 #[allow(clippy::useless_format)]
5505 let mut path = format!(
5506 "/organization/projects/{project_id}/service_accounts/{service_account_id}",
5507 project_id = params.project_id,
5508 service_account_id = params.service_account_id
5509 );
5510 let crate::__types::DeleteProjectServiceAccountParams { .. } = params;
5511 let query = serde_urlencoded::to_string(Query {
5512 _phantom: std::marker::PhantomData,
5513 })?;
5514 if !query.is_empty() {
5515 path.push('?');
5516 path.push_str(&query);
5517 }
5518 path
5519 };
5520 let body = String::new();
5521 Ok(http::Request::builder()
5522 .method(http::Method::DELETE)
5523 .uri(path)
5524 .header(http::header::CONTENT_LENGTH, body.len())
5525 .body(body)?)
5526 },
5527 (
5528 http::StatusCode::from_u16(200u16).unwrap(),
5529 Some(mime::APPLICATION_JSON),
5530 ),
5531 ),
5532 crate::__combinators::Json::new,
5533 ))
5534}
5535future!(
5536 DeleteProjectServiceAccount,
5537 futures::future::AndThen<
5538 crate::__combinators::Send<Fut, B, E>,
5539 crate::__combinators::Json<B, E, crate::__types::ProjectServiceAccountDeleteResponse>,
5540 fn(
5541 http::Response<B>,
5542 )
5543 -> crate::__combinators::Json<B, E, crate::__types::ProjectServiceAccountDeleteResponse>,
5544 >,
5545 crate::__types::ProjectServiceAccountDeleteResponse
5546);
5547#[doc = "Returns a list of users in the project."]
5548pub fn list_project_users<C, Fut, B, E>(
5549 client: C,
5550 params: &crate::__types::ListProjectUsersParams,
5551) -> ListProjectUsers<Fut, B, E>
5552where
5553 C: FnOnce(http::Request<String>) -> Fut,
5554 Fut: Future<Output = Result<http::Response<B>, E>>,
5555 B: http_body::Body,
5556{
5557 ListProjectUsers(futures::TryFutureExt::and_then(
5558 crate::__combinators::Send::new(
5559 client,
5560 || {
5561 let path = {
5562 #[serde_with::serde_as]
5563 #[derive(serde :: Serialize)]
5564 struct Query<'a> {
5565 #[serde(rename = "limit")]
5566 #[serde(skip_serializing_if = "Option::is_none")]
5567 limit: &'a Option<i64>,
5568 #[serde(rename = "after")]
5569 #[serde(skip_serializing_if = "Option::is_none")]
5570 after: &'a Option<String>,
5571 #[serde(skip_serializing)]
5572 _phantom: std::marker::PhantomData<&'a ()>,
5573 }
5574 #[allow(clippy::useless_format)]
5575 let mut path = format!(
5576 "/organization/projects/{project_id}/users",
5577 project_id = params.project_id
5578 );
5579 let crate::__types::ListProjectUsersParams { limit, after, .. } = params;
5580 let query = serde_urlencoded::to_string(Query {
5581 limit,
5582 after,
5583 _phantom: std::marker::PhantomData,
5584 })?;
5585 if !query.is_empty() {
5586 path.push('?');
5587 path.push_str(&query);
5588 }
5589 path
5590 };
5591 let body = String::new();
5592 Ok(http::Request::builder()
5593 .method(http::Method::GET)
5594 .uri(path)
5595 .header(http::header::CONTENT_LENGTH, body.len())
5596 .body(body)?)
5597 },
5598 (
5599 http::StatusCode::from_u16(200u16).unwrap(),
5600 Some(mime::APPLICATION_JSON),
5601 ),
5602 ),
5603 crate::__combinators::Json::new,
5604 ))
5605}
5606future!(
5607 ListProjectUsers,
5608 futures::future::AndThen<
5609 crate::__combinators::Send<Fut, B, E>,
5610 crate::__combinators::Json<B, E, crate::__types::ProjectUserListResponse>,
5611 fn(
5612 http::Response<B>,
5613 ) -> crate::__combinators::Json<B, E, crate::__types::ProjectUserListResponse>,
5614 >,
5615 crate::__types::ProjectUserListResponse
5616);
5617#[doc = "Adds a user to the project. Users must already be members of the organization to be added to a project."]
5618pub fn create_project_user<C, Fut, B, E>(
5619 client: C,
5620 params: &crate::__types::CreateProjectUserParams,
5621 request: &crate::__types::ProjectUserCreateRequest,
5622) -> CreateProjectUser<Fut, B, E>
5623where
5624 C: FnOnce(http::Request<String>) -> Fut,
5625 Fut: Future<Output = Result<http::Response<B>, E>>,
5626 B: http_body::Body,
5627{
5628 CreateProjectUser(futures::TryFutureExt::and_then(
5629 crate::__combinators::Send::new(
5630 client,
5631 || {
5632 let path = {
5633 #[serde_with::serde_as]
5634 #[derive(serde :: Serialize)]
5635 struct Query<'a> {
5636 #[serde(skip_serializing)]
5637 _phantom: std::marker::PhantomData<&'a ()>,
5638 }
5639 #[allow(clippy::useless_format)]
5640 let mut path = format!(
5641 "/organization/projects/{project_id}/users",
5642 project_id = params.project_id
5643 );
5644 let crate::__types::CreateProjectUserParams { .. } = params;
5645 let query = serde_urlencoded::to_string(Query {
5646 _phantom: std::marker::PhantomData,
5647 })?;
5648 if !query.is_empty() {
5649 path.push('?');
5650 path.push_str(&query);
5651 }
5652 path
5653 };
5654 let body = serde_json::to_string(request)?;
5655 Ok(http::Request::builder()
5656 .method(http::Method::POST)
5657 .uri(path)
5658 .header(http::header::CONTENT_LENGTH, body.len())
5659 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
5660 .body(body)?)
5661 },
5662 (
5663 http::StatusCode::from_u16(200u16).unwrap(),
5664 Some(mime::APPLICATION_JSON),
5665 ),
5666 ),
5667 crate::__combinators::Json::new,
5668 ))
5669}
5670future!(
5671 CreateProjectUser,
5672 futures::future::AndThen<
5673 crate::__combinators::Send<Fut, B, E>,
5674 crate::__combinators::Json<B, E, crate::__types::ProjectUser>,
5675 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::ProjectUser>,
5676 >,
5677 crate::__types::ProjectUser
5678);
5679#[doc = "Retrieves a user in the project."]
5680pub fn retrieve_project_user<C, Fut, B, E>(
5681 client: C,
5682 params: &crate::__types::RetrieveProjectUserParams,
5683) -> RetrieveProjectUser<Fut, B, E>
5684where
5685 C: FnOnce(http::Request<String>) -> Fut,
5686 Fut: Future<Output = Result<http::Response<B>, E>>,
5687 B: http_body::Body,
5688{
5689 RetrieveProjectUser(futures::TryFutureExt::and_then(
5690 crate::__combinators::Send::new(
5691 client,
5692 || {
5693 let path = {
5694 #[serde_with::serde_as]
5695 #[derive(serde :: Serialize)]
5696 struct Query<'a> {
5697 #[serde(skip_serializing)]
5698 _phantom: std::marker::PhantomData<&'a ()>,
5699 }
5700 #[allow(clippy::useless_format)]
5701 let mut path = format!(
5702 "/organization/projects/{project_id}/users/{user_id}",
5703 project_id = params.project_id,
5704 user_id = params.user_id
5705 );
5706 let crate::__types::RetrieveProjectUserParams { .. } = params;
5707 let query = serde_urlencoded::to_string(Query {
5708 _phantom: std::marker::PhantomData,
5709 })?;
5710 if !query.is_empty() {
5711 path.push('?');
5712 path.push_str(&query);
5713 }
5714 path
5715 };
5716 let body = String::new();
5717 Ok(http::Request::builder()
5718 .method(http::Method::GET)
5719 .uri(path)
5720 .header(http::header::CONTENT_LENGTH, body.len())
5721 .body(body)?)
5722 },
5723 (
5724 http::StatusCode::from_u16(200u16).unwrap(),
5725 Some(mime::APPLICATION_JSON),
5726 ),
5727 ),
5728 crate::__combinators::Json::new,
5729 ))
5730}
5731future!(
5732 RetrieveProjectUser,
5733 futures::future::AndThen<
5734 crate::__combinators::Send<Fut, B, E>,
5735 crate::__combinators::Json<B, E, crate::__types::ProjectUser>,
5736 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::ProjectUser>,
5737 >,
5738 crate::__types::ProjectUser
5739);
5740#[doc = "Modifies a user's role in the project."]
5741pub fn modify_project_user<C, Fut, B, E>(
5742 client: C,
5743 params: &crate::__types::ModifyProjectUserParams,
5744 request: &crate::__types::ProjectUserUpdateRequest,
5745) -> ModifyProjectUser<Fut, B, E>
5746where
5747 C: FnOnce(http::Request<String>) -> Fut,
5748 Fut: Future<Output = Result<http::Response<B>, E>>,
5749 B: http_body::Body,
5750{
5751 ModifyProjectUser(futures::TryFutureExt::and_then(
5752 crate::__combinators::Send::new(
5753 client,
5754 || {
5755 let path = {
5756 #[serde_with::serde_as]
5757 #[derive(serde :: Serialize)]
5758 struct Query<'a> {
5759 #[serde(skip_serializing)]
5760 _phantom: std::marker::PhantomData<&'a ()>,
5761 }
5762 #[allow(clippy::useless_format)]
5763 let mut path = format!(
5764 "/organization/projects/{project_id}/users/{user_id}",
5765 project_id = params.project_id,
5766 user_id = params.user_id
5767 );
5768 let crate::__types::ModifyProjectUserParams { .. } = params;
5769 let query = serde_urlencoded::to_string(Query {
5770 _phantom: std::marker::PhantomData,
5771 })?;
5772 if !query.is_empty() {
5773 path.push('?');
5774 path.push_str(&query);
5775 }
5776 path
5777 };
5778 let body = serde_json::to_string(request)?;
5779 Ok(http::Request::builder()
5780 .method(http::Method::POST)
5781 .uri(path)
5782 .header(http::header::CONTENT_LENGTH, body.len())
5783 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
5784 .body(body)?)
5785 },
5786 (
5787 http::StatusCode::from_u16(200u16).unwrap(),
5788 Some(mime::APPLICATION_JSON),
5789 ),
5790 ),
5791 crate::__combinators::Json::new,
5792 ))
5793}
5794future!(
5795 ModifyProjectUser,
5796 futures::future::AndThen<
5797 crate::__combinators::Send<Fut, B, E>,
5798 crate::__combinators::Json<B, E, crate::__types::ProjectUser>,
5799 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::ProjectUser>,
5800 >,
5801 crate::__types::ProjectUser
5802);
5803#[doc = "Deletes a user from the project."]
5804pub fn delete_project_user<C, Fut, B, E>(
5805 client: C,
5806 params: &crate::__types::DeleteProjectUserParams,
5807) -> DeleteProjectUser<Fut, B, E>
5808where
5809 C: FnOnce(http::Request<String>) -> Fut,
5810 Fut: Future<Output = Result<http::Response<B>, E>>,
5811 B: http_body::Body,
5812{
5813 DeleteProjectUser(futures::TryFutureExt::and_then(
5814 crate::__combinators::Send::new(
5815 client,
5816 || {
5817 let path = {
5818 #[serde_with::serde_as]
5819 #[derive(serde :: Serialize)]
5820 struct Query<'a> {
5821 #[serde(skip_serializing)]
5822 _phantom: std::marker::PhantomData<&'a ()>,
5823 }
5824 #[allow(clippy::useless_format)]
5825 let mut path = format!(
5826 "/organization/projects/{project_id}/users/{user_id}",
5827 project_id = params.project_id,
5828 user_id = params.user_id
5829 );
5830 let crate::__types::DeleteProjectUserParams { .. } = params;
5831 let query = serde_urlencoded::to_string(Query {
5832 _phantom: std::marker::PhantomData,
5833 })?;
5834 if !query.is_empty() {
5835 path.push('?');
5836 path.push_str(&query);
5837 }
5838 path
5839 };
5840 let body = String::new();
5841 Ok(http::Request::builder()
5842 .method(http::Method::DELETE)
5843 .uri(path)
5844 .header(http::header::CONTENT_LENGTH, body.len())
5845 .body(body)?)
5846 },
5847 (
5848 http::StatusCode::from_u16(200u16).unwrap(),
5849 Some(mime::APPLICATION_JSON),
5850 ),
5851 ),
5852 crate::__combinators::Json::new,
5853 ))
5854}
5855future!(
5856 DeleteProjectUser,
5857 futures::future::AndThen<
5858 crate::__combinators::Send<Fut, B, E>,
5859 crate::__combinators::Json<B, E, crate::__types::ProjectUserDeleteResponse>,
5860 fn(
5861 http::Response<B>,
5862 ) -> crate::__combinators::Json<B, E, crate::__types::ProjectUserDeleteResponse>,
5863 >,
5864 crate::__types::ProjectUserDeleteResponse
5865);
5866#[doc = "Get audio speeches usage details for the organization."]
5867pub fn usage_audio_speeches<C, Fut, B, E>(
5868 client: C,
5869 params: &crate::__types::UsageAudioSpeechesParams,
5870) -> UsageAudioSpeeches<Fut, B, E>
5871where
5872 C: FnOnce(http::Request<String>) -> Fut,
5873 Fut: Future<Output = Result<http::Response<B>, E>>,
5874 B: http_body::Body,
5875{
5876 UsageAudioSpeeches(futures::TryFutureExt::and_then(
5877 crate::__combinators::Send::new(
5878 client,
5879 || {
5880 let path = {
5881 #[serde_with::serde_as]
5882 #[derive(serde :: Serialize)]
5883 struct Query<'a> {
5884 #[serde(rename = "start_time")]
5885 start_time: &'a i64,
5886 #[serde(rename = "end_time")]
5887 #[serde(skip_serializing_if = "Option::is_none")]
5888 end_time: &'a Option<i64>,
5889 #[serde(rename = "bucket_width")]
5890 #[serde(skip_serializing_if = "Option::is_none")]
5891 bucket_width:
5892 &'a Option<crate::__types::UsageAudioSpeechesParamsBucketWidth>,
5893 #[serde(rename = "project_ids")]
5894 #[serde(skip_serializing_if = "Option::is_none")]
5895 project_ids: &'a Option<Vec<String>>,
5896 #[serde(rename = "user_ids")]
5897 #[serde(skip_serializing_if = "Option::is_none")]
5898 user_ids: &'a Option<Vec<String>>,
5899 #[serde(rename = "api_key_ids")]
5900 #[serde(skip_serializing_if = "Option::is_none")]
5901 api_key_ids: &'a Option<Vec<String>>,
5902 #[serde(rename = "models")]
5903 #[serde(skip_serializing_if = "Option::is_none")]
5904 models: &'a Option<Vec<String>>,
5905 #[serde(rename = "group_by")]
5906 #[serde(skip_serializing_if = "Option::is_none")]
5907 group_by: &'a Option<Vec<crate::__types::UsageAudioSpeechesParamsGroupBy>>,
5908 #[serde(rename = "limit")]
5909 #[serde(skip_serializing_if = "Option::is_none")]
5910 limit: &'a Option<i64>,
5911 #[serde(rename = "page")]
5912 #[serde(skip_serializing_if = "Option::is_none")]
5913 page: &'a Option<String>,
5914 #[serde(skip_serializing)]
5915 _phantom: std::marker::PhantomData<&'a ()>,
5916 }
5917 #[allow(clippy::useless_format)]
5918 let mut path = format!("/organization/usage/audio_speeches",);
5919 let crate::__types::UsageAudioSpeechesParams {
5920 start_time,
5921 end_time,
5922 bucket_width,
5923 project_ids,
5924 user_ids,
5925 api_key_ids,
5926 models,
5927 group_by,
5928 limit,
5929 page,
5930 ..
5931 } = params;
5932 let query = serde_urlencoded::to_string(Query {
5933 start_time,
5934 end_time,
5935 bucket_width,
5936 project_ids,
5937 user_ids,
5938 api_key_ids,
5939 models,
5940 group_by,
5941 limit,
5942 page,
5943 _phantom: std::marker::PhantomData,
5944 })?;
5945 if !query.is_empty() {
5946 path.push('?');
5947 path.push_str(&query);
5948 }
5949 path
5950 };
5951 let body = String::new();
5952 Ok(http::Request::builder()
5953 .method(http::Method::GET)
5954 .uri(path)
5955 .header(http::header::CONTENT_LENGTH, body.len())
5956 .body(body)?)
5957 },
5958 (
5959 http::StatusCode::from_u16(200u16).unwrap(),
5960 Some(mime::APPLICATION_JSON),
5961 ),
5962 ),
5963 crate::__combinators::Json::new,
5964 ))
5965}
5966future!(
5967 UsageAudioSpeeches,
5968 futures::future::AndThen<
5969 crate::__combinators::Send<Fut, B, E>,
5970 crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
5971 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
5972 >,
5973 crate::__types::UsageResponse
5974);
5975#[doc = "Get audio transcriptions usage details for the organization."]
5976pub fn usage_audio_transcriptions<C, Fut, B, E>(
5977 client: C,
5978 params: &crate::__types::UsageAudioTranscriptionsParams,
5979) -> UsageAudioTranscriptions<Fut, B, E>
5980where
5981 C: FnOnce(http::Request<String>) -> Fut,
5982 Fut: Future<Output = Result<http::Response<B>, E>>,
5983 B: http_body::Body,
5984{
5985 UsageAudioTranscriptions(futures::TryFutureExt::and_then(
5986 crate::__combinators::Send::new(
5987 client,
5988 || {
5989 let path = {
5990 #[serde_with::serde_as]
5991 #[derive(serde :: Serialize)]
5992 struct Query<'a> {
5993 #[serde(rename = "start_time")]
5994 start_time: &'a i64,
5995 #[serde(rename = "end_time")]
5996 #[serde(skip_serializing_if = "Option::is_none")]
5997 end_time: &'a Option<i64>,
5998 #[serde(rename = "bucket_width")]
5999 #[serde(skip_serializing_if = "Option::is_none")]
6000 bucket_width:
6001 &'a Option<crate::__types::UsageAudioTranscriptionsParamsBucketWidth>,
6002 #[serde(rename = "project_ids")]
6003 #[serde(skip_serializing_if = "Option::is_none")]
6004 project_ids: &'a Option<Vec<String>>,
6005 #[serde(rename = "user_ids")]
6006 #[serde(skip_serializing_if = "Option::is_none")]
6007 user_ids: &'a Option<Vec<String>>,
6008 #[serde(rename = "api_key_ids")]
6009 #[serde(skip_serializing_if = "Option::is_none")]
6010 api_key_ids: &'a Option<Vec<String>>,
6011 #[serde(rename = "models")]
6012 #[serde(skip_serializing_if = "Option::is_none")]
6013 models: &'a Option<Vec<String>>,
6014 #[serde(rename = "group_by")]
6015 #[serde(skip_serializing_if = "Option::is_none")]
6016 group_by:
6017 &'a Option<Vec<crate::__types::UsageAudioTranscriptionsParamsGroupBy>>,
6018 #[serde(rename = "limit")]
6019 #[serde(skip_serializing_if = "Option::is_none")]
6020 limit: &'a Option<i64>,
6021 #[serde(rename = "page")]
6022 #[serde(skip_serializing_if = "Option::is_none")]
6023 page: &'a Option<String>,
6024 #[serde(skip_serializing)]
6025 _phantom: std::marker::PhantomData<&'a ()>,
6026 }
6027 #[allow(clippy::useless_format)]
6028 let mut path = format!("/organization/usage/audio_transcriptions",);
6029 let crate::__types::UsageAudioTranscriptionsParams {
6030 start_time,
6031 end_time,
6032 bucket_width,
6033 project_ids,
6034 user_ids,
6035 api_key_ids,
6036 models,
6037 group_by,
6038 limit,
6039 page,
6040 ..
6041 } = params;
6042 let query = serde_urlencoded::to_string(Query {
6043 start_time,
6044 end_time,
6045 bucket_width,
6046 project_ids,
6047 user_ids,
6048 api_key_ids,
6049 models,
6050 group_by,
6051 limit,
6052 page,
6053 _phantom: std::marker::PhantomData,
6054 })?;
6055 if !query.is_empty() {
6056 path.push('?');
6057 path.push_str(&query);
6058 }
6059 path
6060 };
6061 let body = String::new();
6062 Ok(http::Request::builder()
6063 .method(http::Method::GET)
6064 .uri(path)
6065 .header(http::header::CONTENT_LENGTH, body.len())
6066 .body(body)?)
6067 },
6068 (
6069 http::StatusCode::from_u16(200u16).unwrap(),
6070 Some(mime::APPLICATION_JSON),
6071 ),
6072 ),
6073 crate::__combinators::Json::new,
6074 ))
6075}
6076future!(
6077 UsageAudioTranscriptions,
6078 futures::future::AndThen<
6079 crate::__combinators::Send<Fut, B, E>,
6080 crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
6081 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
6082 >,
6083 crate::__types::UsageResponse
6084);
6085#[doc = "Get code interpreter sessions usage details for the organization."]
6086pub fn usage_code_interpreter_sessions<C, Fut, B, E>(
6087 client: C,
6088 params: &crate::__types::UsageCodeInterpreterSessionsParams,
6089) -> UsageCodeInterpreterSessions<Fut, B, E>
6090where
6091 C: FnOnce(http::Request<String>) -> Fut,
6092 Fut: Future<Output = Result<http::Response<B>, E>>,
6093 B: http_body::Body,
6094{
6095 UsageCodeInterpreterSessions(futures::TryFutureExt::and_then(
6096 crate::__combinators::Send::new(
6097 client,
6098 || {
6099 let path = {
6100 #[serde_with::serde_as]
6101 #[derive(serde :: Serialize)]
6102 struct Query<'a> {
6103 #[serde(rename = "start_time")]
6104 start_time: &'a i64,
6105 #[serde(rename = "end_time")]
6106 #[serde(skip_serializing_if = "Option::is_none")]
6107 end_time: &'a Option<i64>,
6108 #[serde(rename = "bucket_width")]
6109 #[serde(skip_serializing_if = "Option::is_none")]
6110 bucket_width: &'a Option<
6111 crate::__types::UsageCodeInterpreterSessionsParamsBucketWidth,
6112 >,
6113 #[serde(rename = "project_ids")]
6114 #[serde(skip_serializing_if = "Option::is_none")]
6115 project_ids: &'a Option<Vec<String>>,
6116 #[serde(rename = "group_by")]
6117 #[serde(skip_serializing_if = "Option::is_none")]
6118 group_by: &'a Option<
6119 Vec<crate::__types::UsageCodeInterpreterSessionsParamsGroupBy>,
6120 >,
6121 #[serde(rename = "limit")]
6122 #[serde(skip_serializing_if = "Option::is_none")]
6123 limit: &'a Option<i64>,
6124 #[serde(rename = "page")]
6125 #[serde(skip_serializing_if = "Option::is_none")]
6126 page: &'a Option<String>,
6127 #[serde(skip_serializing)]
6128 _phantom: std::marker::PhantomData<&'a ()>,
6129 }
6130 #[allow(clippy::useless_format)]
6131 let mut path = format!("/organization/usage/code_interpreter_sessions",);
6132 let crate::__types::UsageCodeInterpreterSessionsParams {
6133 start_time,
6134 end_time,
6135 bucket_width,
6136 project_ids,
6137 group_by,
6138 limit,
6139 page,
6140 ..
6141 } = params;
6142 let query = serde_urlencoded::to_string(Query {
6143 start_time,
6144 end_time,
6145 bucket_width,
6146 project_ids,
6147 group_by,
6148 limit,
6149 page,
6150 _phantom: std::marker::PhantomData,
6151 })?;
6152 if !query.is_empty() {
6153 path.push('?');
6154 path.push_str(&query);
6155 }
6156 path
6157 };
6158 let body = String::new();
6159 Ok(http::Request::builder()
6160 .method(http::Method::GET)
6161 .uri(path)
6162 .header(http::header::CONTENT_LENGTH, body.len())
6163 .body(body)?)
6164 },
6165 (
6166 http::StatusCode::from_u16(200u16).unwrap(),
6167 Some(mime::APPLICATION_JSON),
6168 ),
6169 ),
6170 crate::__combinators::Json::new,
6171 ))
6172}
6173future!(
6174 UsageCodeInterpreterSessions,
6175 futures::future::AndThen<
6176 crate::__combinators::Send<Fut, B, E>,
6177 crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
6178 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
6179 >,
6180 crate::__types::UsageResponse
6181);
6182#[doc = "Get completions usage details for the organization."]
6183pub fn usage_completions<C, Fut, B, E>(
6184 client: C,
6185 params: &crate::__types::UsageCompletionsParams,
6186) -> UsageCompletions<Fut, B, E>
6187where
6188 C: FnOnce(http::Request<String>) -> Fut,
6189 Fut: Future<Output = Result<http::Response<B>, E>>,
6190 B: http_body::Body,
6191{
6192 UsageCompletions(futures::TryFutureExt::and_then(
6193 crate::__combinators::Send::new(
6194 client,
6195 || {
6196 let path = {
6197 #[serde_with::serde_as]
6198 #[derive(serde :: Serialize)]
6199 struct Query<'a> {
6200 #[serde(rename = "start_time")]
6201 start_time: &'a i64,
6202 #[serde(rename = "end_time")]
6203 #[serde(skip_serializing_if = "Option::is_none")]
6204 end_time: &'a Option<i64>,
6205 #[serde(rename = "bucket_width")]
6206 #[serde(skip_serializing_if = "Option::is_none")]
6207 bucket_width: &'a Option<crate::__types::UsageCompletionsParamsBucketWidth>,
6208 #[serde(rename = "project_ids")]
6209 #[serde(skip_serializing_if = "Option::is_none")]
6210 project_ids: &'a Option<Vec<String>>,
6211 #[serde(rename = "user_ids")]
6212 #[serde(skip_serializing_if = "Option::is_none")]
6213 user_ids: &'a Option<Vec<String>>,
6214 #[serde(rename = "api_key_ids")]
6215 #[serde(skip_serializing_if = "Option::is_none")]
6216 api_key_ids: &'a Option<Vec<String>>,
6217 #[serde(rename = "models")]
6218 #[serde(skip_serializing_if = "Option::is_none")]
6219 models: &'a Option<Vec<String>>,
6220 #[serde(rename = "batch")]
6221 #[serde(skip_serializing_if = "Option::is_none")]
6222 batch: &'a Option<bool>,
6223 #[serde(rename = "group_by")]
6224 #[serde(skip_serializing_if = "Option::is_none")]
6225 group_by: &'a Option<Vec<crate::__types::UsageCompletionsParamsGroupBy>>,
6226 #[serde(rename = "limit")]
6227 #[serde(skip_serializing_if = "Option::is_none")]
6228 limit: &'a Option<i64>,
6229 #[serde(rename = "page")]
6230 #[serde(skip_serializing_if = "Option::is_none")]
6231 page: &'a Option<String>,
6232 #[serde(skip_serializing)]
6233 _phantom: std::marker::PhantomData<&'a ()>,
6234 }
6235 #[allow(clippy::useless_format)]
6236 let mut path = format!("/organization/usage/completions",);
6237 let crate::__types::UsageCompletionsParams {
6238 start_time,
6239 end_time,
6240 bucket_width,
6241 project_ids,
6242 user_ids,
6243 api_key_ids,
6244 models,
6245 batch,
6246 group_by,
6247 limit,
6248 page,
6249 ..
6250 } = params;
6251 let query = serde_urlencoded::to_string(Query {
6252 start_time,
6253 end_time,
6254 bucket_width,
6255 project_ids,
6256 user_ids,
6257 api_key_ids,
6258 models,
6259 batch,
6260 group_by,
6261 limit,
6262 page,
6263 _phantom: std::marker::PhantomData,
6264 })?;
6265 if !query.is_empty() {
6266 path.push('?');
6267 path.push_str(&query);
6268 }
6269 path
6270 };
6271 let body = String::new();
6272 Ok(http::Request::builder()
6273 .method(http::Method::GET)
6274 .uri(path)
6275 .header(http::header::CONTENT_LENGTH, body.len())
6276 .body(body)?)
6277 },
6278 (
6279 http::StatusCode::from_u16(200u16).unwrap(),
6280 Some(mime::APPLICATION_JSON),
6281 ),
6282 ),
6283 crate::__combinators::Json::new,
6284 ))
6285}
6286future!(
6287 UsageCompletions,
6288 futures::future::AndThen<
6289 crate::__combinators::Send<Fut, B, E>,
6290 crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
6291 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
6292 >,
6293 crate::__types::UsageResponse
6294);
6295#[doc = "Get embeddings usage details for the organization."]
6296pub fn usage_embeddings<C, Fut, B, E>(
6297 client: C,
6298 params: &crate::__types::UsageEmbeddingsParams,
6299) -> UsageEmbeddings<Fut, B, E>
6300where
6301 C: FnOnce(http::Request<String>) -> Fut,
6302 Fut: Future<Output = Result<http::Response<B>, E>>,
6303 B: http_body::Body,
6304{
6305 UsageEmbeddings(futures::TryFutureExt::and_then(
6306 crate::__combinators::Send::new(
6307 client,
6308 || {
6309 let path = {
6310 #[serde_with::serde_as]
6311 #[derive(serde :: Serialize)]
6312 struct Query<'a> {
6313 #[serde(rename = "start_time")]
6314 start_time: &'a i64,
6315 #[serde(rename = "end_time")]
6316 #[serde(skip_serializing_if = "Option::is_none")]
6317 end_time: &'a Option<i64>,
6318 #[serde(rename = "bucket_width")]
6319 #[serde(skip_serializing_if = "Option::is_none")]
6320 bucket_width: &'a Option<crate::__types::UsageEmbeddingsParamsBucketWidth>,
6321 #[serde(rename = "project_ids")]
6322 #[serde(skip_serializing_if = "Option::is_none")]
6323 project_ids: &'a Option<Vec<String>>,
6324 #[serde(rename = "user_ids")]
6325 #[serde(skip_serializing_if = "Option::is_none")]
6326 user_ids: &'a Option<Vec<String>>,
6327 #[serde(rename = "api_key_ids")]
6328 #[serde(skip_serializing_if = "Option::is_none")]
6329 api_key_ids: &'a Option<Vec<String>>,
6330 #[serde(rename = "models")]
6331 #[serde(skip_serializing_if = "Option::is_none")]
6332 models: &'a Option<Vec<String>>,
6333 #[serde(rename = "group_by")]
6334 #[serde(skip_serializing_if = "Option::is_none")]
6335 group_by: &'a Option<Vec<crate::__types::UsageEmbeddingsParamsGroupBy>>,
6336 #[serde(rename = "limit")]
6337 #[serde(skip_serializing_if = "Option::is_none")]
6338 limit: &'a Option<i64>,
6339 #[serde(rename = "page")]
6340 #[serde(skip_serializing_if = "Option::is_none")]
6341 page: &'a Option<String>,
6342 #[serde(skip_serializing)]
6343 _phantom: std::marker::PhantomData<&'a ()>,
6344 }
6345 #[allow(clippy::useless_format)]
6346 let mut path = format!("/organization/usage/embeddings",);
6347 let crate::__types::UsageEmbeddingsParams {
6348 start_time,
6349 end_time,
6350 bucket_width,
6351 project_ids,
6352 user_ids,
6353 api_key_ids,
6354 models,
6355 group_by,
6356 limit,
6357 page,
6358 ..
6359 } = params;
6360 let query = serde_urlencoded::to_string(Query {
6361 start_time,
6362 end_time,
6363 bucket_width,
6364 project_ids,
6365 user_ids,
6366 api_key_ids,
6367 models,
6368 group_by,
6369 limit,
6370 page,
6371 _phantom: std::marker::PhantomData,
6372 })?;
6373 if !query.is_empty() {
6374 path.push('?');
6375 path.push_str(&query);
6376 }
6377 path
6378 };
6379 let body = String::new();
6380 Ok(http::Request::builder()
6381 .method(http::Method::GET)
6382 .uri(path)
6383 .header(http::header::CONTENT_LENGTH, body.len())
6384 .body(body)?)
6385 },
6386 (
6387 http::StatusCode::from_u16(200u16).unwrap(),
6388 Some(mime::APPLICATION_JSON),
6389 ),
6390 ),
6391 crate::__combinators::Json::new,
6392 ))
6393}
6394future!(
6395 UsageEmbeddings,
6396 futures::future::AndThen<
6397 crate::__combinators::Send<Fut, B, E>,
6398 crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
6399 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
6400 >,
6401 crate::__types::UsageResponse
6402);
6403#[doc = "Get images usage details for the organization."]
6404pub fn usage_images<C, Fut, B, E>(
6405 client: C,
6406 params: &crate::__types::UsageImagesParams,
6407) -> UsageImages<Fut, B, E>
6408where
6409 C: FnOnce(http::Request<String>) -> Fut,
6410 Fut: Future<Output = Result<http::Response<B>, E>>,
6411 B: http_body::Body,
6412{
6413 UsageImages(futures::TryFutureExt::and_then(
6414 crate::__combinators::Send::new(
6415 client,
6416 || {
6417 let path = {
6418 #[serde_with::serde_as]
6419 #[derive(serde :: Serialize)]
6420 struct Query<'a> {
6421 #[serde(rename = "start_time")]
6422 start_time: &'a i64,
6423 #[serde(rename = "end_time")]
6424 #[serde(skip_serializing_if = "Option::is_none")]
6425 end_time: &'a Option<i64>,
6426 #[serde(rename = "bucket_width")]
6427 #[serde(skip_serializing_if = "Option::is_none")]
6428 bucket_width: &'a Option<crate::__types::UsageImagesParamsBucketWidth>,
6429 #[serde(rename = "sources")]
6430 #[serde(skip_serializing_if = "Option::is_none")]
6431 sources: &'a Option<Vec<crate::__types::UsageImagesParamsSources>>,
6432 #[serde(rename = "sizes")]
6433 #[serde(skip_serializing_if = "Option::is_none")]
6434 sizes: &'a Option<Vec<crate::__types::UsageImagesParamsSizes>>,
6435 #[serde(rename = "project_ids")]
6436 #[serde(skip_serializing_if = "Option::is_none")]
6437 project_ids: &'a Option<Vec<String>>,
6438 #[serde(rename = "user_ids")]
6439 #[serde(skip_serializing_if = "Option::is_none")]
6440 user_ids: &'a Option<Vec<String>>,
6441 #[serde(rename = "api_key_ids")]
6442 #[serde(skip_serializing_if = "Option::is_none")]
6443 api_key_ids: &'a Option<Vec<String>>,
6444 #[serde(rename = "models")]
6445 #[serde(skip_serializing_if = "Option::is_none")]
6446 models: &'a Option<Vec<String>>,
6447 #[serde(rename = "group_by")]
6448 #[serde(skip_serializing_if = "Option::is_none")]
6449 group_by: &'a Option<Vec<crate::__types::UsageImagesParamsGroupBy>>,
6450 #[serde(rename = "limit")]
6451 #[serde(skip_serializing_if = "Option::is_none")]
6452 limit: &'a Option<i64>,
6453 #[serde(rename = "page")]
6454 #[serde(skip_serializing_if = "Option::is_none")]
6455 page: &'a Option<String>,
6456 #[serde(skip_serializing)]
6457 _phantom: std::marker::PhantomData<&'a ()>,
6458 }
6459 #[allow(clippy::useless_format)]
6460 let mut path = format!("/organization/usage/images",);
6461 let crate::__types::UsageImagesParams {
6462 start_time,
6463 end_time,
6464 bucket_width,
6465 sources,
6466 sizes,
6467 project_ids,
6468 user_ids,
6469 api_key_ids,
6470 models,
6471 group_by,
6472 limit,
6473 page,
6474 ..
6475 } = params;
6476 let query = serde_urlencoded::to_string(Query {
6477 start_time,
6478 end_time,
6479 bucket_width,
6480 sources,
6481 sizes,
6482 project_ids,
6483 user_ids,
6484 api_key_ids,
6485 models,
6486 group_by,
6487 limit,
6488 page,
6489 _phantom: std::marker::PhantomData,
6490 })?;
6491 if !query.is_empty() {
6492 path.push('?');
6493 path.push_str(&query);
6494 }
6495 path
6496 };
6497 let body = String::new();
6498 Ok(http::Request::builder()
6499 .method(http::Method::GET)
6500 .uri(path)
6501 .header(http::header::CONTENT_LENGTH, body.len())
6502 .body(body)?)
6503 },
6504 (
6505 http::StatusCode::from_u16(200u16).unwrap(),
6506 Some(mime::APPLICATION_JSON),
6507 ),
6508 ),
6509 crate::__combinators::Json::new,
6510 ))
6511}
6512future!(
6513 UsageImages,
6514 futures::future::AndThen<
6515 crate::__combinators::Send<Fut, B, E>,
6516 crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
6517 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
6518 >,
6519 crate::__types::UsageResponse
6520);
6521#[doc = "Get moderations usage details for the organization."]
6522pub fn usage_moderations<C, Fut, B, E>(
6523 client: C,
6524 params: &crate::__types::UsageModerationsParams,
6525) -> UsageModerations<Fut, B, E>
6526where
6527 C: FnOnce(http::Request<String>) -> Fut,
6528 Fut: Future<Output = Result<http::Response<B>, E>>,
6529 B: http_body::Body,
6530{
6531 UsageModerations(futures::TryFutureExt::and_then(
6532 crate::__combinators::Send::new(
6533 client,
6534 || {
6535 let path = {
6536 #[serde_with::serde_as]
6537 #[derive(serde :: Serialize)]
6538 struct Query<'a> {
6539 #[serde(rename = "start_time")]
6540 start_time: &'a i64,
6541 #[serde(rename = "end_time")]
6542 #[serde(skip_serializing_if = "Option::is_none")]
6543 end_time: &'a Option<i64>,
6544 #[serde(rename = "bucket_width")]
6545 #[serde(skip_serializing_if = "Option::is_none")]
6546 bucket_width: &'a Option<crate::__types::UsageModerationsParamsBucketWidth>,
6547 #[serde(rename = "project_ids")]
6548 #[serde(skip_serializing_if = "Option::is_none")]
6549 project_ids: &'a Option<Vec<String>>,
6550 #[serde(rename = "user_ids")]
6551 #[serde(skip_serializing_if = "Option::is_none")]
6552 user_ids: &'a Option<Vec<String>>,
6553 #[serde(rename = "api_key_ids")]
6554 #[serde(skip_serializing_if = "Option::is_none")]
6555 api_key_ids: &'a Option<Vec<String>>,
6556 #[serde(rename = "models")]
6557 #[serde(skip_serializing_if = "Option::is_none")]
6558 models: &'a Option<Vec<String>>,
6559 #[serde(rename = "group_by")]
6560 #[serde(skip_serializing_if = "Option::is_none")]
6561 group_by: &'a Option<Vec<crate::__types::UsageModerationsParamsGroupBy>>,
6562 #[serde(rename = "limit")]
6563 #[serde(skip_serializing_if = "Option::is_none")]
6564 limit: &'a Option<i64>,
6565 #[serde(rename = "page")]
6566 #[serde(skip_serializing_if = "Option::is_none")]
6567 page: &'a Option<String>,
6568 #[serde(skip_serializing)]
6569 _phantom: std::marker::PhantomData<&'a ()>,
6570 }
6571 #[allow(clippy::useless_format)]
6572 let mut path = format!("/organization/usage/moderations",);
6573 let crate::__types::UsageModerationsParams {
6574 start_time,
6575 end_time,
6576 bucket_width,
6577 project_ids,
6578 user_ids,
6579 api_key_ids,
6580 models,
6581 group_by,
6582 limit,
6583 page,
6584 ..
6585 } = params;
6586 let query = serde_urlencoded::to_string(Query {
6587 start_time,
6588 end_time,
6589 bucket_width,
6590 project_ids,
6591 user_ids,
6592 api_key_ids,
6593 models,
6594 group_by,
6595 limit,
6596 page,
6597 _phantom: std::marker::PhantomData,
6598 })?;
6599 if !query.is_empty() {
6600 path.push('?');
6601 path.push_str(&query);
6602 }
6603 path
6604 };
6605 let body = String::new();
6606 Ok(http::Request::builder()
6607 .method(http::Method::GET)
6608 .uri(path)
6609 .header(http::header::CONTENT_LENGTH, body.len())
6610 .body(body)?)
6611 },
6612 (
6613 http::StatusCode::from_u16(200u16).unwrap(),
6614 Some(mime::APPLICATION_JSON),
6615 ),
6616 ),
6617 crate::__combinators::Json::new,
6618 ))
6619}
6620future!(
6621 UsageModerations,
6622 futures::future::AndThen<
6623 crate::__combinators::Send<Fut, B, E>,
6624 crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
6625 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
6626 >,
6627 crate::__types::UsageResponse
6628);
6629#[doc = "Get vector stores usage details for the organization."]
6630pub fn usage_vector_stores<C, Fut, B, E>(
6631 client: C,
6632 params: &crate::__types::UsageVectorStoresParams,
6633) -> UsageVectorStores<Fut, B, E>
6634where
6635 C: FnOnce(http::Request<String>) -> Fut,
6636 Fut: Future<Output = Result<http::Response<B>, E>>,
6637 B: http_body::Body,
6638{
6639 UsageVectorStores(futures::TryFutureExt::and_then(
6640 crate::__combinators::Send::new(
6641 client,
6642 || {
6643 let path = {
6644 #[serde_with::serde_as]
6645 #[derive(serde :: Serialize)]
6646 struct Query<'a> {
6647 #[serde(rename = "start_time")]
6648 start_time: &'a i64,
6649 #[serde(rename = "end_time")]
6650 #[serde(skip_serializing_if = "Option::is_none")]
6651 end_time: &'a Option<i64>,
6652 #[serde(rename = "bucket_width")]
6653 #[serde(skip_serializing_if = "Option::is_none")]
6654 bucket_width:
6655 &'a Option<crate::__types::UsageVectorStoresParamsBucketWidth>,
6656 #[serde(rename = "project_ids")]
6657 #[serde(skip_serializing_if = "Option::is_none")]
6658 project_ids: &'a Option<Vec<String>>,
6659 #[serde(rename = "group_by")]
6660 #[serde(skip_serializing_if = "Option::is_none")]
6661 group_by: &'a Option<Vec<crate::__types::UsageVectorStoresParamsGroupBy>>,
6662 #[serde(rename = "limit")]
6663 #[serde(skip_serializing_if = "Option::is_none")]
6664 limit: &'a Option<i64>,
6665 #[serde(rename = "page")]
6666 #[serde(skip_serializing_if = "Option::is_none")]
6667 page: &'a Option<String>,
6668 #[serde(skip_serializing)]
6669 _phantom: std::marker::PhantomData<&'a ()>,
6670 }
6671 #[allow(clippy::useless_format)]
6672 let mut path = format!("/organization/usage/vector_stores",);
6673 let crate::__types::UsageVectorStoresParams {
6674 start_time,
6675 end_time,
6676 bucket_width,
6677 project_ids,
6678 group_by,
6679 limit,
6680 page,
6681 ..
6682 } = params;
6683 let query = serde_urlencoded::to_string(Query {
6684 start_time,
6685 end_time,
6686 bucket_width,
6687 project_ids,
6688 group_by,
6689 limit,
6690 page,
6691 _phantom: std::marker::PhantomData,
6692 })?;
6693 if !query.is_empty() {
6694 path.push('?');
6695 path.push_str(&query);
6696 }
6697 path
6698 };
6699 let body = String::new();
6700 Ok(http::Request::builder()
6701 .method(http::Method::GET)
6702 .uri(path)
6703 .header(http::header::CONTENT_LENGTH, body.len())
6704 .body(body)?)
6705 },
6706 (
6707 http::StatusCode::from_u16(200u16).unwrap(),
6708 Some(mime::APPLICATION_JSON),
6709 ),
6710 ),
6711 crate::__combinators::Json::new,
6712 ))
6713}
6714future!(
6715 UsageVectorStores,
6716 futures::future::AndThen<
6717 crate::__combinators::Send<Fut, B, E>,
6718 crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
6719 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::UsageResponse>,
6720 >,
6721 crate::__types::UsageResponse
6722);
6723#[doc = "Lists all of the users in the organization."]
6724pub fn list_users<C, Fut, B, E>(
6725 client: C,
6726 params: &crate::__types::ListUsersParams,
6727) -> ListUsers<Fut, B, E>
6728where
6729 C: FnOnce(http::Request<String>) -> Fut,
6730 Fut: Future<Output = Result<http::Response<B>, E>>,
6731 B: http_body::Body,
6732{
6733 ListUsers(futures::TryFutureExt::and_then(
6734 crate::__combinators::Send::new(
6735 client,
6736 || {
6737 let path = {
6738 #[serde_with::serde_as]
6739 #[derive(serde :: Serialize)]
6740 struct Query<'a> {
6741 #[serde(rename = "limit")]
6742 #[serde(skip_serializing_if = "Option::is_none")]
6743 limit: &'a Option<i64>,
6744 #[serde(rename = "after")]
6745 #[serde(skip_serializing_if = "Option::is_none")]
6746 after: &'a Option<String>,
6747 #[serde(rename = "emails")]
6748 #[serde(skip_serializing_if = "Option::is_none")]
6749 emails: &'a Option<Vec<String>>,
6750 #[serde(skip_serializing)]
6751 _phantom: std::marker::PhantomData<&'a ()>,
6752 }
6753 #[allow(clippy::useless_format)]
6754 let mut path = format!("/organization/users",);
6755 let crate::__types::ListUsersParams {
6756 limit,
6757 after,
6758 emails,
6759 ..
6760 } = params;
6761 let query = serde_urlencoded::to_string(Query {
6762 limit,
6763 after,
6764 emails,
6765 _phantom: std::marker::PhantomData,
6766 })?;
6767 if !query.is_empty() {
6768 path.push('?');
6769 path.push_str(&query);
6770 }
6771 path
6772 };
6773 let body = String::new();
6774 Ok(http::Request::builder()
6775 .method(http::Method::GET)
6776 .uri(path)
6777 .header(http::header::CONTENT_LENGTH, body.len())
6778 .body(body)?)
6779 },
6780 (
6781 http::StatusCode::from_u16(200u16).unwrap(),
6782 Some(mime::APPLICATION_JSON),
6783 ),
6784 ),
6785 crate::__combinators::Json::new,
6786 ))
6787}
6788future!(
6789 ListUsers,
6790 futures::future::AndThen<
6791 crate::__combinators::Send<Fut, B, E>,
6792 crate::__combinators::Json<B, E, crate::__types::UserListResponse>,
6793 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::UserListResponse>,
6794 >,
6795 crate::__types::UserListResponse
6796);
6797#[doc = "Retrieves a user by their identifier."]
6798pub fn retrieve_user<C, Fut, B, E>(
6799 client: C,
6800 params: &crate::__types::RetrieveUserParams,
6801) -> RetrieveUser<Fut, B, E>
6802where
6803 C: FnOnce(http::Request<String>) -> Fut,
6804 Fut: Future<Output = Result<http::Response<B>, E>>,
6805 B: http_body::Body,
6806{
6807 RetrieveUser(futures::TryFutureExt::and_then(
6808 crate::__combinators::Send::new(
6809 client,
6810 || {
6811 let path = {
6812 #[serde_with::serde_as]
6813 #[derive(serde :: Serialize)]
6814 struct Query<'a> {
6815 #[serde(skip_serializing)]
6816 _phantom: std::marker::PhantomData<&'a ()>,
6817 }
6818 #[allow(clippy::useless_format)]
6819 let mut path =
6820 format!("/organization/users/{user_id}", user_id = params.user_id);
6821 let crate::__types::RetrieveUserParams { .. } = params;
6822 let query = serde_urlencoded::to_string(Query {
6823 _phantom: std::marker::PhantomData,
6824 })?;
6825 if !query.is_empty() {
6826 path.push('?');
6827 path.push_str(&query);
6828 }
6829 path
6830 };
6831 let body = String::new();
6832 Ok(http::Request::builder()
6833 .method(http::Method::GET)
6834 .uri(path)
6835 .header(http::header::CONTENT_LENGTH, body.len())
6836 .body(body)?)
6837 },
6838 (
6839 http::StatusCode::from_u16(200u16).unwrap(),
6840 Some(mime::APPLICATION_JSON),
6841 ),
6842 ),
6843 crate::__combinators::Json::new,
6844 ))
6845}
6846future!(
6847 RetrieveUser,
6848 futures::future::AndThen<
6849 crate::__combinators::Send<Fut, B, E>,
6850 crate::__combinators::Json<B, E, crate::__types::User>,
6851 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::User>,
6852 >,
6853 crate::__types::User
6854);
6855#[doc = "Modifies a user's role in the organization."]
6856pub fn modify_user<C, Fut, B, E>(
6857 client: C,
6858 params: &crate::__types::ModifyUserParams,
6859 request: &crate::__types::UserRoleUpdateRequest,
6860) -> ModifyUser<Fut, B, E>
6861where
6862 C: FnOnce(http::Request<String>) -> Fut,
6863 Fut: Future<Output = Result<http::Response<B>, E>>,
6864 B: http_body::Body,
6865{
6866 ModifyUser(futures::TryFutureExt::and_then(
6867 crate::__combinators::Send::new(
6868 client,
6869 || {
6870 let path = {
6871 #[serde_with::serde_as]
6872 #[derive(serde :: Serialize)]
6873 struct Query<'a> {
6874 #[serde(skip_serializing)]
6875 _phantom: std::marker::PhantomData<&'a ()>,
6876 }
6877 #[allow(clippy::useless_format)]
6878 let mut path =
6879 format!("/organization/users/{user_id}", user_id = params.user_id);
6880 let crate::__types::ModifyUserParams { .. } = params;
6881 let query = serde_urlencoded::to_string(Query {
6882 _phantom: std::marker::PhantomData,
6883 })?;
6884 if !query.is_empty() {
6885 path.push('?');
6886 path.push_str(&query);
6887 }
6888 path
6889 };
6890 let body = serde_json::to_string(request)?;
6891 Ok(http::Request::builder()
6892 .method(http::Method::POST)
6893 .uri(path)
6894 .header(http::header::CONTENT_LENGTH, body.len())
6895 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
6896 .body(body)?)
6897 },
6898 (
6899 http::StatusCode::from_u16(200u16).unwrap(),
6900 Some(mime::APPLICATION_JSON),
6901 ),
6902 ),
6903 crate::__combinators::Json::new,
6904 ))
6905}
6906future!(
6907 ModifyUser,
6908 futures::future::AndThen<
6909 crate::__combinators::Send<Fut, B, E>,
6910 crate::__combinators::Json<B, E, crate::__types::User>,
6911 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::User>,
6912 >,
6913 crate::__types::User
6914);
6915#[doc = "Deletes a user from the organization."]
6916pub fn delete_user<C, Fut, B, E>(
6917 client: C,
6918 params: &crate::__types::DeleteUserParams,
6919) -> DeleteUser<Fut, B, E>
6920where
6921 C: FnOnce(http::Request<String>) -> Fut,
6922 Fut: Future<Output = Result<http::Response<B>, E>>,
6923 B: http_body::Body,
6924{
6925 DeleteUser(futures::TryFutureExt::and_then(
6926 crate::__combinators::Send::new(
6927 client,
6928 || {
6929 let path = {
6930 #[serde_with::serde_as]
6931 #[derive(serde :: Serialize)]
6932 struct Query<'a> {
6933 #[serde(skip_serializing)]
6934 _phantom: std::marker::PhantomData<&'a ()>,
6935 }
6936 #[allow(clippy::useless_format)]
6937 let mut path =
6938 format!("/organization/users/{user_id}", user_id = params.user_id);
6939 let crate::__types::DeleteUserParams { .. } = params;
6940 let query = serde_urlencoded::to_string(Query {
6941 _phantom: std::marker::PhantomData,
6942 })?;
6943 if !query.is_empty() {
6944 path.push('?');
6945 path.push_str(&query);
6946 }
6947 path
6948 };
6949 let body = String::new();
6950 Ok(http::Request::builder()
6951 .method(http::Method::DELETE)
6952 .uri(path)
6953 .header(http::header::CONTENT_LENGTH, body.len())
6954 .body(body)?)
6955 },
6956 (
6957 http::StatusCode::from_u16(200u16).unwrap(),
6958 Some(mime::APPLICATION_JSON),
6959 ),
6960 ),
6961 crate::__combinators::Json::new,
6962 ))
6963}
6964future!(
6965 DeleteUser,
6966 futures::future::AndThen<
6967 crate::__combinators::Send<Fut, B, E>,
6968 crate::__combinators::Json<B, E, crate::__types::UserDeleteResponse>,
6969 fn(
6970 http::Response<B>,
6971 ) -> crate::__combinators::Json<B, E, crate::__types::UserDeleteResponse>,
6972 >,
6973 crate::__types::UserDeleteResponse
6974);
6975#[doc = "Create an ephemeral API token for use in client-side applications with the\nRealtime API. Can be configured with the same session parameters as the\n`session.update` client event.\n\nIt responds with a session object, plus a `client_secret` key which contains\na usable ephemeral API token that can be used to authenticate browser clients\nfor the Realtime API.\n"]
6976pub fn create_realtime_session<C, Fut, B, E>(
6977 client: C,
6978 request: &crate::__types::RealtimeSessionCreateRequest,
6979) -> CreateRealtimeSession<Fut, B, E>
6980where
6981 C: FnOnce(http::Request<String>) -> Fut,
6982 Fut: Future<Output = Result<http::Response<B>, E>>,
6983 B: http_body::Body,
6984{
6985 CreateRealtimeSession(futures::TryFutureExt::and_then(
6986 crate::__combinators::Send::new(
6987 client,
6988 || {
6989 let path = "/realtime/sessions";
6990 let body = serde_json::to_string(request)?;
6991 Ok(http::Request::builder()
6992 .method(http::Method::POST)
6993 .uri(path)
6994 .header(http::header::CONTENT_LENGTH, body.len())
6995 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
6996 .body(body)?)
6997 },
6998 (
6999 http::StatusCode::from_u16(200u16).unwrap(),
7000 Some(mime::APPLICATION_JSON),
7001 ),
7002 ),
7003 crate::__combinators::Json::new,
7004 ))
7005}
7006future!(
7007 CreateRealtimeSession,
7008 futures::future::AndThen<
7009 crate::__combinators::Send<Fut, B, E>,
7010 crate::__combinators::Json<B, E, crate::__types::RealtimeSessionCreateResponse>,
7011 fn(
7012 http::Response<B>,
7013 )
7014 -> crate::__combinators::Json<B, E, crate::__types::RealtimeSessionCreateResponse>,
7015 >,
7016 crate::__types::RealtimeSessionCreateResponse
7017);
7018#[doc = "Create an ephemeral API token for use in client-side applications with the\nRealtime API specifically for realtime transcriptions. \nCan be configured with the same session parameters as the `transcription_session.update` client event.\n\nIt responds with a session object, plus a `client_secret` key which contains\na usable ephemeral API token that can be used to authenticate browser clients\nfor the Realtime API.\n"]
7019pub fn create_realtime_transcription_session<C, Fut, B, E>(
7020 client: C,
7021 request: &crate::__types::RealtimeTranscriptionSessionCreateRequest,
7022) -> CreateRealtimeTranscriptionSession<Fut, B, E>
7023where
7024 C: FnOnce(http::Request<String>) -> Fut,
7025 Fut: Future<Output = Result<http::Response<B>, E>>,
7026 B: http_body::Body,
7027{
7028 CreateRealtimeTranscriptionSession(futures::TryFutureExt::and_then(
7029 crate::__combinators::Send::new(
7030 client,
7031 || {
7032 let path = "/realtime/transcription_sessions";
7033 let body = serde_json::to_string(request)?;
7034 Ok(http::Request::builder()
7035 .method(http::Method::POST)
7036 .uri(path)
7037 .header(http::header::CONTENT_LENGTH, body.len())
7038 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
7039 .body(body)?)
7040 },
7041 (
7042 http::StatusCode::from_u16(200u16).unwrap(),
7043 Some(mime::APPLICATION_JSON),
7044 ),
7045 ),
7046 crate::__combinators::Json::new,
7047 ))
7048}
7049future!(
7050 CreateRealtimeTranscriptionSession,
7051 futures::future::AndThen<
7052 crate::__combinators::Send<Fut, B, E>,
7053 crate::__combinators::Json<
7054 B,
7055 E,
7056 crate::__types::RealtimeTranscriptionSessionCreateResponse,
7057 >,
7058 fn(
7059 http::Response<B>,
7060 ) -> crate::__combinators::Json<
7061 B,
7062 E,
7063 crate::__types::RealtimeTranscriptionSessionCreateResponse,
7064 >,
7065 >,
7066 crate::__types::RealtimeTranscriptionSessionCreateResponse
7067);
7068#[doc = "Creates a model response. Provide [text](https://platform.openai.com/docs/guides/text) or\n[image](https://platform.openai.com/docs/guides/images) inputs to generate [text](https://platform.openai.com/docs/guides/text)\nor [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have the model call\nyour own [custom code](https://platform.openai.com/docs/guides/function-calling) or use built-in\n[tools](https://platform.openai.com/docs/guides/tools) like [web search](https://platform.openai.com/docs/guides/tools-web-search)\nor [file search](https://platform.openai.com/docs/guides/tools-file-search) to use your own data\nas input for the model's response.\n"]
7069pub fn create_response<C, Fut, B, E>(
7070 client: C,
7071 request: &crate::__types::CreateResponse,
7072) -> CreateResponse<Fut, B, E>
7073where
7074 C: FnOnce(http::Request<String>) -> Fut,
7075 Fut: Future<Output = Result<http::Response<B>, E>>,
7076 B: http_body::Body,
7077{
7078 CreateResponse(futures::TryFutureExt::and_then(
7079 crate::__combinators::Send::new(
7080 client,
7081 || {
7082 let path = "/responses";
7083 let body = serde_json::to_string(request)?;
7084 Ok(http::Request::builder()
7085 .method(http::Method::POST)
7086 .uri(path)
7087 .header(http::header::CONTENT_LENGTH, body.len())
7088 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
7089 .body(body)?)
7090 },
7091 (
7092 http::StatusCode::from_u16(200u16).unwrap(),
7093 Some(mime::APPLICATION_JSON),
7094 ),
7095 ),
7096 crate::__combinators::Json::new,
7097 ))
7098}
7099future!(
7100 CreateResponse,
7101 futures::future::AndThen<
7102 crate::__combinators::Send<Fut, B, E>,
7103 crate::__combinators::Json<B, E, crate::__types::Response>,
7104 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Response>,
7105 >,
7106 crate::__types::Response
7107);
7108#[doc = "Creates a model response. Provide [text](https://platform.openai.com/docs/guides/text) or\n[image](https://platform.openai.com/docs/guides/images) inputs to generate [text](https://platform.openai.com/docs/guides/text)\nor [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have the model call\nyour own [custom code](https://platform.openai.com/docs/guides/function-calling) or use built-in\n[tools](https://platform.openai.com/docs/guides/tools) like [web search](https://platform.openai.com/docs/guides/tools-web-search)\nor [file search](https://platform.openai.com/docs/guides/tools-file-search) to use your own data\nas input for the model's response.\n"]
7109pub fn create_response_stream<C, Fut, B, E>(
7110 client: C,
7111 request: &crate::__types::CreateResponse,
7112) -> CreateResponseStream<Fut, B, E>
7113where
7114 C: FnOnce(http::Request<String>) -> Fut,
7115 Fut: Future<Output = Result<http::Response<B>, E>>,
7116 B: http_body::Body,
7117{
7118 CreateResponseStream(futures::TryFutureExt::map_ok(
7119 crate::__combinators::Send::new(
7120 client,
7121 || {
7122 let path = "/responses";
7123 let body = serde_json::to_string(request)?;
7124 Ok(http::Request::builder()
7125 .method(http::Method::POST)
7126 .uri(path)
7127 .header(http::header::CONTENT_LENGTH, body.len())
7128 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
7129 .body(body)?)
7130 },
7131 (
7132 http::StatusCode::from_u16(200u16).unwrap(),
7133 Some(mime::TEXT_EVENT_STREAM),
7134 ),
7135 ),
7136 crate::__combinators::EventStream::new,
7137 ))
7138}
7139future ! (CreateResponseStream , futures :: future :: MapOk < crate :: __combinators :: Send < Fut , B , E > , fn (http :: Response < B >) -> crate :: __combinators :: EventStream < B , crate :: __types :: ResponseStreamEvent > , > , crate :: __combinators :: EventStream < B , crate :: __types :: ResponseStreamEvent >);
7140#[doc = "Retrieves a model response with the given ID.\n"]
7141pub fn get_response<C, Fut, B, E>(
7142 client: C,
7143 params: &crate::__types::GetResponseParams,
7144) -> GetResponse<Fut, B, E>
7145where
7146 C: FnOnce(http::Request<String>) -> Fut,
7147 Fut: Future<Output = Result<http::Response<B>, E>>,
7148 B: http_body::Body,
7149{
7150 GetResponse(futures::TryFutureExt::and_then(
7151 crate::__combinators::Send::new(
7152 client,
7153 || {
7154 let path = {
7155 #[serde_with::serde_as]
7156 #[derive(serde :: Serialize)]
7157 struct Query<'a> {
7158 #[serde(rename = "include")]
7159 #[serde(skip_serializing_if = "Option::is_none")]
7160 include: &'a Option<Vec<crate::__types::Includable>>,
7161 #[serde(rename = "stream")]
7162 #[serde(skip_serializing_if = "Option::is_none")]
7163 stream: &'a Option<bool>,
7164 #[serde(rename = "starting_after")]
7165 #[serde(skip_serializing_if = "Option::is_none")]
7166 starting_after: &'a Option<i64>,
7167 #[serde(skip_serializing)]
7168 _phantom: std::marker::PhantomData<&'a ()>,
7169 }
7170 #[allow(clippy::useless_format)]
7171 let mut path =
7172 format!("/responses/{response_id}", response_id = params.response_id);
7173 let crate::__types::GetResponseParams {
7174 include,
7175 stream,
7176 starting_after,
7177 ..
7178 } = params;
7179 let query = serde_urlencoded::to_string(Query {
7180 include,
7181 stream,
7182 starting_after,
7183 _phantom: std::marker::PhantomData,
7184 })?;
7185 if !query.is_empty() {
7186 path.push('?');
7187 path.push_str(&query);
7188 }
7189 path
7190 };
7191 let body = String::new();
7192 Ok(http::Request::builder()
7193 .method(http::Method::GET)
7194 .uri(path)
7195 .header(http::header::CONTENT_LENGTH, body.len())
7196 .body(body)?)
7197 },
7198 (
7199 http::StatusCode::from_u16(200u16).unwrap(),
7200 Some(mime::APPLICATION_JSON),
7201 ),
7202 ),
7203 crate::__combinators::Json::new,
7204 ))
7205}
7206future!(
7207 GetResponse,
7208 futures::future::AndThen<
7209 crate::__combinators::Send<Fut, B, E>,
7210 crate::__combinators::Json<B, E, crate::__types::Response>,
7211 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Response>,
7212 >,
7213 crate::__types::Response
7214);
7215#[doc = "Cancels a model response with the given ID. Only responses created with\nthe `background` parameter set to `true` can be cancelled. \n[Learn more](https://platform.openai.com/docs/guides/background).\n"]
7216pub fn cancel_response<C, Fut, B, E>(
7217 client: C,
7218 params: &crate::__types::CancelResponseParams,
7219) -> CancelResponse<Fut, B, E>
7220where
7221 C: FnOnce(http::Request<String>) -> Fut,
7222 Fut: Future<Output = Result<http::Response<B>, E>>,
7223 B: http_body::Body,
7224{
7225 CancelResponse(futures::TryFutureExt::and_then(
7226 crate::__combinators::Send::new(
7227 client,
7228 || {
7229 let path = {
7230 #[serde_with::serde_as]
7231 #[derive(serde :: Serialize)]
7232 struct Query<'a> {
7233 #[serde(skip_serializing)]
7234 _phantom: std::marker::PhantomData<&'a ()>,
7235 }
7236 #[allow(clippy::useless_format)]
7237 let mut path = format!(
7238 "/responses/{response_id}/cancel",
7239 response_id = params.response_id
7240 );
7241 let crate::__types::CancelResponseParams { .. } = params;
7242 let query = serde_urlencoded::to_string(Query {
7243 _phantom: std::marker::PhantomData,
7244 })?;
7245 if !query.is_empty() {
7246 path.push('?');
7247 path.push_str(&query);
7248 }
7249 path
7250 };
7251 let body = String::new();
7252 Ok(http::Request::builder()
7253 .method(http::Method::POST)
7254 .uri(path)
7255 .header(http::header::CONTENT_LENGTH, body.len())
7256 .body(body)?)
7257 },
7258 (
7259 http::StatusCode::from_u16(200u16).unwrap(),
7260 Some(mime::APPLICATION_JSON),
7261 ),
7262 ),
7263 crate::__combinators::Json::new,
7264 ))
7265}
7266future!(
7267 CancelResponse,
7268 futures::future::AndThen<
7269 crate::__combinators::Send<Fut, B, E>,
7270 crate::__combinators::Json<B, E, crate::__types::Response>,
7271 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Response>,
7272 >,
7273 crate::__types::Response
7274);
7275#[doc = "Returns a list of input items for a given response."]
7276pub fn list_input_items<C, Fut, B, E>(
7277 client: C,
7278 params: &crate::__types::ListInputItemsParams,
7279) -> ListInputItems<Fut, B, E>
7280where
7281 C: FnOnce(http::Request<String>) -> Fut,
7282 Fut: Future<Output = Result<http::Response<B>, E>>,
7283 B: http_body::Body,
7284{
7285 ListInputItems(futures::TryFutureExt::and_then(
7286 crate::__combinators::Send::new(
7287 client,
7288 || {
7289 let path = {
7290 #[serde_with::serde_as]
7291 #[derive(serde :: Serialize)]
7292 struct Query<'a> {
7293 #[serde(rename = "limit")]
7294 #[serde(skip_serializing_if = "Option::is_none")]
7295 limit: &'a Option<i64>,
7296 #[serde(rename = "order")]
7297 #[serde(skip_serializing_if = "Option::is_none")]
7298 order: &'a Option<crate::__types::ListInputItemsParamsOrder>,
7299 #[serde(rename = "after")]
7300 #[serde(skip_serializing_if = "Option::is_none")]
7301 after: &'a Option<String>,
7302 #[serde(rename = "before")]
7303 #[serde(skip_serializing_if = "Option::is_none")]
7304 before: &'a Option<String>,
7305 #[serde(rename = "include")]
7306 #[serde(skip_serializing_if = "Option::is_none")]
7307 include: &'a Option<Vec<crate::__types::Includable>>,
7308 #[serde(skip_serializing)]
7309 _phantom: std::marker::PhantomData<&'a ()>,
7310 }
7311 #[allow(clippy::useless_format)]
7312 let mut path = format!(
7313 "/responses/{response_id}/input_items",
7314 response_id = params.response_id
7315 );
7316 let crate::__types::ListInputItemsParams {
7317 limit,
7318 order,
7319 after,
7320 before,
7321 include,
7322 ..
7323 } = params;
7324 let query = serde_urlencoded::to_string(Query {
7325 limit,
7326 order,
7327 after,
7328 before,
7329 include,
7330 _phantom: std::marker::PhantomData,
7331 })?;
7332 if !query.is_empty() {
7333 path.push('?');
7334 path.push_str(&query);
7335 }
7336 path
7337 };
7338 let body = String::new();
7339 Ok(http::Request::builder()
7340 .method(http::Method::GET)
7341 .uri(path)
7342 .header(http::header::CONTENT_LENGTH, body.len())
7343 .body(body)?)
7344 },
7345 (
7346 http::StatusCode::from_u16(200u16).unwrap(),
7347 Some(mime::APPLICATION_JSON),
7348 ),
7349 ),
7350 crate::__combinators::Json::new,
7351 ))
7352}
7353future!(
7354 ListInputItems,
7355 futures::future::AndThen<
7356 crate::__combinators::Send<Fut, B, E>,
7357 crate::__combinators::Json<B, E, crate::__types::ResponseItemList>,
7358 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::ResponseItemList>,
7359 >,
7360 crate::__types::ResponseItemList
7361);
7362#[doc = "Create a thread and run it in one request."]
7363pub fn create_thread_and_run<C, Fut, B, E>(
7364 client: C,
7365 request: &crate::__types::CreateThreadAndRunRequest,
7366) -> CreateThreadAndRun<Fut, B, E>
7367where
7368 C: FnOnce(http::Request<String>) -> Fut,
7369 Fut: Future<Output = Result<http::Response<B>, E>>,
7370 B: http_body::Body,
7371{
7372 CreateThreadAndRun(futures::TryFutureExt::and_then(
7373 crate::__combinators::Send::new(
7374 client,
7375 || {
7376 let path = "/threads/runs";
7377 let body = serde_json::to_string(request)?;
7378 Ok(http::Request::builder()
7379 .method(http::Method::POST)
7380 .uri(path)
7381 .header(http::header::CONTENT_LENGTH, body.len())
7382 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
7383 .body(body)?)
7384 },
7385 (
7386 http::StatusCode::from_u16(200u16).unwrap(),
7387 Some(mime::APPLICATION_JSON),
7388 ),
7389 ),
7390 crate::__combinators::Json::new,
7391 ))
7392}
7393future!(
7394 CreateThreadAndRun,
7395 futures::future::AndThen<
7396 crate::__combinators::Send<Fut, B, E>,
7397 crate::__combinators::Json<B, E, crate::__types::RunObject>,
7398 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::RunObject>,
7399 >,
7400 crate::__types::RunObject
7401);
7402#[doc = "Retrieves a thread."]
7403pub fn get_thread<C, Fut, B, E>(
7404 client: C,
7405 params: &crate::__types::GetThreadParams,
7406) -> GetThread<Fut, B, E>
7407where
7408 C: FnOnce(http::Request<String>) -> Fut,
7409 Fut: Future<Output = Result<http::Response<B>, E>>,
7410 B: http_body::Body,
7411{
7412 GetThread(futures::TryFutureExt::and_then(
7413 crate::__combinators::Send::new(
7414 client,
7415 || {
7416 let path = {
7417 #[serde_with::serde_as]
7418 #[derive(serde :: Serialize)]
7419 struct Query<'a> {
7420 #[serde(skip_serializing)]
7421 _phantom: std::marker::PhantomData<&'a ()>,
7422 }
7423 #[allow(clippy::useless_format)]
7424 let mut path = format!("/threads/{thread_id}", thread_id = params.thread_id);
7425 let crate::__types::GetThreadParams { .. } = params;
7426 let query = serde_urlencoded::to_string(Query {
7427 _phantom: std::marker::PhantomData,
7428 })?;
7429 if !query.is_empty() {
7430 path.push('?');
7431 path.push_str(&query);
7432 }
7433 path
7434 };
7435 let body = String::new();
7436 Ok(http::Request::builder()
7437 .method(http::Method::GET)
7438 .uri(path)
7439 .header(http::header::CONTENT_LENGTH, body.len())
7440 .body(body)?)
7441 },
7442 (
7443 http::StatusCode::from_u16(200u16).unwrap(),
7444 Some(mime::APPLICATION_JSON),
7445 ),
7446 ),
7447 crate::__combinators::Json::new,
7448 ))
7449}
7450future!(
7451 GetThread,
7452 futures::future::AndThen<
7453 crate::__combinators::Send<Fut, B, E>,
7454 crate::__combinators::Json<B, E, crate::__types::ThreadObject>,
7455 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::ThreadObject>,
7456 >,
7457 crate::__types::ThreadObject
7458);
7459#[doc = "Modifies a thread."]
7460pub fn modify_thread<C, Fut, B, E>(
7461 client: C,
7462 params: &crate::__types::ModifyThreadParams,
7463 request: &crate::__types::ModifyThreadRequest,
7464) -> ModifyThread<Fut, B, E>
7465where
7466 C: FnOnce(http::Request<String>) -> Fut,
7467 Fut: Future<Output = Result<http::Response<B>, E>>,
7468 B: http_body::Body,
7469{
7470 ModifyThread(futures::TryFutureExt::and_then(
7471 crate::__combinators::Send::new(
7472 client,
7473 || {
7474 let path = {
7475 #[serde_with::serde_as]
7476 #[derive(serde :: Serialize)]
7477 struct Query<'a> {
7478 #[serde(skip_serializing)]
7479 _phantom: std::marker::PhantomData<&'a ()>,
7480 }
7481 #[allow(clippy::useless_format)]
7482 let mut path = format!("/threads/{thread_id}", thread_id = params.thread_id);
7483 let crate::__types::ModifyThreadParams { .. } = params;
7484 let query = serde_urlencoded::to_string(Query {
7485 _phantom: std::marker::PhantomData,
7486 })?;
7487 if !query.is_empty() {
7488 path.push('?');
7489 path.push_str(&query);
7490 }
7491 path
7492 };
7493 let body = serde_json::to_string(request)?;
7494 Ok(http::Request::builder()
7495 .method(http::Method::POST)
7496 .uri(path)
7497 .header(http::header::CONTENT_LENGTH, body.len())
7498 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
7499 .body(body)?)
7500 },
7501 (
7502 http::StatusCode::from_u16(200u16).unwrap(),
7503 Some(mime::APPLICATION_JSON),
7504 ),
7505 ),
7506 crate::__combinators::Json::new,
7507 ))
7508}
7509future!(
7510 ModifyThread,
7511 futures::future::AndThen<
7512 crate::__combinators::Send<Fut, B, E>,
7513 crate::__combinators::Json<B, E, crate::__types::ThreadObject>,
7514 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::ThreadObject>,
7515 >,
7516 crate::__types::ThreadObject
7517);
7518#[doc = "Delete a thread."]
7519pub fn delete_thread<C, Fut, B, E>(
7520 client: C,
7521 params: &crate::__types::DeleteThreadParams,
7522) -> DeleteThread<Fut, B, E>
7523where
7524 C: FnOnce(http::Request<String>) -> Fut,
7525 Fut: Future<Output = Result<http::Response<B>, E>>,
7526 B: http_body::Body,
7527{
7528 DeleteThread(futures::TryFutureExt::and_then(
7529 crate::__combinators::Send::new(
7530 client,
7531 || {
7532 let path = {
7533 #[serde_with::serde_as]
7534 #[derive(serde :: Serialize)]
7535 struct Query<'a> {
7536 #[serde(skip_serializing)]
7537 _phantom: std::marker::PhantomData<&'a ()>,
7538 }
7539 #[allow(clippy::useless_format)]
7540 let mut path = format!("/threads/{thread_id}", thread_id = params.thread_id);
7541 let crate::__types::DeleteThreadParams { .. } = params;
7542 let query = serde_urlencoded::to_string(Query {
7543 _phantom: std::marker::PhantomData,
7544 })?;
7545 if !query.is_empty() {
7546 path.push('?');
7547 path.push_str(&query);
7548 }
7549 path
7550 };
7551 let body = String::new();
7552 Ok(http::Request::builder()
7553 .method(http::Method::DELETE)
7554 .uri(path)
7555 .header(http::header::CONTENT_LENGTH, body.len())
7556 .body(body)?)
7557 },
7558 (
7559 http::StatusCode::from_u16(200u16).unwrap(),
7560 Some(mime::APPLICATION_JSON),
7561 ),
7562 ),
7563 crate::__combinators::Json::new,
7564 ))
7565}
7566future!(
7567 DeleteThread,
7568 futures::future::AndThen<
7569 crate::__combinators::Send<Fut, B, E>,
7570 crate::__combinators::Json<B, E, crate::__types::DeleteThreadResponse>,
7571 fn(
7572 http::Response<B>,
7573 ) -> crate::__combinators::Json<B, E, crate::__types::DeleteThreadResponse>,
7574 >,
7575 crate::__types::DeleteThreadResponse
7576);
7577#[doc = "Returns a list of messages for a given thread."]
7578pub fn list_messages<C, Fut, B, E>(
7579 client: C,
7580 params: &crate::__types::ListMessagesParams,
7581) -> ListMessages<Fut, B, E>
7582where
7583 C: FnOnce(http::Request<String>) -> Fut,
7584 Fut: Future<Output = Result<http::Response<B>, E>>,
7585 B: http_body::Body,
7586{
7587 ListMessages(futures::TryFutureExt::and_then(
7588 crate::__combinators::Send::new(
7589 client,
7590 || {
7591 let path = {
7592 #[serde_with::serde_as]
7593 #[derive(serde :: Serialize)]
7594 struct Query<'a> {
7595 #[serde(rename = "limit")]
7596 #[serde(skip_serializing_if = "Option::is_none")]
7597 limit: &'a Option<i64>,
7598 #[serde(rename = "order")]
7599 #[serde(skip_serializing_if = "Option::is_none")]
7600 order: &'a Option<crate::__types::ListMessagesParamsOrder>,
7601 #[serde(rename = "after")]
7602 #[serde(skip_serializing_if = "Option::is_none")]
7603 after: &'a Option<String>,
7604 #[serde(rename = "before")]
7605 #[serde(skip_serializing_if = "Option::is_none")]
7606 before: &'a Option<String>,
7607 #[serde(rename = "run_id")]
7608 #[serde(skip_serializing_if = "Option::is_none")]
7609 run_id: &'a Option<String>,
7610 #[serde(skip_serializing)]
7611 _phantom: std::marker::PhantomData<&'a ()>,
7612 }
7613 #[allow(clippy::useless_format)]
7614 let mut path = format!(
7615 "/threads/{thread_id}/messages",
7616 thread_id = params.thread_id
7617 );
7618 let crate::__types::ListMessagesParams {
7619 limit,
7620 order,
7621 after,
7622 before,
7623 run_id,
7624 ..
7625 } = params;
7626 let query = serde_urlencoded::to_string(Query {
7627 limit,
7628 order,
7629 after,
7630 before,
7631 run_id,
7632 _phantom: std::marker::PhantomData,
7633 })?;
7634 if !query.is_empty() {
7635 path.push('?');
7636 path.push_str(&query);
7637 }
7638 path
7639 };
7640 let body = String::new();
7641 Ok(http::Request::builder()
7642 .method(http::Method::GET)
7643 .uri(path)
7644 .header(http::header::CONTENT_LENGTH, body.len())
7645 .body(body)?)
7646 },
7647 (
7648 http::StatusCode::from_u16(200u16).unwrap(),
7649 Some(mime::APPLICATION_JSON),
7650 ),
7651 ),
7652 crate::__combinators::Json::new,
7653 ))
7654}
7655future!(
7656 ListMessages,
7657 futures::future::AndThen<
7658 crate::__combinators::Send<Fut, B, E>,
7659 crate::__combinators::Json<B, E, crate::__types::ListMessagesResponse>,
7660 fn(
7661 http::Response<B>,
7662 ) -> crate::__combinators::Json<B, E, crate::__types::ListMessagesResponse>,
7663 >,
7664 crate::__types::ListMessagesResponse
7665);
7666#[doc = "Create a message."]
7667pub fn create_message<C, Fut, B, E>(
7668 client: C,
7669 params: &crate::__types::CreateMessageParams,
7670 request: &crate::__types::CreateMessageRequest,
7671) -> CreateMessage<Fut, B, E>
7672where
7673 C: FnOnce(http::Request<String>) -> Fut,
7674 Fut: Future<Output = Result<http::Response<B>, E>>,
7675 B: http_body::Body,
7676{
7677 CreateMessage(futures::TryFutureExt::and_then(
7678 crate::__combinators::Send::new(
7679 client,
7680 || {
7681 let path = {
7682 #[serde_with::serde_as]
7683 #[derive(serde :: Serialize)]
7684 struct Query<'a> {
7685 #[serde(skip_serializing)]
7686 _phantom: std::marker::PhantomData<&'a ()>,
7687 }
7688 #[allow(clippy::useless_format)]
7689 let mut path = format!(
7690 "/threads/{thread_id}/messages",
7691 thread_id = params.thread_id
7692 );
7693 let crate::__types::CreateMessageParams { .. } = params;
7694 let query = serde_urlencoded::to_string(Query {
7695 _phantom: std::marker::PhantomData,
7696 })?;
7697 if !query.is_empty() {
7698 path.push('?');
7699 path.push_str(&query);
7700 }
7701 path
7702 };
7703 let body = serde_json::to_string(request)?;
7704 Ok(http::Request::builder()
7705 .method(http::Method::POST)
7706 .uri(path)
7707 .header(http::header::CONTENT_LENGTH, body.len())
7708 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
7709 .body(body)?)
7710 },
7711 (
7712 http::StatusCode::from_u16(200u16).unwrap(),
7713 Some(mime::APPLICATION_JSON),
7714 ),
7715 ),
7716 crate::__combinators::Json::new,
7717 ))
7718}
7719future!(
7720 CreateMessage,
7721 futures::future::AndThen<
7722 crate::__combinators::Send<Fut, B, E>,
7723 crate::__combinators::Json<B, E, crate::__types::MessageObject>,
7724 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::MessageObject>,
7725 >,
7726 crate::__types::MessageObject
7727);
7728#[doc = "Retrieve a message."]
7729pub fn get_message<C, Fut, B, E>(
7730 client: C,
7731 params: &crate::__types::GetMessageParams,
7732) -> GetMessage<Fut, B, E>
7733where
7734 C: FnOnce(http::Request<String>) -> Fut,
7735 Fut: Future<Output = Result<http::Response<B>, E>>,
7736 B: http_body::Body,
7737{
7738 GetMessage(futures::TryFutureExt::and_then(
7739 crate::__combinators::Send::new(
7740 client,
7741 || {
7742 let path = {
7743 #[serde_with::serde_as]
7744 #[derive(serde :: Serialize)]
7745 struct Query<'a> {
7746 #[serde(skip_serializing)]
7747 _phantom: std::marker::PhantomData<&'a ()>,
7748 }
7749 #[allow(clippy::useless_format)]
7750 let mut path = format!(
7751 "/threads/{thread_id}/messages/{message_id}",
7752 thread_id = params.thread_id,
7753 message_id = params.message_id
7754 );
7755 let crate::__types::GetMessageParams { .. } = params;
7756 let query = serde_urlencoded::to_string(Query {
7757 _phantom: std::marker::PhantomData,
7758 })?;
7759 if !query.is_empty() {
7760 path.push('?');
7761 path.push_str(&query);
7762 }
7763 path
7764 };
7765 let body = String::new();
7766 Ok(http::Request::builder()
7767 .method(http::Method::GET)
7768 .uri(path)
7769 .header(http::header::CONTENT_LENGTH, body.len())
7770 .body(body)?)
7771 },
7772 (
7773 http::StatusCode::from_u16(200u16).unwrap(),
7774 Some(mime::APPLICATION_JSON),
7775 ),
7776 ),
7777 crate::__combinators::Json::new,
7778 ))
7779}
7780future!(
7781 GetMessage,
7782 futures::future::AndThen<
7783 crate::__combinators::Send<Fut, B, E>,
7784 crate::__combinators::Json<B, E, crate::__types::MessageObject>,
7785 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::MessageObject>,
7786 >,
7787 crate::__types::MessageObject
7788);
7789#[doc = "Modifies a message."]
7790pub fn modify_message<C, Fut, B, E>(
7791 client: C,
7792 params: &crate::__types::ModifyMessageParams,
7793 request: &crate::__types::ModifyMessageRequest,
7794) -> ModifyMessage<Fut, B, E>
7795where
7796 C: FnOnce(http::Request<String>) -> Fut,
7797 Fut: Future<Output = Result<http::Response<B>, E>>,
7798 B: http_body::Body,
7799{
7800 ModifyMessage(futures::TryFutureExt::and_then(
7801 crate::__combinators::Send::new(
7802 client,
7803 || {
7804 let path = {
7805 #[serde_with::serde_as]
7806 #[derive(serde :: Serialize)]
7807 struct Query<'a> {
7808 #[serde(skip_serializing)]
7809 _phantom: std::marker::PhantomData<&'a ()>,
7810 }
7811 #[allow(clippy::useless_format)]
7812 let mut path = format!(
7813 "/threads/{thread_id}/messages/{message_id}",
7814 thread_id = params.thread_id,
7815 message_id = params.message_id
7816 );
7817 let crate::__types::ModifyMessageParams { .. } = params;
7818 let query = serde_urlencoded::to_string(Query {
7819 _phantom: std::marker::PhantomData,
7820 })?;
7821 if !query.is_empty() {
7822 path.push('?');
7823 path.push_str(&query);
7824 }
7825 path
7826 };
7827 let body = serde_json::to_string(request)?;
7828 Ok(http::Request::builder()
7829 .method(http::Method::POST)
7830 .uri(path)
7831 .header(http::header::CONTENT_LENGTH, body.len())
7832 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
7833 .body(body)?)
7834 },
7835 (
7836 http::StatusCode::from_u16(200u16).unwrap(),
7837 Some(mime::APPLICATION_JSON),
7838 ),
7839 ),
7840 crate::__combinators::Json::new,
7841 ))
7842}
7843future!(
7844 ModifyMessage,
7845 futures::future::AndThen<
7846 crate::__combinators::Send<Fut, B, E>,
7847 crate::__combinators::Json<B, E, crate::__types::MessageObject>,
7848 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::MessageObject>,
7849 >,
7850 crate::__types::MessageObject
7851);
7852#[doc = "Deletes a message."]
7853pub fn delete_message<C, Fut, B, E>(
7854 client: C,
7855 params: &crate::__types::DeleteMessageParams,
7856) -> DeleteMessage<Fut, B, E>
7857where
7858 C: FnOnce(http::Request<String>) -> Fut,
7859 Fut: Future<Output = Result<http::Response<B>, E>>,
7860 B: http_body::Body,
7861{
7862 DeleteMessage(futures::TryFutureExt::and_then(
7863 crate::__combinators::Send::new(
7864 client,
7865 || {
7866 let path = {
7867 #[serde_with::serde_as]
7868 #[derive(serde :: Serialize)]
7869 struct Query<'a> {
7870 #[serde(skip_serializing)]
7871 _phantom: std::marker::PhantomData<&'a ()>,
7872 }
7873 #[allow(clippy::useless_format)]
7874 let mut path = format!(
7875 "/threads/{thread_id}/messages/{message_id}",
7876 thread_id = params.thread_id,
7877 message_id = params.message_id
7878 );
7879 let crate::__types::DeleteMessageParams { .. } = params;
7880 let query = serde_urlencoded::to_string(Query {
7881 _phantom: std::marker::PhantomData,
7882 })?;
7883 if !query.is_empty() {
7884 path.push('?');
7885 path.push_str(&query);
7886 }
7887 path
7888 };
7889 let body = String::new();
7890 Ok(http::Request::builder()
7891 .method(http::Method::DELETE)
7892 .uri(path)
7893 .header(http::header::CONTENT_LENGTH, body.len())
7894 .body(body)?)
7895 },
7896 (
7897 http::StatusCode::from_u16(200u16).unwrap(),
7898 Some(mime::APPLICATION_JSON),
7899 ),
7900 ),
7901 crate::__combinators::Json::new,
7902 ))
7903}
7904future!(
7905 DeleteMessage,
7906 futures::future::AndThen<
7907 crate::__combinators::Send<Fut, B, E>,
7908 crate::__combinators::Json<B, E, crate::__types::DeleteMessageResponse>,
7909 fn(
7910 http::Response<B>,
7911 ) -> crate::__combinators::Json<B, E, crate::__types::DeleteMessageResponse>,
7912 >,
7913 crate::__types::DeleteMessageResponse
7914);
7915#[doc = "Returns a list of runs belonging to a thread."]
7916pub fn list_runs<C, Fut, B, E>(
7917 client: C,
7918 params: &crate::__types::ListRunsParams,
7919) -> ListRuns<Fut, B, E>
7920where
7921 C: FnOnce(http::Request<String>) -> Fut,
7922 Fut: Future<Output = Result<http::Response<B>, E>>,
7923 B: http_body::Body,
7924{
7925 ListRuns(futures::TryFutureExt::and_then(
7926 crate::__combinators::Send::new(
7927 client,
7928 || {
7929 let path = {
7930 #[serde_with::serde_as]
7931 #[derive(serde :: Serialize)]
7932 struct Query<'a> {
7933 #[serde(rename = "limit")]
7934 #[serde(skip_serializing_if = "Option::is_none")]
7935 limit: &'a Option<i64>,
7936 #[serde(rename = "order")]
7937 #[serde(skip_serializing_if = "Option::is_none")]
7938 order: &'a Option<crate::__types::ListRunsParamsOrder>,
7939 #[serde(rename = "after")]
7940 #[serde(skip_serializing_if = "Option::is_none")]
7941 after: &'a Option<String>,
7942 #[serde(rename = "before")]
7943 #[serde(skip_serializing_if = "Option::is_none")]
7944 before: &'a Option<String>,
7945 #[serde(skip_serializing)]
7946 _phantom: std::marker::PhantomData<&'a ()>,
7947 }
7948 #[allow(clippy::useless_format)]
7949 let mut path =
7950 format!("/threads/{thread_id}/runs", thread_id = params.thread_id);
7951 let crate::__types::ListRunsParams {
7952 limit,
7953 order,
7954 after,
7955 before,
7956 ..
7957 } = params;
7958 let query = serde_urlencoded::to_string(Query {
7959 limit,
7960 order,
7961 after,
7962 before,
7963 _phantom: std::marker::PhantomData,
7964 })?;
7965 if !query.is_empty() {
7966 path.push('?');
7967 path.push_str(&query);
7968 }
7969 path
7970 };
7971 let body = String::new();
7972 Ok(http::Request::builder()
7973 .method(http::Method::GET)
7974 .uri(path)
7975 .header(http::header::CONTENT_LENGTH, body.len())
7976 .body(body)?)
7977 },
7978 (
7979 http::StatusCode::from_u16(200u16).unwrap(),
7980 Some(mime::APPLICATION_JSON),
7981 ),
7982 ),
7983 crate::__combinators::Json::new,
7984 ))
7985}
7986future!(
7987 ListRuns,
7988 futures::future::AndThen<
7989 crate::__combinators::Send<Fut, B, E>,
7990 crate::__combinators::Json<B, E, crate::__types::ListRunsResponse>,
7991 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::ListRunsResponse>,
7992 >,
7993 crate::__types::ListRunsResponse
7994);
7995#[doc = "Create a run."]
7996pub fn create_run<C, Fut, B, E>(
7997 client: C,
7998 params: &crate::__types::CreateRunParams,
7999 request: &crate::__types::CreateRunRequest,
8000) -> CreateRun<Fut, B, E>
8001where
8002 C: FnOnce(http::Request<String>) -> Fut,
8003 Fut: Future<Output = Result<http::Response<B>, E>>,
8004 B: http_body::Body,
8005{
8006 CreateRun(futures::TryFutureExt::and_then(
8007 crate::__combinators::Send::new(
8008 client,
8009 || {
8010 let path = {
8011 #[serde_with::serde_as]
8012 #[derive(serde :: Serialize)]
8013 struct Query<'a> {
8014 #[serde(rename = "include[]")]
8015 #[serde(skip_serializing_if = "Option::is_none")]
8016 include: &'a Option<Vec<crate::__types::CreateRunParamsInclude>>,
8017 #[serde(skip_serializing)]
8018 _phantom: std::marker::PhantomData<&'a ()>,
8019 }
8020 #[allow(clippy::useless_format)]
8021 let mut path =
8022 format!("/threads/{thread_id}/runs", thread_id = params.thread_id);
8023 let crate::__types::CreateRunParams { include, .. } = params;
8024 let query = serde_urlencoded::to_string(Query {
8025 include,
8026 _phantom: std::marker::PhantomData,
8027 })?;
8028 if !query.is_empty() {
8029 path.push('?');
8030 path.push_str(&query);
8031 }
8032 path
8033 };
8034 let body = serde_json::to_string(request)?;
8035 Ok(http::Request::builder()
8036 .method(http::Method::POST)
8037 .uri(path)
8038 .header(http::header::CONTENT_LENGTH, body.len())
8039 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
8040 .body(body)?)
8041 },
8042 (
8043 http::StatusCode::from_u16(200u16).unwrap(),
8044 Some(mime::APPLICATION_JSON),
8045 ),
8046 ),
8047 crate::__combinators::Json::new,
8048 ))
8049}
8050future!(
8051 CreateRun,
8052 futures::future::AndThen<
8053 crate::__combinators::Send<Fut, B, E>,
8054 crate::__combinators::Json<B, E, crate::__types::RunObject>,
8055 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::RunObject>,
8056 >,
8057 crate::__types::RunObject
8058);
8059#[doc = "Retrieves a run."]
8060pub fn get_run<C, Fut, B, E>(client: C, params: &crate::__types::GetRunParams) -> GetRun<Fut, B, E>
8061where
8062 C: FnOnce(http::Request<String>) -> Fut,
8063 Fut: Future<Output = Result<http::Response<B>, E>>,
8064 B: http_body::Body,
8065{
8066 GetRun(futures::TryFutureExt::and_then(
8067 crate::__combinators::Send::new(
8068 client,
8069 || {
8070 let path = {
8071 #[serde_with::serde_as]
8072 #[derive(serde :: Serialize)]
8073 struct Query<'a> {
8074 #[serde(skip_serializing)]
8075 _phantom: std::marker::PhantomData<&'a ()>,
8076 }
8077 #[allow(clippy::useless_format)]
8078 let mut path = format!(
8079 "/threads/{thread_id}/runs/{run_id}",
8080 thread_id = params.thread_id,
8081 run_id = params.run_id
8082 );
8083 let crate::__types::GetRunParams { .. } = params;
8084 let query = serde_urlencoded::to_string(Query {
8085 _phantom: std::marker::PhantomData,
8086 })?;
8087 if !query.is_empty() {
8088 path.push('?');
8089 path.push_str(&query);
8090 }
8091 path
8092 };
8093 let body = String::new();
8094 Ok(http::Request::builder()
8095 .method(http::Method::GET)
8096 .uri(path)
8097 .header(http::header::CONTENT_LENGTH, body.len())
8098 .body(body)?)
8099 },
8100 (
8101 http::StatusCode::from_u16(200u16).unwrap(),
8102 Some(mime::APPLICATION_JSON),
8103 ),
8104 ),
8105 crate::__combinators::Json::new,
8106 ))
8107}
8108future!(
8109 GetRun,
8110 futures::future::AndThen<
8111 crate::__combinators::Send<Fut, B, E>,
8112 crate::__combinators::Json<B, E, crate::__types::RunObject>,
8113 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::RunObject>,
8114 >,
8115 crate::__types::RunObject
8116);
8117#[doc = "Modifies a run."]
8118pub fn modify_run<C, Fut, B, E>(
8119 client: C,
8120 params: &crate::__types::ModifyRunParams,
8121 request: &crate::__types::ModifyRunRequest,
8122) -> ModifyRun<Fut, B, E>
8123where
8124 C: FnOnce(http::Request<String>) -> Fut,
8125 Fut: Future<Output = Result<http::Response<B>, E>>,
8126 B: http_body::Body,
8127{
8128 ModifyRun(futures::TryFutureExt::and_then(
8129 crate::__combinators::Send::new(
8130 client,
8131 || {
8132 let path = {
8133 #[serde_with::serde_as]
8134 #[derive(serde :: Serialize)]
8135 struct Query<'a> {
8136 #[serde(skip_serializing)]
8137 _phantom: std::marker::PhantomData<&'a ()>,
8138 }
8139 #[allow(clippy::useless_format)]
8140 let mut path = format!(
8141 "/threads/{thread_id}/runs/{run_id}",
8142 thread_id = params.thread_id,
8143 run_id = params.run_id
8144 );
8145 let crate::__types::ModifyRunParams { .. } = params;
8146 let query = serde_urlencoded::to_string(Query {
8147 _phantom: std::marker::PhantomData,
8148 })?;
8149 if !query.is_empty() {
8150 path.push('?');
8151 path.push_str(&query);
8152 }
8153 path
8154 };
8155 let body = serde_json::to_string(request)?;
8156 Ok(http::Request::builder()
8157 .method(http::Method::POST)
8158 .uri(path)
8159 .header(http::header::CONTENT_LENGTH, body.len())
8160 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
8161 .body(body)?)
8162 },
8163 (
8164 http::StatusCode::from_u16(200u16).unwrap(),
8165 Some(mime::APPLICATION_JSON),
8166 ),
8167 ),
8168 crate::__combinators::Json::new,
8169 ))
8170}
8171future!(
8172 ModifyRun,
8173 futures::future::AndThen<
8174 crate::__combinators::Send<Fut, B, E>,
8175 crate::__combinators::Json<B, E, crate::__types::RunObject>,
8176 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::RunObject>,
8177 >,
8178 crate::__types::RunObject
8179);
8180#[doc = "Cancels a run that is `in_progress`."]
8181pub fn cancel_run<C, Fut, B, E>(
8182 client: C,
8183 params: &crate::__types::CancelRunParams,
8184) -> CancelRun<Fut, B, E>
8185where
8186 C: FnOnce(http::Request<String>) -> Fut,
8187 Fut: Future<Output = Result<http::Response<B>, E>>,
8188 B: http_body::Body,
8189{
8190 CancelRun(futures::TryFutureExt::and_then(
8191 crate::__combinators::Send::new(
8192 client,
8193 || {
8194 let path = {
8195 #[serde_with::serde_as]
8196 #[derive(serde :: Serialize)]
8197 struct Query<'a> {
8198 #[serde(skip_serializing)]
8199 _phantom: std::marker::PhantomData<&'a ()>,
8200 }
8201 #[allow(clippy::useless_format)]
8202 let mut path = format!(
8203 "/threads/{thread_id}/runs/{run_id}/cancel",
8204 thread_id = params.thread_id,
8205 run_id = params.run_id
8206 );
8207 let crate::__types::CancelRunParams { .. } = params;
8208 let query = serde_urlencoded::to_string(Query {
8209 _phantom: std::marker::PhantomData,
8210 })?;
8211 if !query.is_empty() {
8212 path.push('?');
8213 path.push_str(&query);
8214 }
8215 path
8216 };
8217 let body = String::new();
8218 Ok(http::Request::builder()
8219 .method(http::Method::POST)
8220 .uri(path)
8221 .header(http::header::CONTENT_LENGTH, body.len())
8222 .body(body)?)
8223 },
8224 (
8225 http::StatusCode::from_u16(200u16).unwrap(),
8226 Some(mime::APPLICATION_JSON),
8227 ),
8228 ),
8229 crate::__combinators::Json::new,
8230 ))
8231}
8232future!(
8233 CancelRun,
8234 futures::future::AndThen<
8235 crate::__combinators::Send<Fut, B, E>,
8236 crate::__combinators::Json<B, E, crate::__types::RunObject>,
8237 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::RunObject>,
8238 >,
8239 crate::__types::RunObject
8240);
8241#[doc = "Returns a list of run steps belonging to a run."]
8242pub fn list_run_steps<C, Fut, B, E>(
8243 client: C,
8244 params: &crate::__types::ListRunStepsParams,
8245) -> ListRunSteps<Fut, B, E>
8246where
8247 C: FnOnce(http::Request<String>) -> Fut,
8248 Fut: Future<Output = Result<http::Response<B>, E>>,
8249 B: http_body::Body,
8250{
8251 ListRunSteps(futures::TryFutureExt::and_then(
8252 crate::__combinators::Send::new(
8253 client,
8254 || {
8255 let path = {
8256 #[serde_with::serde_as]
8257 #[derive(serde :: Serialize)]
8258 struct Query<'a> {
8259 #[serde(rename = "limit")]
8260 #[serde(skip_serializing_if = "Option::is_none")]
8261 limit: &'a Option<i64>,
8262 #[serde(rename = "order")]
8263 #[serde(skip_serializing_if = "Option::is_none")]
8264 order: &'a Option<crate::__types::ListRunStepsParamsOrder>,
8265 #[serde(rename = "after")]
8266 #[serde(skip_serializing_if = "Option::is_none")]
8267 after: &'a Option<String>,
8268 #[serde(rename = "before")]
8269 #[serde(skip_serializing_if = "Option::is_none")]
8270 before: &'a Option<String>,
8271 #[serde(rename = "include[]")]
8272 #[serde(skip_serializing_if = "Option::is_none")]
8273 include: &'a Option<Vec<crate::__types::ListRunStepsParamsInclude>>,
8274 #[serde(skip_serializing)]
8275 _phantom: std::marker::PhantomData<&'a ()>,
8276 }
8277 #[allow(clippy::useless_format)]
8278 let mut path = format!(
8279 "/threads/{thread_id}/runs/{run_id}/steps",
8280 thread_id = params.thread_id,
8281 run_id = params.run_id
8282 );
8283 let crate::__types::ListRunStepsParams {
8284 limit,
8285 order,
8286 after,
8287 before,
8288 include,
8289 ..
8290 } = params;
8291 let query = serde_urlencoded::to_string(Query {
8292 limit,
8293 order,
8294 after,
8295 before,
8296 include,
8297 _phantom: std::marker::PhantomData,
8298 })?;
8299 if !query.is_empty() {
8300 path.push('?');
8301 path.push_str(&query);
8302 }
8303 path
8304 };
8305 let body = String::new();
8306 Ok(http::Request::builder()
8307 .method(http::Method::GET)
8308 .uri(path)
8309 .header(http::header::CONTENT_LENGTH, body.len())
8310 .body(body)?)
8311 },
8312 (
8313 http::StatusCode::from_u16(200u16).unwrap(),
8314 Some(mime::APPLICATION_JSON),
8315 ),
8316 ),
8317 crate::__combinators::Json::new,
8318 ))
8319}
8320future!(
8321 ListRunSteps,
8322 futures::future::AndThen<
8323 crate::__combinators::Send<Fut, B, E>,
8324 crate::__combinators::Json<B, E, crate::__types::ListRunStepsResponse>,
8325 fn(
8326 http::Response<B>,
8327 ) -> crate::__combinators::Json<B, E, crate::__types::ListRunStepsResponse>,
8328 >,
8329 crate::__types::ListRunStepsResponse
8330);
8331#[doc = "Retrieves a run step."]
8332pub fn get_run_step<C, Fut, B, E>(
8333 client: C,
8334 params: &crate::__types::GetRunStepParams,
8335) -> GetRunStep<Fut, B, E>
8336where
8337 C: FnOnce(http::Request<String>) -> Fut,
8338 Fut: Future<Output = Result<http::Response<B>, E>>,
8339 B: http_body::Body,
8340{
8341 GetRunStep(futures::TryFutureExt::and_then(
8342 crate::__combinators::Send::new(
8343 client,
8344 || {
8345 let path = {
8346 #[serde_with::serde_as]
8347 #[derive(serde :: Serialize)]
8348 struct Query<'a> {
8349 #[serde(rename = "include[]")]
8350 #[serde(skip_serializing_if = "Option::is_none")]
8351 include: &'a Option<Vec<crate::__types::GetRunStepParamsInclude>>,
8352 #[serde(skip_serializing)]
8353 _phantom: std::marker::PhantomData<&'a ()>,
8354 }
8355 #[allow(clippy::useless_format)]
8356 let mut path = format!(
8357 "/threads/{thread_id}/runs/{run_id}/steps/{step_id}",
8358 thread_id = params.thread_id,
8359 run_id = params.run_id,
8360 step_id = params.step_id
8361 );
8362 let crate::__types::GetRunStepParams { include, .. } = params;
8363 let query = serde_urlencoded::to_string(Query {
8364 include,
8365 _phantom: std::marker::PhantomData,
8366 })?;
8367 if !query.is_empty() {
8368 path.push('?');
8369 path.push_str(&query);
8370 }
8371 path
8372 };
8373 let body = String::new();
8374 Ok(http::Request::builder()
8375 .method(http::Method::GET)
8376 .uri(path)
8377 .header(http::header::CONTENT_LENGTH, body.len())
8378 .body(body)?)
8379 },
8380 (
8381 http::StatusCode::from_u16(200u16).unwrap(),
8382 Some(mime::APPLICATION_JSON),
8383 ),
8384 ),
8385 crate::__combinators::Json::new,
8386 ))
8387}
8388future!(
8389 GetRunStep,
8390 futures::future::AndThen<
8391 crate::__combinators::Send<Fut, B, E>,
8392 crate::__combinators::Json<B, E, crate::__types::RunStepObject>,
8393 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::RunStepObject>,
8394 >,
8395 crate::__types::RunStepObject
8396);
8397#[doc = "When a run has the `status: \"requires_action\"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.\n"]
8398pub fn submit_tool_ouputs_to_run<C, Fut, B, E>(
8399 client: C,
8400 params: &crate::__types::SubmitToolOuputsToRunParams,
8401 request: &crate::__types::SubmitToolOutputsRunRequest,
8402) -> SubmitToolOuputsToRun<Fut, B, E>
8403where
8404 C: FnOnce(http::Request<String>) -> Fut,
8405 Fut: Future<Output = Result<http::Response<B>, E>>,
8406 B: http_body::Body,
8407{
8408 SubmitToolOuputsToRun(futures::TryFutureExt::and_then(
8409 crate::__combinators::Send::new(
8410 client,
8411 || {
8412 let path = {
8413 #[serde_with::serde_as]
8414 #[derive(serde :: Serialize)]
8415 struct Query<'a> {
8416 #[serde(skip_serializing)]
8417 _phantom: std::marker::PhantomData<&'a ()>,
8418 }
8419 #[allow(clippy::useless_format)]
8420 let mut path = format!(
8421 "/threads/{thread_id}/runs/{run_id}/submit_tool_outputs",
8422 thread_id = params.thread_id,
8423 run_id = params.run_id
8424 );
8425 let crate::__types::SubmitToolOuputsToRunParams { .. } = params;
8426 let query = serde_urlencoded::to_string(Query {
8427 _phantom: std::marker::PhantomData,
8428 })?;
8429 if !query.is_empty() {
8430 path.push('?');
8431 path.push_str(&query);
8432 }
8433 path
8434 };
8435 let body = serde_json::to_string(request)?;
8436 Ok(http::Request::builder()
8437 .method(http::Method::POST)
8438 .uri(path)
8439 .header(http::header::CONTENT_LENGTH, body.len())
8440 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
8441 .body(body)?)
8442 },
8443 (
8444 http::StatusCode::from_u16(200u16).unwrap(),
8445 Some(mime::APPLICATION_JSON),
8446 ),
8447 ),
8448 crate::__combinators::Json::new,
8449 ))
8450}
8451future!(
8452 SubmitToolOuputsToRun,
8453 futures::future::AndThen<
8454 crate::__combinators::Send<Fut, B, E>,
8455 crate::__combinators::Json<B, E, crate::__types::RunObject>,
8456 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::RunObject>,
8457 >,
8458 crate::__types::RunObject
8459);
8460#[doc = "Creates an intermediate [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object\nthat you can add [Parts](https://platform.openai.com/docs/api-reference/uploads/part-object) to.\nCurrently, an Upload can accept at most 8 GB in total and expires after an\nhour after you create it.\n\nOnce you complete the Upload, we will create a\n[File](https://platform.openai.com/docs/api-reference/files/object) object that contains all the parts\nyou uploaded. This File is usable in the rest of our platform as a regular\nFile object.\n\nFor certain `purpose` values, the correct `mime_type` must be specified. \nPlease refer to documentation for the \n[supported MIME types for your use case](https://platform.openai.com/docs/assistants/tools/file-search#supported-files).\n\nFor guidance on the proper filename extensions for each purpose, please\nfollow the documentation on [creating a\nFile](https://platform.openai.com/docs/api-reference/files/create).\n"]
8461pub fn create_upload<C, Fut, B, E>(
8462 client: C,
8463 request: &crate::__types::CreateUploadRequest,
8464) -> CreateUpload<Fut, B, E>
8465where
8466 C: FnOnce(http::Request<String>) -> Fut,
8467 Fut: Future<Output = Result<http::Response<B>, E>>,
8468 B: http_body::Body,
8469{
8470 CreateUpload(futures::TryFutureExt::and_then(
8471 crate::__combinators::Send::new(
8472 client,
8473 || {
8474 let path = "/uploads";
8475 let body = serde_json::to_string(request)?;
8476 Ok(http::Request::builder()
8477 .method(http::Method::POST)
8478 .uri(path)
8479 .header(http::header::CONTENT_LENGTH, body.len())
8480 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
8481 .body(body)?)
8482 },
8483 (
8484 http::StatusCode::from_u16(200u16).unwrap(),
8485 Some(mime::APPLICATION_JSON),
8486 ),
8487 ),
8488 crate::__combinators::Json::new,
8489 ))
8490}
8491future!(
8492 CreateUpload,
8493 futures::future::AndThen<
8494 crate::__combinators::Send<Fut, B, E>,
8495 crate::__combinators::Json<B, E, crate::__types::Upload>,
8496 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Upload>,
8497 >,
8498 crate::__types::Upload
8499);
8500#[doc = "Cancels the Upload. No Parts may be added after an Upload is cancelled.\n"]
8501pub fn cancel_upload<C, Fut, B, E>(
8502 client: C,
8503 params: &crate::__types::CancelUploadParams,
8504) -> CancelUpload<Fut, B, E>
8505where
8506 C: FnOnce(http::Request<String>) -> Fut,
8507 Fut: Future<Output = Result<http::Response<B>, E>>,
8508 B: http_body::Body,
8509{
8510 CancelUpload(futures::TryFutureExt::and_then(
8511 crate::__combinators::Send::new(
8512 client,
8513 || {
8514 let path = {
8515 #[serde_with::serde_as]
8516 #[derive(serde :: Serialize)]
8517 struct Query<'a> {
8518 #[serde(skip_serializing)]
8519 _phantom: std::marker::PhantomData<&'a ()>,
8520 }
8521 #[allow(clippy::useless_format)]
8522 let mut path =
8523 format!("/uploads/{upload_id}/cancel", upload_id = params.upload_id);
8524 let crate::__types::CancelUploadParams { .. } = params;
8525 let query = serde_urlencoded::to_string(Query {
8526 _phantom: std::marker::PhantomData,
8527 })?;
8528 if !query.is_empty() {
8529 path.push('?');
8530 path.push_str(&query);
8531 }
8532 path
8533 };
8534 let body = String::new();
8535 Ok(http::Request::builder()
8536 .method(http::Method::POST)
8537 .uri(path)
8538 .header(http::header::CONTENT_LENGTH, body.len())
8539 .body(body)?)
8540 },
8541 (
8542 http::StatusCode::from_u16(200u16).unwrap(),
8543 Some(mime::APPLICATION_JSON),
8544 ),
8545 ),
8546 crate::__combinators::Json::new,
8547 ))
8548}
8549future!(
8550 CancelUpload,
8551 futures::future::AndThen<
8552 crate::__combinators::Send<Fut, B, E>,
8553 crate::__combinators::Json<B, E, crate::__types::Upload>,
8554 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Upload>,
8555 >,
8556 crate::__types::Upload
8557);
8558#[doc = "Completes the [Upload](https://platform.openai.com/docs/api-reference/uploads/object). \n\nWithin the returned Upload object, there is a nested [File](https://platform.openai.com/docs/api-reference/files/object) object that is ready to use in the rest of the platform.\n\nYou can specify the order of the Parts by passing in an ordered list of the Part IDs.\n\nThe number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.\n"]
8559pub fn complete_upload<C, Fut, B, E>(
8560 client: C,
8561 params: &crate::__types::CompleteUploadParams,
8562 request: &crate::__types::CompleteUploadRequest,
8563) -> CompleteUpload<Fut, B, E>
8564where
8565 C: FnOnce(http::Request<String>) -> Fut,
8566 Fut: Future<Output = Result<http::Response<B>, E>>,
8567 B: http_body::Body,
8568{
8569 CompleteUpload(futures::TryFutureExt::and_then(
8570 crate::__combinators::Send::new(
8571 client,
8572 || {
8573 let path = {
8574 #[serde_with::serde_as]
8575 #[derive(serde :: Serialize)]
8576 struct Query<'a> {
8577 #[serde(skip_serializing)]
8578 _phantom: std::marker::PhantomData<&'a ()>,
8579 }
8580 #[allow(clippy::useless_format)]
8581 let mut path = format!(
8582 "/uploads/{upload_id}/complete",
8583 upload_id = params.upload_id
8584 );
8585 let crate::__types::CompleteUploadParams { .. } = params;
8586 let query = serde_urlencoded::to_string(Query {
8587 _phantom: std::marker::PhantomData,
8588 })?;
8589 if !query.is_empty() {
8590 path.push('?');
8591 path.push_str(&query);
8592 }
8593 path
8594 };
8595 let body = serde_json::to_string(request)?;
8596 Ok(http::Request::builder()
8597 .method(http::Method::POST)
8598 .uri(path)
8599 .header(http::header::CONTENT_LENGTH, body.len())
8600 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
8601 .body(body)?)
8602 },
8603 (
8604 http::StatusCode::from_u16(200u16).unwrap(),
8605 Some(mime::APPLICATION_JSON),
8606 ),
8607 ),
8608 crate::__combinators::Json::new,
8609 ))
8610}
8611future!(
8612 CompleteUpload,
8613 futures::future::AndThen<
8614 crate::__combinators::Send<Fut, B, E>,
8615 crate::__combinators::Json<B, E, crate::__types::Upload>,
8616 fn(http::Response<B>) -> crate::__combinators::Json<B, E, crate::__types::Upload>,
8617 >,
8618 crate::__types::Upload
8619);
8620#[doc = "Returns a list of vector stores."]
8621pub fn list_vector_stores<C, Fut, B, E>(
8622 client: C,
8623 params: &crate::__types::ListVectorStoresParams,
8624) -> ListVectorStores<Fut, B, E>
8625where
8626 C: FnOnce(http::Request<String>) -> Fut,
8627 Fut: Future<Output = Result<http::Response<B>, E>>,
8628 B: http_body::Body,
8629{
8630 ListVectorStores(futures::TryFutureExt::and_then(
8631 crate::__combinators::Send::new(
8632 client,
8633 || {
8634 let path = {
8635 #[serde_with::serde_as]
8636 #[derive(serde :: Serialize)]
8637 struct Query<'a> {
8638 #[serde(rename = "limit")]
8639 #[serde(skip_serializing_if = "Option::is_none")]
8640 limit: &'a Option<i64>,
8641 #[serde(rename = "order")]
8642 #[serde(skip_serializing_if = "Option::is_none")]
8643 order: &'a Option<crate::__types::ListVectorStoresParamsOrder>,
8644 #[serde(rename = "after")]
8645 #[serde(skip_serializing_if = "Option::is_none")]
8646 after: &'a Option<String>,
8647 #[serde(rename = "before")]
8648 #[serde(skip_serializing_if = "Option::is_none")]
8649 before: &'a Option<String>,
8650 #[serde(skip_serializing)]
8651 _phantom: std::marker::PhantomData<&'a ()>,
8652 }
8653 #[allow(clippy::useless_format)]
8654 let mut path = format!("/vector_stores",);
8655 let crate::__types::ListVectorStoresParams {
8656 limit,
8657 order,
8658 after,
8659 before,
8660 ..
8661 } = params;
8662 let query = serde_urlencoded::to_string(Query {
8663 limit,
8664 order,
8665 after,
8666 before,
8667 _phantom: std::marker::PhantomData,
8668 })?;
8669 if !query.is_empty() {
8670 path.push('?');
8671 path.push_str(&query);
8672 }
8673 path
8674 };
8675 let body = String::new();
8676 Ok(http::Request::builder()
8677 .method(http::Method::GET)
8678 .uri(path)
8679 .header(http::header::CONTENT_LENGTH, body.len())
8680 .body(body)?)
8681 },
8682 (
8683 http::StatusCode::from_u16(200u16).unwrap(),
8684 Some(mime::APPLICATION_JSON),
8685 ),
8686 ),
8687 crate::__combinators::Json::new,
8688 ))
8689}
8690future!(
8691 ListVectorStores,
8692 futures::future::AndThen<
8693 crate::__combinators::Send<Fut, B, E>,
8694 crate::__combinators::Json<B, E, crate::__types::ListVectorStoresResponse>,
8695 fn(
8696 http::Response<B>,
8697 ) -> crate::__combinators::Json<B, E, crate::__types::ListVectorStoresResponse>,
8698 >,
8699 crate::__types::ListVectorStoresResponse
8700);
8701#[doc = "Create a vector store."]
8702pub fn create_vector_store<C, Fut, B, E>(
8703 client: C,
8704 request: &crate::__types::CreateVectorStoreRequest,
8705) -> CreateVectorStore<Fut, B, E>
8706where
8707 C: FnOnce(http::Request<String>) -> Fut,
8708 Fut: Future<Output = Result<http::Response<B>, E>>,
8709 B: http_body::Body,
8710{
8711 CreateVectorStore(futures::TryFutureExt::and_then(
8712 crate::__combinators::Send::new(
8713 client,
8714 || {
8715 let path = "/vector_stores";
8716 let body = serde_json::to_string(request)?;
8717 Ok(http::Request::builder()
8718 .method(http::Method::POST)
8719 .uri(path)
8720 .header(http::header::CONTENT_LENGTH, body.len())
8721 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
8722 .body(body)?)
8723 },
8724 (
8725 http::StatusCode::from_u16(200u16).unwrap(),
8726 Some(mime::APPLICATION_JSON),
8727 ),
8728 ),
8729 crate::__combinators::Json::new,
8730 ))
8731}
8732future!(
8733 CreateVectorStore,
8734 futures::future::AndThen<
8735 crate::__combinators::Send<Fut, B, E>,
8736 crate::__combinators::Json<B, E, crate::__types::VectorStoreObject>,
8737 fn(
8738 http::Response<B>,
8739 ) -> crate::__combinators::Json<B, E, crate::__types::VectorStoreObject>,
8740 >,
8741 crate::__types::VectorStoreObject
8742);
8743#[doc = "Retrieves a vector store."]
8744pub fn get_vector_store<C, Fut, B, E>(
8745 client: C,
8746 params: &crate::__types::GetVectorStoreParams,
8747) -> GetVectorStore<Fut, B, E>
8748where
8749 C: FnOnce(http::Request<String>) -> Fut,
8750 Fut: Future<Output = Result<http::Response<B>, E>>,
8751 B: http_body::Body,
8752{
8753 GetVectorStore(futures::TryFutureExt::and_then(
8754 crate::__combinators::Send::new(
8755 client,
8756 || {
8757 let path = {
8758 #[serde_with::serde_as]
8759 #[derive(serde :: Serialize)]
8760 struct Query<'a> {
8761 #[serde(skip_serializing)]
8762 _phantom: std::marker::PhantomData<&'a ()>,
8763 }
8764 #[allow(clippy::useless_format)]
8765 let mut path = format!(
8766 "/vector_stores/{vector_store_id}",
8767 vector_store_id = params.vector_store_id
8768 );
8769 let crate::__types::GetVectorStoreParams { .. } = params;
8770 let query = serde_urlencoded::to_string(Query {
8771 _phantom: std::marker::PhantomData,
8772 })?;
8773 if !query.is_empty() {
8774 path.push('?');
8775 path.push_str(&query);
8776 }
8777 path
8778 };
8779 let body = String::new();
8780 Ok(http::Request::builder()
8781 .method(http::Method::GET)
8782 .uri(path)
8783 .header(http::header::CONTENT_LENGTH, body.len())
8784 .body(body)?)
8785 },
8786 (
8787 http::StatusCode::from_u16(200u16).unwrap(),
8788 Some(mime::APPLICATION_JSON),
8789 ),
8790 ),
8791 crate::__combinators::Json::new,
8792 ))
8793}
8794future!(
8795 GetVectorStore,
8796 futures::future::AndThen<
8797 crate::__combinators::Send<Fut, B, E>,
8798 crate::__combinators::Json<B, E, crate::__types::VectorStoreObject>,
8799 fn(
8800 http::Response<B>,
8801 ) -> crate::__combinators::Json<B, E, crate::__types::VectorStoreObject>,
8802 >,
8803 crate::__types::VectorStoreObject
8804);
8805#[doc = "Modifies a vector store."]
8806pub fn modify_vector_store<C, Fut, B, E>(
8807 client: C,
8808 params: &crate::__types::ModifyVectorStoreParams,
8809 request: &crate::__types::UpdateVectorStoreRequest,
8810) -> ModifyVectorStore<Fut, B, E>
8811where
8812 C: FnOnce(http::Request<String>) -> Fut,
8813 Fut: Future<Output = Result<http::Response<B>, E>>,
8814 B: http_body::Body,
8815{
8816 ModifyVectorStore(futures::TryFutureExt::and_then(
8817 crate::__combinators::Send::new(
8818 client,
8819 || {
8820 let path = {
8821 #[serde_with::serde_as]
8822 #[derive(serde :: Serialize)]
8823 struct Query<'a> {
8824 #[serde(skip_serializing)]
8825 _phantom: std::marker::PhantomData<&'a ()>,
8826 }
8827 #[allow(clippy::useless_format)]
8828 let mut path = format!(
8829 "/vector_stores/{vector_store_id}",
8830 vector_store_id = params.vector_store_id
8831 );
8832 let crate::__types::ModifyVectorStoreParams { .. } = params;
8833 let query = serde_urlencoded::to_string(Query {
8834 _phantom: std::marker::PhantomData,
8835 })?;
8836 if !query.is_empty() {
8837 path.push('?');
8838 path.push_str(&query);
8839 }
8840 path
8841 };
8842 let body = serde_json::to_string(request)?;
8843 Ok(http::Request::builder()
8844 .method(http::Method::POST)
8845 .uri(path)
8846 .header(http::header::CONTENT_LENGTH, body.len())
8847 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
8848 .body(body)?)
8849 },
8850 (
8851 http::StatusCode::from_u16(200u16).unwrap(),
8852 Some(mime::APPLICATION_JSON),
8853 ),
8854 ),
8855 crate::__combinators::Json::new,
8856 ))
8857}
8858future!(
8859 ModifyVectorStore,
8860 futures::future::AndThen<
8861 crate::__combinators::Send<Fut, B, E>,
8862 crate::__combinators::Json<B, E, crate::__types::VectorStoreObject>,
8863 fn(
8864 http::Response<B>,
8865 ) -> crate::__combinators::Json<B, E, crate::__types::VectorStoreObject>,
8866 >,
8867 crate::__types::VectorStoreObject
8868);
8869#[doc = "Delete a vector store."]
8870pub fn delete_vector_store<C, Fut, B, E>(
8871 client: C,
8872 params: &crate::__types::DeleteVectorStoreParams,
8873) -> DeleteVectorStore<Fut, B, E>
8874where
8875 C: FnOnce(http::Request<String>) -> Fut,
8876 Fut: Future<Output = Result<http::Response<B>, E>>,
8877 B: http_body::Body,
8878{
8879 DeleteVectorStore(futures::TryFutureExt::and_then(
8880 crate::__combinators::Send::new(
8881 client,
8882 || {
8883 let path = {
8884 #[serde_with::serde_as]
8885 #[derive(serde :: Serialize)]
8886 struct Query<'a> {
8887 #[serde(skip_serializing)]
8888 _phantom: std::marker::PhantomData<&'a ()>,
8889 }
8890 #[allow(clippy::useless_format)]
8891 let mut path = format!(
8892 "/vector_stores/{vector_store_id}",
8893 vector_store_id = params.vector_store_id
8894 );
8895 let crate::__types::DeleteVectorStoreParams { .. } = params;
8896 let query = serde_urlencoded::to_string(Query {
8897 _phantom: std::marker::PhantomData,
8898 })?;
8899 if !query.is_empty() {
8900 path.push('?');
8901 path.push_str(&query);
8902 }
8903 path
8904 };
8905 let body = String::new();
8906 Ok(http::Request::builder()
8907 .method(http::Method::DELETE)
8908 .uri(path)
8909 .header(http::header::CONTENT_LENGTH, body.len())
8910 .body(body)?)
8911 },
8912 (
8913 http::StatusCode::from_u16(200u16).unwrap(),
8914 Some(mime::APPLICATION_JSON),
8915 ),
8916 ),
8917 crate::__combinators::Json::new,
8918 ))
8919}
8920future!(
8921 DeleteVectorStore,
8922 futures::future::AndThen<
8923 crate::__combinators::Send<Fut, B, E>,
8924 crate::__combinators::Json<B, E, crate::__types::DeleteVectorStoreResponse>,
8925 fn(
8926 http::Response<B>,
8927 ) -> crate::__combinators::Json<B, E, crate::__types::DeleteVectorStoreResponse>,
8928 >,
8929 crate::__types::DeleteVectorStoreResponse
8930);
8931#[doc = "Create a vector store file batch."]
8932pub fn create_vector_store_file_batch<C, Fut, B, E>(
8933 client: C,
8934 params: &crate::__types::CreateVectorStoreFileBatchParams,
8935 request: &crate::__types::CreateVectorStoreFileBatchRequest,
8936) -> CreateVectorStoreFileBatch<Fut, B, E>
8937where
8938 C: FnOnce(http::Request<String>) -> Fut,
8939 Fut: Future<Output = Result<http::Response<B>, E>>,
8940 B: http_body::Body,
8941{
8942 CreateVectorStoreFileBatch(futures::TryFutureExt::and_then(
8943 crate::__combinators::Send::new(
8944 client,
8945 || {
8946 let path = {
8947 #[serde_with::serde_as]
8948 #[derive(serde :: Serialize)]
8949 struct Query<'a> {
8950 #[serde(skip_serializing)]
8951 _phantom: std::marker::PhantomData<&'a ()>,
8952 }
8953 #[allow(clippy::useless_format)]
8954 let mut path = format!(
8955 "/vector_stores/{vector_store_id}/file_batches",
8956 vector_store_id = params.vector_store_id
8957 );
8958 let crate::__types::CreateVectorStoreFileBatchParams { .. } = params;
8959 let query = serde_urlencoded::to_string(Query {
8960 _phantom: std::marker::PhantomData,
8961 })?;
8962 if !query.is_empty() {
8963 path.push('?');
8964 path.push_str(&query);
8965 }
8966 path
8967 };
8968 let body = serde_json::to_string(request)?;
8969 Ok(http::Request::builder()
8970 .method(http::Method::POST)
8971 .uri(path)
8972 .header(http::header::CONTENT_LENGTH, body.len())
8973 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
8974 .body(body)?)
8975 },
8976 (
8977 http::StatusCode::from_u16(200u16).unwrap(),
8978 Some(mime::APPLICATION_JSON),
8979 ),
8980 ),
8981 crate::__combinators::Json::new,
8982 ))
8983}
8984future!(
8985 CreateVectorStoreFileBatch,
8986 futures::future::AndThen<
8987 crate::__combinators::Send<Fut, B, E>,
8988 crate::__combinators::Json<B, E, crate::__types::VectorStoreFileBatchObject>,
8989 fn(
8990 http::Response<B>,
8991 ) -> crate::__combinators::Json<B, E, crate::__types::VectorStoreFileBatchObject>,
8992 >,
8993 crate::__types::VectorStoreFileBatchObject
8994);
8995#[doc = "Retrieves a vector store file batch."]
8996pub fn get_vector_store_file_batch<C, Fut, B, E>(
8997 client: C,
8998 params: &crate::__types::GetVectorStoreFileBatchParams,
8999) -> GetVectorStoreFileBatch<Fut, B, E>
9000where
9001 C: FnOnce(http::Request<String>) -> Fut,
9002 Fut: Future<Output = Result<http::Response<B>, E>>,
9003 B: http_body::Body,
9004{
9005 GetVectorStoreFileBatch(futures::TryFutureExt::and_then(
9006 crate::__combinators::Send::new(
9007 client,
9008 || {
9009 let path = {
9010 #[serde_with::serde_as]
9011 #[derive(serde :: Serialize)]
9012 struct Query<'a> {
9013 #[serde(skip_serializing)]
9014 _phantom: std::marker::PhantomData<&'a ()>,
9015 }
9016 #[allow(clippy::useless_format)]
9017 let mut path = format!(
9018 "/vector_stores/{vector_store_id}/file_batches/{batch_id}",
9019 vector_store_id = params.vector_store_id,
9020 batch_id = params.batch_id
9021 );
9022 let crate::__types::GetVectorStoreFileBatchParams { .. } = params;
9023 let query = serde_urlencoded::to_string(Query {
9024 _phantom: std::marker::PhantomData,
9025 })?;
9026 if !query.is_empty() {
9027 path.push('?');
9028 path.push_str(&query);
9029 }
9030 path
9031 };
9032 let body = String::new();
9033 Ok(http::Request::builder()
9034 .method(http::Method::GET)
9035 .uri(path)
9036 .header(http::header::CONTENT_LENGTH, body.len())
9037 .body(body)?)
9038 },
9039 (
9040 http::StatusCode::from_u16(200u16).unwrap(),
9041 Some(mime::APPLICATION_JSON),
9042 ),
9043 ),
9044 crate::__combinators::Json::new,
9045 ))
9046}
9047future!(
9048 GetVectorStoreFileBatch,
9049 futures::future::AndThen<
9050 crate::__combinators::Send<Fut, B, E>,
9051 crate::__combinators::Json<B, E, crate::__types::VectorStoreFileBatchObject>,
9052 fn(
9053 http::Response<B>,
9054 ) -> crate::__combinators::Json<B, E, crate::__types::VectorStoreFileBatchObject>,
9055 >,
9056 crate::__types::VectorStoreFileBatchObject
9057);
9058#[doc = "Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible."]
9059pub fn cancel_vector_store_file_batch<C, Fut, B, E>(
9060 client: C,
9061 params: &crate::__types::CancelVectorStoreFileBatchParams,
9062) -> CancelVectorStoreFileBatch<Fut, B, E>
9063where
9064 C: FnOnce(http::Request<String>) -> Fut,
9065 Fut: Future<Output = Result<http::Response<B>, E>>,
9066 B: http_body::Body,
9067{
9068 CancelVectorStoreFileBatch(futures::TryFutureExt::and_then(
9069 crate::__combinators::Send::new(
9070 client,
9071 || {
9072 let path = {
9073 #[serde_with::serde_as]
9074 #[derive(serde :: Serialize)]
9075 struct Query<'a> {
9076 #[serde(skip_serializing)]
9077 _phantom: std::marker::PhantomData<&'a ()>,
9078 }
9079 #[allow(clippy::useless_format)]
9080 let mut path = format!(
9081 "/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel",
9082 vector_store_id = params.vector_store_id,
9083 batch_id = params.batch_id
9084 );
9085 let crate::__types::CancelVectorStoreFileBatchParams { .. } = params;
9086 let query = serde_urlencoded::to_string(Query {
9087 _phantom: std::marker::PhantomData,
9088 })?;
9089 if !query.is_empty() {
9090 path.push('?');
9091 path.push_str(&query);
9092 }
9093 path
9094 };
9095 let body = String::new();
9096 Ok(http::Request::builder()
9097 .method(http::Method::POST)
9098 .uri(path)
9099 .header(http::header::CONTENT_LENGTH, body.len())
9100 .body(body)?)
9101 },
9102 (
9103 http::StatusCode::from_u16(200u16).unwrap(),
9104 Some(mime::APPLICATION_JSON),
9105 ),
9106 ),
9107 crate::__combinators::Json::new,
9108 ))
9109}
9110future!(
9111 CancelVectorStoreFileBatch,
9112 futures::future::AndThen<
9113 crate::__combinators::Send<Fut, B, E>,
9114 crate::__combinators::Json<B, E, crate::__types::VectorStoreFileBatchObject>,
9115 fn(
9116 http::Response<B>,
9117 ) -> crate::__combinators::Json<B, E, crate::__types::VectorStoreFileBatchObject>,
9118 >,
9119 crate::__types::VectorStoreFileBatchObject
9120);
9121#[doc = "Returns a list of vector store files in a batch."]
9122pub fn list_files_in_vector_store_batch<C, Fut, B, E>(
9123 client: C,
9124 params: &crate::__types::ListFilesInVectorStoreBatchParams,
9125) -> ListFilesInVectorStoreBatch<Fut, B, E>
9126where
9127 C: FnOnce(http::Request<String>) -> Fut,
9128 Fut: Future<Output = Result<http::Response<B>, E>>,
9129 B: http_body::Body,
9130{
9131 ListFilesInVectorStoreBatch(futures::TryFutureExt::and_then(
9132 crate::__combinators::Send::new(
9133 client,
9134 || {
9135 let path = {
9136 #[serde_with::serde_as]
9137 #[derive(serde :: Serialize)]
9138 struct Query<'a> {
9139 #[serde(rename = "limit")]
9140 #[serde(skip_serializing_if = "Option::is_none")]
9141 limit: &'a Option<i64>,
9142 #[serde(rename = "order")]
9143 #[serde(skip_serializing_if = "Option::is_none")]
9144 order: &'a Option<crate::__types::ListFilesInVectorStoreBatchParamsOrder>,
9145 #[serde(rename = "after")]
9146 #[serde(skip_serializing_if = "Option::is_none")]
9147 after: &'a Option<String>,
9148 #[serde(rename = "before")]
9149 #[serde(skip_serializing_if = "Option::is_none")]
9150 before: &'a Option<String>,
9151 #[serde(rename = "filter")]
9152 #[serde(skip_serializing_if = "Option::is_none")]
9153 filter: &'a Option<crate::__types::ListFilesInVectorStoreBatchParamsFilter>,
9154 #[serde(skip_serializing)]
9155 _phantom: std::marker::PhantomData<&'a ()>,
9156 }
9157 #[allow(clippy::useless_format)]
9158 let mut path = format!(
9159 "/vector_stores/{vector_store_id}/file_batches/{batch_id}/files",
9160 vector_store_id = params.vector_store_id,
9161 batch_id = params.batch_id
9162 );
9163 let crate::__types::ListFilesInVectorStoreBatchParams {
9164 limit,
9165 order,
9166 after,
9167 before,
9168 filter,
9169 ..
9170 } = params;
9171 let query = serde_urlencoded::to_string(Query {
9172 limit,
9173 order,
9174 after,
9175 before,
9176 filter,
9177 _phantom: std::marker::PhantomData,
9178 })?;
9179 if !query.is_empty() {
9180 path.push('?');
9181 path.push_str(&query);
9182 }
9183 path
9184 };
9185 let body = String::new();
9186 Ok(http::Request::builder()
9187 .method(http::Method::GET)
9188 .uri(path)
9189 .header(http::header::CONTENT_LENGTH, body.len())
9190 .body(body)?)
9191 },
9192 (
9193 http::StatusCode::from_u16(200u16).unwrap(),
9194 Some(mime::APPLICATION_JSON),
9195 ),
9196 ),
9197 crate::__combinators::Json::new,
9198 ))
9199}
9200future!(
9201 ListFilesInVectorStoreBatch,
9202 futures::future::AndThen<
9203 crate::__combinators::Send<Fut, B, E>,
9204 crate::__combinators::Json<B, E, crate::__types::ListVectorStoreFilesResponse>,
9205 fn(
9206 http::Response<B>,
9207 )
9208 -> crate::__combinators::Json<B, E, crate::__types::ListVectorStoreFilesResponse>,
9209 >,
9210 crate::__types::ListVectorStoreFilesResponse
9211);
9212#[doc = "Returns a list of vector store files."]
9213pub fn list_vector_store_files<C, Fut, B, E>(
9214 client: C,
9215 params: &crate::__types::ListVectorStoreFilesParams,
9216) -> ListVectorStoreFiles<Fut, B, E>
9217where
9218 C: FnOnce(http::Request<String>) -> Fut,
9219 Fut: Future<Output = Result<http::Response<B>, E>>,
9220 B: http_body::Body,
9221{
9222 ListVectorStoreFiles(futures::TryFutureExt::and_then(
9223 crate::__combinators::Send::new(
9224 client,
9225 || {
9226 let path = {
9227 #[serde_with::serde_as]
9228 #[derive(serde :: Serialize)]
9229 struct Query<'a> {
9230 #[serde(rename = "limit")]
9231 #[serde(skip_serializing_if = "Option::is_none")]
9232 limit: &'a Option<i64>,
9233 #[serde(rename = "order")]
9234 #[serde(skip_serializing_if = "Option::is_none")]
9235 order: &'a Option<crate::__types::ListVectorStoreFilesParamsOrder>,
9236 #[serde(rename = "after")]
9237 #[serde(skip_serializing_if = "Option::is_none")]
9238 after: &'a Option<String>,
9239 #[serde(rename = "before")]
9240 #[serde(skip_serializing_if = "Option::is_none")]
9241 before: &'a Option<String>,
9242 #[serde(rename = "filter")]
9243 #[serde(skip_serializing_if = "Option::is_none")]
9244 filter: &'a Option<crate::__types::ListVectorStoreFilesParamsFilter>,
9245 #[serde(skip_serializing)]
9246 _phantom: std::marker::PhantomData<&'a ()>,
9247 }
9248 #[allow(clippy::useless_format)]
9249 let mut path = format!(
9250 "/vector_stores/{vector_store_id}/files",
9251 vector_store_id = params.vector_store_id
9252 );
9253 let crate::__types::ListVectorStoreFilesParams {
9254 limit,
9255 order,
9256 after,
9257 before,
9258 filter,
9259 ..
9260 } = params;
9261 let query = serde_urlencoded::to_string(Query {
9262 limit,
9263 order,
9264 after,
9265 before,
9266 filter,
9267 _phantom: std::marker::PhantomData,
9268 })?;
9269 if !query.is_empty() {
9270 path.push('?');
9271 path.push_str(&query);
9272 }
9273 path
9274 };
9275 let body = String::new();
9276 Ok(http::Request::builder()
9277 .method(http::Method::GET)
9278 .uri(path)
9279 .header(http::header::CONTENT_LENGTH, body.len())
9280 .body(body)?)
9281 },
9282 (
9283 http::StatusCode::from_u16(200u16).unwrap(),
9284 Some(mime::APPLICATION_JSON),
9285 ),
9286 ),
9287 crate::__combinators::Json::new,
9288 ))
9289}
9290future!(
9291 ListVectorStoreFiles,
9292 futures::future::AndThen<
9293 crate::__combinators::Send<Fut, B, E>,
9294 crate::__combinators::Json<B, E, crate::__types::ListVectorStoreFilesResponse>,
9295 fn(
9296 http::Response<B>,
9297 )
9298 -> crate::__combinators::Json<B, E, crate::__types::ListVectorStoreFilesResponse>,
9299 >,
9300 crate::__types::ListVectorStoreFilesResponse
9301);
9302#[doc = "Create a vector store file by attaching a [File](https://platform.openai.com/docs/api-reference/files) to a [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)."]
9303pub fn create_vector_store_file<C, Fut, B, E>(
9304 client: C,
9305 params: &crate::__types::CreateVectorStoreFileParams,
9306 request: &crate::__types::CreateVectorStoreFileRequest,
9307) -> CreateVectorStoreFile<Fut, B, E>
9308where
9309 C: FnOnce(http::Request<String>) -> Fut,
9310 Fut: Future<Output = Result<http::Response<B>, E>>,
9311 B: http_body::Body,
9312{
9313 CreateVectorStoreFile(futures::TryFutureExt::and_then(
9314 crate::__combinators::Send::new(
9315 client,
9316 || {
9317 let path = {
9318 #[serde_with::serde_as]
9319 #[derive(serde :: Serialize)]
9320 struct Query<'a> {
9321 #[serde(skip_serializing)]
9322 _phantom: std::marker::PhantomData<&'a ()>,
9323 }
9324 #[allow(clippy::useless_format)]
9325 let mut path = format!(
9326 "/vector_stores/{vector_store_id}/files",
9327 vector_store_id = params.vector_store_id
9328 );
9329 let crate::__types::CreateVectorStoreFileParams { .. } = params;
9330 let query = serde_urlencoded::to_string(Query {
9331 _phantom: std::marker::PhantomData,
9332 })?;
9333 if !query.is_empty() {
9334 path.push('?');
9335 path.push_str(&query);
9336 }
9337 path
9338 };
9339 let body = serde_json::to_string(request)?;
9340 Ok(http::Request::builder()
9341 .method(http::Method::POST)
9342 .uri(path)
9343 .header(http::header::CONTENT_LENGTH, body.len())
9344 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
9345 .body(body)?)
9346 },
9347 (
9348 http::StatusCode::from_u16(200u16).unwrap(),
9349 Some(mime::APPLICATION_JSON),
9350 ),
9351 ),
9352 crate::__combinators::Json::new,
9353 ))
9354}
9355future!(
9356 CreateVectorStoreFile,
9357 futures::future::AndThen<
9358 crate::__combinators::Send<Fut, B, E>,
9359 crate::__combinators::Json<B, E, crate::__types::VectorStoreFileObject>,
9360 fn(
9361 http::Response<B>,
9362 ) -> crate::__combinators::Json<B, E, crate::__types::VectorStoreFileObject>,
9363 >,
9364 crate::__types::VectorStoreFileObject
9365);
9366#[doc = "Retrieves a vector store file."]
9367pub fn get_vector_store_file<C, Fut, B, E>(
9368 client: C,
9369 params: &crate::__types::GetVectorStoreFileParams,
9370) -> GetVectorStoreFile<Fut, B, E>
9371where
9372 C: FnOnce(http::Request<String>) -> Fut,
9373 Fut: Future<Output = Result<http::Response<B>, E>>,
9374 B: http_body::Body,
9375{
9376 GetVectorStoreFile(futures::TryFutureExt::and_then(
9377 crate::__combinators::Send::new(
9378 client,
9379 || {
9380 let path = {
9381 #[serde_with::serde_as]
9382 #[derive(serde :: Serialize)]
9383 struct Query<'a> {
9384 #[serde(skip_serializing)]
9385 _phantom: std::marker::PhantomData<&'a ()>,
9386 }
9387 #[allow(clippy::useless_format)]
9388 let mut path = format!(
9389 "/vector_stores/{vector_store_id}/files/{file_id}",
9390 vector_store_id = params.vector_store_id,
9391 file_id = params.file_id
9392 );
9393 let crate::__types::GetVectorStoreFileParams { .. } = params;
9394 let query = serde_urlencoded::to_string(Query {
9395 _phantom: std::marker::PhantomData,
9396 })?;
9397 if !query.is_empty() {
9398 path.push('?');
9399 path.push_str(&query);
9400 }
9401 path
9402 };
9403 let body = String::new();
9404 Ok(http::Request::builder()
9405 .method(http::Method::GET)
9406 .uri(path)
9407 .header(http::header::CONTENT_LENGTH, body.len())
9408 .body(body)?)
9409 },
9410 (
9411 http::StatusCode::from_u16(200u16).unwrap(),
9412 Some(mime::APPLICATION_JSON),
9413 ),
9414 ),
9415 crate::__combinators::Json::new,
9416 ))
9417}
9418future!(
9419 GetVectorStoreFile,
9420 futures::future::AndThen<
9421 crate::__combinators::Send<Fut, B, E>,
9422 crate::__combinators::Json<B, E, crate::__types::VectorStoreFileObject>,
9423 fn(
9424 http::Response<B>,
9425 ) -> crate::__combinators::Json<B, E, crate::__types::VectorStoreFileObject>,
9426 >,
9427 crate::__types::VectorStoreFileObject
9428);
9429#[doc = "Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](https://platform.openai.com/docs/api-reference/files/delete) endpoint."]
9430pub fn delete_vector_store_file<C, Fut, B, E>(
9431 client: C,
9432 params: &crate::__types::DeleteVectorStoreFileParams,
9433) -> DeleteVectorStoreFile<Fut, B, E>
9434where
9435 C: FnOnce(http::Request<String>) -> Fut,
9436 Fut: Future<Output = Result<http::Response<B>, E>>,
9437 B: http_body::Body,
9438{
9439 DeleteVectorStoreFile(futures::TryFutureExt::and_then(
9440 crate::__combinators::Send::new(
9441 client,
9442 || {
9443 let path = {
9444 #[serde_with::serde_as]
9445 #[derive(serde :: Serialize)]
9446 struct Query<'a> {
9447 #[serde(skip_serializing)]
9448 _phantom: std::marker::PhantomData<&'a ()>,
9449 }
9450 #[allow(clippy::useless_format)]
9451 let mut path = format!(
9452 "/vector_stores/{vector_store_id}/files/{file_id}",
9453 vector_store_id = params.vector_store_id,
9454 file_id = params.file_id
9455 );
9456 let crate::__types::DeleteVectorStoreFileParams { .. } = params;
9457 let query = serde_urlencoded::to_string(Query {
9458 _phantom: std::marker::PhantomData,
9459 })?;
9460 if !query.is_empty() {
9461 path.push('?');
9462 path.push_str(&query);
9463 }
9464 path
9465 };
9466 let body = String::new();
9467 Ok(http::Request::builder()
9468 .method(http::Method::DELETE)
9469 .uri(path)
9470 .header(http::header::CONTENT_LENGTH, body.len())
9471 .body(body)?)
9472 },
9473 (
9474 http::StatusCode::from_u16(200u16).unwrap(),
9475 Some(mime::APPLICATION_JSON),
9476 ),
9477 ),
9478 crate::__combinators::Json::new,
9479 ))
9480}
9481future!(
9482 DeleteVectorStoreFile,
9483 futures::future::AndThen<
9484 crate::__combinators::Send<Fut, B, E>,
9485 crate::__combinators::Json<B, E, crate::__types::DeleteVectorStoreFileResponse>,
9486 fn(
9487 http::Response<B>,
9488 )
9489 -> crate::__combinators::Json<B, E, crate::__types::DeleteVectorStoreFileResponse>,
9490 >,
9491 crate::__types::DeleteVectorStoreFileResponse
9492);
9493#[doc = "Update attributes on a vector store file."]
9494pub fn update_vector_store_file_attributes<C, Fut, B, E>(
9495 client: C,
9496 params: &crate::__types::UpdateVectorStoreFileAttributesParams,
9497 request: &crate::__types::UpdateVectorStoreFileAttributesRequest,
9498) -> UpdateVectorStoreFileAttributes<Fut, B, E>
9499where
9500 C: FnOnce(http::Request<String>) -> Fut,
9501 Fut: Future<Output = Result<http::Response<B>, E>>,
9502 B: http_body::Body,
9503{
9504 UpdateVectorStoreFileAttributes(futures::TryFutureExt::and_then(
9505 crate::__combinators::Send::new(
9506 client,
9507 || {
9508 let path = {
9509 #[serde_with::serde_as]
9510 #[derive(serde :: Serialize)]
9511 struct Query<'a> {
9512 #[serde(skip_serializing)]
9513 _phantom: std::marker::PhantomData<&'a ()>,
9514 }
9515 #[allow(clippy::useless_format)]
9516 let mut path = format!(
9517 "/vector_stores/{vector_store_id}/files/{file_id}",
9518 vector_store_id = params.vector_store_id,
9519 file_id = params.file_id
9520 );
9521 let crate::__types::UpdateVectorStoreFileAttributesParams { .. } = params;
9522 let query = serde_urlencoded::to_string(Query {
9523 _phantom: std::marker::PhantomData,
9524 })?;
9525 if !query.is_empty() {
9526 path.push('?');
9527 path.push_str(&query);
9528 }
9529 path
9530 };
9531 let body = serde_json::to_string(request)?;
9532 Ok(http::Request::builder()
9533 .method(http::Method::POST)
9534 .uri(path)
9535 .header(http::header::CONTENT_LENGTH, body.len())
9536 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
9537 .body(body)?)
9538 },
9539 (
9540 http::StatusCode::from_u16(200u16).unwrap(),
9541 Some(mime::APPLICATION_JSON),
9542 ),
9543 ),
9544 crate::__combinators::Json::new,
9545 ))
9546}
9547future!(
9548 UpdateVectorStoreFileAttributes,
9549 futures::future::AndThen<
9550 crate::__combinators::Send<Fut, B, E>,
9551 crate::__combinators::Json<B, E, crate::__types::VectorStoreFileObject>,
9552 fn(
9553 http::Response<B>,
9554 ) -> crate::__combinators::Json<B, E, crate::__types::VectorStoreFileObject>,
9555 >,
9556 crate::__types::VectorStoreFileObject
9557);
9558#[doc = "Retrieve the parsed contents of a vector store file."]
9559pub fn retrieve_vector_store_file_content<C, Fut, B, E>(
9560 client: C,
9561 params: &crate::__types::RetrieveVectorStoreFileContentParams,
9562) -> RetrieveVectorStoreFileContent<Fut, B, E>
9563where
9564 C: FnOnce(http::Request<String>) -> Fut,
9565 Fut: Future<Output = Result<http::Response<B>, E>>,
9566 B: http_body::Body,
9567{
9568 RetrieveVectorStoreFileContent(futures::TryFutureExt::and_then(
9569 crate::__combinators::Send::new(
9570 client,
9571 || {
9572 let path = {
9573 #[serde_with::serde_as]
9574 #[derive(serde :: Serialize)]
9575 struct Query<'a> {
9576 #[serde(skip_serializing)]
9577 _phantom: std::marker::PhantomData<&'a ()>,
9578 }
9579 #[allow(clippy::useless_format)]
9580 let mut path = format!(
9581 "/vector_stores/{vector_store_id}/files/{file_id}/content",
9582 vector_store_id = params.vector_store_id,
9583 file_id = params.file_id
9584 );
9585 let crate::__types::RetrieveVectorStoreFileContentParams { .. } = params;
9586 let query = serde_urlencoded::to_string(Query {
9587 _phantom: std::marker::PhantomData,
9588 })?;
9589 if !query.is_empty() {
9590 path.push('?');
9591 path.push_str(&query);
9592 }
9593 path
9594 };
9595 let body = String::new();
9596 Ok(http::Request::builder()
9597 .method(http::Method::GET)
9598 .uri(path)
9599 .header(http::header::CONTENT_LENGTH, body.len())
9600 .body(body)?)
9601 },
9602 (
9603 http::StatusCode::from_u16(200u16).unwrap(),
9604 Some(mime::APPLICATION_JSON),
9605 ),
9606 ),
9607 crate::__combinators::Json::new,
9608 ))
9609}
9610future!(
9611 RetrieveVectorStoreFileContent,
9612 futures::future::AndThen<
9613 crate::__combinators::Send<Fut, B, E>,
9614 crate::__combinators::Json<B, E, crate::__types::VectorStoreFileContentResponse>,
9615 fn(
9616 http::Response<B>,
9617 )
9618 -> crate::__combinators::Json<B, E, crate::__types::VectorStoreFileContentResponse>,
9619 >,
9620 crate::__types::VectorStoreFileContentResponse
9621);
9622#[doc = "Search a vector store for relevant chunks based on a query and file attributes filter."]
9623pub fn search_vector_store<C, Fut, B, E>(
9624 client: C,
9625 params: &crate::__types::SearchVectorStoreParams,
9626 request: &crate::__types::VectorStoreSearchRequest,
9627) -> SearchVectorStore<Fut, B, E>
9628where
9629 C: FnOnce(http::Request<String>) -> Fut,
9630 Fut: Future<Output = Result<http::Response<B>, E>>,
9631 B: http_body::Body,
9632{
9633 SearchVectorStore(futures::TryFutureExt::and_then(
9634 crate::__combinators::Send::new(
9635 client,
9636 || {
9637 let path = {
9638 #[serde_with::serde_as]
9639 #[derive(serde :: Serialize)]
9640 struct Query<'a> {
9641 #[serde(skip_serializing)]
9642 _phantom: std::marker::PhantomData<&'a ()>,
9643 }
9644 #[allow(clippy::useless_format)]
9645 let mut path = format!(
9646 "/vector_stores/{vector_store_id}/search",
9647 vector_store_id = params.vector_store_id
9648 );
9649 let crate::__types::SearchVectorStoreParams { .. } = params;
9650 let query = serde_urlencoded::to_string(Query {
9651 _phantom: std::marker::PhantomData,
9652 })?;
9653 if !query.is_empty() {
9654 path.push('?');
9655 path.push_str(&query);
9656 }
9657 path
9658 };
9659 let body = serde_json::to_string(request)?;
9660 Ok(http::Request::builder()
9661 .method(http::Method::POST)
9662 .uri(path)
9663 .header(http::header::CONTENT_LENGTH, body.len())
9664 .header(http::header::CONTENT_TYPE, mime::APPLICATION_JSON.as_ref())
9665 .body(body)?)
9666 },
9667 (
9668 http::StatusCode::from_u16(200u16).unwrap(),
9669 Some(mime::APPLICATION_JSON),
9670 ),
9671 ),
9672 crate::__combinators::Json::new,
9673 ))
9674}
9675future!(
9676 SearchVectorStore,
9677 futures::future::AndThen<
9678 crate::__combinators::Send<Fut, B, E>,
9679 crate::__combinators::Json<B, E, crate::__types::VectorStoreSearchResultsPage>,
9680 fn(
9681 http::Response<B>,
9682 )
9683 -> crate::__combinators::Json<B, E, crate::__types::VectorStoreSearchResultsPage>,
9684 >,
9685 crate::__types::VectorStoreSearchResultsPage
9686);