metaculus/apis/
questions_api.rs

1/*
2 * Metaculus API
3 *
4 * Welcome to the unofficial Rust client for the Metaculus API
5 *
6 * The version of the OpenAPI document: 1.0
7 * Contact: Benjamin Manns <opensource@benmanns.com>
8 * Generated by: https://openapi-generator.tech
9 */
10
11use reqwest;
12
13use super::{configuration, Error};
14use crate::apis::ResponseContent;
15
16/// struct for passing parameters to the method [`questions_add_consideration_vote_create`]
17#[derive(Clone, Debug)]
18pub struct QuestionsAddConsiderationVoteCreateParams {
19    /// A unique integer value identifying this question.
20    pub id: i32,
21}
22
23/// struct for passing parameters to the method [`questions_boost_create`]
24#[derive(Clone, Debug)]
25pub struct QuestionsBoostCreateParams {
26    /// A unique integer value identifying this question.
27    pub id: i32,
28    pub boost: crate::models::Boost,
29}
30
31/// struct for passing parameters to the method [`questions_bulk_predict_create`]
32#[derive(Clone, Debug)]
33pub struct QuestionsBulkPredictCreateParams {
34    pub bulk_prediction_input: crate::models::BulkPredictionInput,
35}
36
37/// struct for passing parameters to the method [`questions_create`]
38#[derive(Clone, Debug)]
39pub struct QuestionsCreateParams {
40    pub question_update: Option<crate::models::QuestionUpdate>,
41}
42
43/// struct for passing parameters to the method [`questions_destroy`]
44#[derive(Clone, Debug)]
45pub struct QuestionsDestroyParams {
46    /// A unique integer value identifying this question.
47    pub id: i32,
48}
49
50/// struct for passing parameters to the method [`questions_list`]
51#[derive(Clone, Debug)]
52pub struct QuestionsListParams {
53    pub access: Option<String>,
54    pub author: Option<i32>,
55    pub categories: Option<String>,
56    pub close_time__gt: Option<String>,
57    pub close_time__lt: Option<String>,
58    pub commented_by: Option<f32>,
59    pub contest: Option<String>,
60    pub forecast_type: Option<String>,
61    pub group: Option<i32>,
62    pub guessed_by: Option<f32>,
63    pub has_group: Option<bool>,
64    /// Set to 'true' to include the description (and categories) in responses
65    pub include_description: Option<String>,
66    /// Number of results to return per page.
67    pub limit: Option<i32>,
68    pub not_guessed_by: Option<f32>,
69    /// The initial index from which to return the results.
70    pub offset: Option<i32>,
71    /// Which field to use when ordering the results.
72    pub order_by: Option<String>,
73    pub project: Option<String>,
74    pub publish_time__gt: Option<String>,
75    pub publish_time__lt: Option<String>,
76    pub resolve_time__gt: Option<String>,
77    pub resolve_time__lt: Option<String>,
78    pub reversed_related: Option<f32>,
79    pub search: Option<String>,
80    pub status: Option<String>,
81    pub r#type: Option<String>,
82    pub unconditional: Option<bool>,
83    pub upvoted_by: Option<f32>,
84    pub username: Option<String>,
85    pub visible_from_project: Option<String>,
86}
87
88/// struct for passing parameters to the method [`questions_partial_update`]
89#[derive(Clone, Debug)]
90pub struct QuestionsPartialUpdateParams {
91    /// A unique integer value identifying this question.
92    pub id: i32,
93    pub patched_question_update: Option<crate::models::PatchedQuestionUpdate>,
94}
95
96/// struct for passing parameters to the method [`questions_predict_create`]
97#[derive(Clone, Debug)]
98pub struct QuestionsPredictCreateParams {
99    /// A unique integer value identifying this question.
100    pub id: i32,
101    pub prediction_input: crate::models::PredictionInput,
102}
103
104/// struct for passing parameters to the method [`questions_prediction_for_date_retrieve`]
105#[derive(Clone, Debug)]
106pub struct QuestionsPredictionForDateRetrieveParams {
107    /// A unique integer value identifying this question.
108    pub id: i32,
109}
110
111/// struct for passing parameters to the method [`questions_prediction_history_retrieve`]
112#[derive(Clone, Debug)]
113pub struct QuestionsPredictionHistoryRetrieveParams {
114    /// A unique integer value identifying this question.
115    pub id: i32,
116}
117
118/// struct for passing parameters to the method [`questions_predictions_retrieve`]
119#[derive(Clone, Debug)]
120pub struct QuestionsPredictionsRetrieveParams {
121    /// A unique integer value identifying this question.
122    pub id: i32,
123}
124
125/// struct for passing parameters to the method [`questions_question_sharing_create`]
126#[derive(Clone, Debug)]
127pub struct QuestionsQuestionSharingCreateParams {
128    /// A unique integer value identifying this question.
129    pub id: i32,
130    pub username: String,
131    pub share_question: crate::models::ShareQuestion,
132}
133
134/// struct for passing parameters to the method [`questions_question_sharing_destroy`]
135#[derive(Clone, Debug)]
136pub struct QuestionsQuestionSharingDestroyParams {
137    /// A unique integer value identifying this question.
138    pub id: i32,
139    pub username: String,
140}
141
142/// struct for passing parameters to the method [`questions_remove_consideration_vote_create`]
143#[derive(Clone, Debug)]
144pub struct QuestionsRemoveConsiderationVoteCreateParams {
145    /// A unique integer value identifying this question.
146    pub id: i32,
147}
148
149/// struct for passing parameters to the method [`questions_resolve_create`]
150#[derive(Clone, Debug)]
151pub struct QuestionsResolveCreateParams {
152    /// A unique integer value identifying this question.
153    pub id: i32,
154    pub question_resolve: crate::models::QuestionResolve,
155}
156
157/// struct for passing parameters to the method [`questions_retrieve`]
158#[derive(Clone, Debug)]
159pub struct QuestionsRetrieveParams {
160    /// A unique integer value identifying this question.
161    pub id: i32,
162}
163
164/// struct for passing parameters to the method [`questions_show_community_create`]
165#[derive(Clone, Debug)]
166pub struct QuestionsShowCommunityCreateParams {
167    /// A unique integer value identifying this question.
168    pub id: i32,
169    pub show_community: crate::models::ShowCommunity,
170}
171
172/// struct for passing parameters to the method [`questions_update`]
173#[derive(Clone, Debug)]
174pub struct QuestionsUpdateParams {
175    /// A unique integer value identifying this question.
176    pub id: i32,
177    pub question_update: Option<crate::models::QuestionUpdate>,
178}
179
180/// struct for passing parameters to the method [`questions_vote_create`]
181#[derive(Clone, Debug)]
182pub struct QuestionsVoteCreateParams {
183    /// A unique integer value identifying this question.
184    pub id: i32,
185    pub question_vote: crate::models::QuestionVote,
186}
187
188/// struct for typed errors of method [`questions_add_consideration_vote_create`]
189#[derive(Debug, Clone, Serialize, Deserialize)]
190#[serde(untagged)]
191pub enum QuestionsAddConsiderationVoteCreateError {
192    UnknownValue(serde_json::Value),
193}
194
195/// struct for typed errors of method [`questions_boost_create`]
196#[derive(Debug, Clone, Serialize, Deserialize)]
197#[serde(untagged)]
198pub enum QuestionsBoostCreateError {
199    UnknownValue(serde_json::Value),
200}
201
202/// struct for typed errors of method [`questions_bulk_predict_create`]
203#[derive(Debug, Clone, Serialize, Deserialize)]
204#[serde(untagged)]
205pub enum QuestionsBulkPredictCreateError {
206    UnknownValue(serde_json::Value),
207}
208
209/// struct for typed errors of method [`questions_create`]
210#[derive(Debug, Clone, Serialize, Deserialize)]
211#[serde(untagged)]
212pub enum QuestionsCreateError {
213    UnknownValue(serde_json::Value),
214}
215
216/// struct for typed errors of method [`questions_destroy`]
217#[derive(Debug, Clone, Serialize, Deserialize)]
218#[serde(untagged)]
219pub enum QuestionsDestroyError {
220    UnknownValue(serde_json::Value),
221}
222
223/// struct for typed errors of method [`questions_list`]
224#[derive(Debug, Clone, Serialize, Deserialize)]
225#[serde(untagged)]
226pub enum QuestionsListError {
227    UnknownValue(serde_json::Value),
228}
229
230/// struct for typed errors of method [`questions_partial_update`]
231#[derive(Debug, Clone, Serialize, Deserialize)]
232#[serde(untagged)]
233pub enum QuestionsPartialUpdateError {
234    UnknownValue(serde_json::Value),
235}
236
237/// struct for typed errors of method [`questions_predict_create`]
238#[derive(Debug, Clone, Serialize, Deserialize)]
239#[serde(untagged)]
240pub enum QuestionsPredictCreateError {
241    UnknownValue(serde_json::Value),
242}
243
244/// struct for typed errors of method [`questions_prediction_for_date_retrieve`]
245#[derive(Debug, Clone, Serialize, Deserialize)]
246#[serde(untagged)]
247pub enum QuestionsPredictionForDateRetrieveError {
248    UnknownValue(serde_json::Value),
249}
250
251/// struct for typed errors of method [`questions_prediction_history_retrieve`]
252#[derive(Debug, Clone, Serialize, Deserialize)]
253#[serde(untagged)]
254pub enum QuestionsPredictionHistoryRetrieveError {
255    UnknownValue(serde_json::Value),
256}
257
258/// struct for typed errors of method [`questions_predictions_retrieve`]
259#[derive(Debug, Clone, Serialize, Deserialize)]
260#[serde(untagged)]
261pub enum QuestionsPredictionsRetrieveError {
262    UnknownValue(serde_json::Value),
263}
264
265/// struct for typed errors of method [`questions_question_sharing_create`]
266#[derive(Debug, Clone, Serialize, Deserialize)]
267#[serde(untagged)]
268pub enum QuestionsQuestionSharingCreateError {
269    UnknownValue(serde_json::Value),
270}
271
272/// struct for typed errors of method [`questions_question_sharing_destroy`]
273#[derive(Debug, Clone, Serialize, Deserialize)]
274#[serde(untagged)]
275pub enum QuestionsQuestionSharingDestroyError {
276    UnknownValue(serde_json::Value),
277}
278
279/// struct for typed errors of method [`questions_remove_consideration_vote_create`]
280#[derive(Debug, Clone, Serialize, Deserialize)]
281#[serde(untagged)]
282pub enum QuestionsRemoveConsiderationVoteCreateError {
283    UnknownValue(serde_json::Value),
284}
285
286/// struct for typed errors of method [`questions_resolve_create`]
287#[derive(Debug, Clone, Serialize, Deserialize)]
288#[serde(untagged)]
289pub enum QuestionsResolveCreateError {
290    UnknownValue(serde_json::Value),
291}
292
293/// struct for typed errors of method [`questions_retrieve`]
294#[derive(Debug, Clone, Serialize, Deserialize)]
295#[serde(untagged)]
296pub enum QuestionsRetrieveError {
297    UnknownValue(serde_json::Value),
298}
299
300/// struct for typed errors of method [`questions_show_community_create`]
301#[derive(Debug, Clone, Serialize, Deserialize)]
302#[serde(untagged)]
303pub enum QuestionsShowCommunityCreateError {
304    UnknownValue(serde_json::Value),
305}
306
307/// struct for typed errors of method [`questions_update`]
308#[derive(Debug, Clone, Serialize, Deserialize)]
309#[serde(untagged)]
310pub enum QuestionsUpdateError {
311    UnknownValue(serde_json::Value),
312}
313
314/// struct for typed errors of method [`questions_vote_create`]
315#[derive(Debug, Clone, Serialize, Deserialize)]
316#[serde(untagged)]
317pub enum QuestionsVoteCreateError {
318    UnknownValue(serde_json::Value),
319}
320
321pub async fn questions_add_consideration_vote_create(
322    configuration: &configuration::Configuration,
323    params: QuestionsAddConsiderationVoteCreateParams,
324) -> Result<(), Error<QuestionsAddConsiderationVoteCreateError>> {
325    let local_var_configuration = configuration;
326
327    // unbox the parameters
328    let id = params.id;
329
330    let local_var_client = &local_var_configuration.client;
331
332    let local_var_uri_str = format!(
333        "{}/api2/questions/{id}/add_consideration_vote/",
334        local_var_configuration.base_path,
335        id = id
336    );
337    let mut local_var_req_builder =
338        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
339
340    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
341        local_var_req_builder =
342            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
343    }
344    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
345        local_var_req_builder = local_var_req_builder
346            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
347    };
348    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
349        local_var_req_builder =
350            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
351    };
352    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
353        let local_var_key = local_var_apikey.key.clone();
354        let local_var_value = match local_var_apikey.prefix {
355            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
356            None => local_var_key,
357        };
358        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
359    };
360
361    let local_var_req = local_var_req_builder.build()?;
362    let local_var_resp = local_var_client.execute(local_var_req).await?;
363
364    let local_var_status = local_var_resp.status();
365    let local_var_content = local_var_resp.text().await?;
366
367    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
368        Ok(())
369    } else {
370        let local_var_entity: Option<QuestionsAddConsiderationVoteCreateError> =
371            serde_json::from_str(&local_var_content).ok();
372        let local_var_error = ResponseContent {
373            status: local_var_status,
374            content: local_var_content,
375            entity: local_var_entity,
376        };
377        Err(Error::ResponseError(local_var_error))
378    }
379}
380
381pub async fn questions_boost_create(
382    configuration: &configuration::Configuration,
383    params: QuestionsBoostCreateParams,
384) -> Result<crate::models::Boost, Error<QuestionsBoostCreateError>> {
385    let local_var_configuration = configuration;
386
387    // unbox the parameters
388    let id = params.id;
389    let boost = params.boost;
390
391    let local_var_client = &local_var_configuration.client;
392
393    let local_var_uri_str = format!(
394        "{}/api2/questions/{id}/boost/",
395        local_var_configuration.base_path,
396        id = id
397    );
398    let mut local_var_req_builder =
399        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
400
401    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
402        local_var_req_builder =
403            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
404    }
405    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
406        local_var_req_builder = local_var_req_builder
407            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
408    };
409    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
410        local_var_req_builder =
411            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
412    };
413    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
414        let local_var_key = local_var_apikey.key.clone();
415        let local_var_value = match local_var_apikey.prefix {
416            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
417            None => local_var_key,
418        };
419        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
420    };
421    local_var_req_builder = local_var_req_builder.json(&boost);
422
423    let local_var_req = local_var_req_builder.build()?;
424    let local_var_resp = local_var_client.execute(local_var_req).await?;
425
426    let local_var_status = local_var_resp.status();
427    let local_var_content = local_var_resp.text().await?;
428
429    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
430        serde_json::from_str(&local_var_content).map_err(Error::from)
431    } else {
432        let local_var_entity: Option<QuestionsBoostCreateError> =
433            serde_json::from_str(&local_var_content).ok();
434        let local_var_error = ResponseContent {
435            status: local_var_status,
436            content: local_var_content,
437            entity: local_var_entity,
438        };
439        Err(Error::ResponseError(local_var_error))
440    }
441}
442
443pub async fn questions_bulk_predict_create(
444    configuration: &configuration::Configuration,
445    params: QuestionsBulkPredictCreateParams,
446) -> Result<crate::models::BulkPredictionInput, Error<QuestionsBulkPredictCreateError>> {
447    let local_var_configuration = configuration;
448
449    // unbox the parameters
450    let bulk_prediction_input = params.bulk_prediction_input;
451
452    let local_var_client = &local_var_configuration.client;
453
454    let local_var_uri_str = format!(
455        "{}/api2/questions/bulk-predict/",
456        local_var_configuration.base_path
457    );
458    let mut local_var_req_builder =
459        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
460
461    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
462        local_var_req_builder =
463            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
464    }
465    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
466        local_var_req_builder = local_var_req_builder
467            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
468    };
469    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
470        local_var_req_builder =
471            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
472    };
473    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
474        let local_var_key = local_var_apikey.key.clone();
475        let local_var_value = match local_var_apikey.prefix {
476            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
477            None => local_var_key,
478        };
479        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
480    };
481    local_var_req_builder = local_var_req_builder.json(&bulk_prediction_input);
482
483    let local_var_req = local_var_req_builder.build()?;
484    let local_var_resp = local_var_client.execute(local_var_req).await?;
485
486    let local_var_status = local_var_resp.status();
487    let local_var_content = local_var_resp.text().await?;
488
489    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
490        serde_json::from_str(&local_var_content).map_err(Error::from)
491    } else {
492        let local_var_entity: Option<QuestionsBulkPredictCreateError> =
493            serde_json::from_str(&local_var_content).ok();
494        let local_var_error = ResponseContent {
495            status: local_var_status,
496            content: local_var_content,
497            entity: local_var_entity,
498        };
499        Err(Error::ResponseError(local_var_error))
500    }
501}
502
503pub async fn questions_create(
504    configuration: &configuration::Configuration,
505    params: QuestionsCreateParams,
506) -> Result<crate::models::QuestionUpdate, Error<QuestionsCreateError>> {
507    let local_var_configuration = configuration;
508
509    // unbox the parameters
510    let question_update = params.question_update;
511
512    let local_var_client = &local_var_configuration.client;
513
514    let local_var_uri_str = format!("{}/api2/questions/", local_var_configuration.base_path);
515    let mut local_var_req_builder =
516        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
517
518    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
519        local_var_req_builder =
520            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
521    }
522    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
523        local_var_req_builder = local_var_req_builder
524            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
525    };
526    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
527        local_var_req_builder =
528            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
529    };
530    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
531        let local_var_key = local_var_apikey.key.clone();
532        let local_var_value = match local_var_apikey.prefix {
533            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
534            None => local_var_key,
535        };
536        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
537    };
538    local_var_req_builder = local_var_req_builder.json(&question_update);
539
540    let local_var_req = local_var_req_builder.build()?;
541    let local_var_resp = local_var_client.execute(local_var_req).await?;
542
543    let local_var_status = local_var_resp.status();
544    let local_var_content = local_var_resp.text().await?;
545
546    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
547        serde_json::from_str(&local_var_content).map_err(Error::from)
548    } else {
549        let local_var_entity: Option<QuestionsCreateError> =
550            serde_json::from_str(&local_var_content).ok();
551        let local_var_error = ResponseContent {
552            status: local_var_status,
553            content: local_var_content,
554            entity: local_var_entity,
555        };
556        Err(Error::ResponseError(local_var_error))
557    }
558}
559
560pub async fn questions_destroy(
561    configuration: &configuration::Configuration,
562    params: QuestionsDestroyParams,
563) -> Result<(), Error<QuestionsDestroyError>> {
564    let local_var_configuration = configuration;
565
566    // unbox the parameters
567    let id = params.id;
568
569    let local_var_client = &local_var_configuration.client;
570
571    let local_var_uri_str = format!(
572        "{}/api2/questions/{id}/",
573        local_var_configuration.base_path,
574        id = id
575    );
576    let mut local_var_req_builder =
577        local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
578
579    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
580        local_var_req_builder =
581            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
582    }
583    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
584        local_var_req_builder = local_var_req_builder
585            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
586    };
587    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
588        local_var_req_builder =
589            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
590    };
591    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
592        let local_var_key = local_var_apikey.key.clone();
593        let local_var_value = match local_var_apikey.prefix {
594            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
595            None => local_var_key,
596        };
597        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
598    };
599
600    let local_var_req = local_var_req_builder.build()?;
601    let local_var_resp = local_var_client.execute(local_var_req).await?;
602
603    let local_var_status = local_var_resp.status();
604    let local_var_content = local_var_resp.text().await?;
605
606    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
607        Ok(())
608    } else {
609        let local_var_entity: Option<QuestionsDestroyError> =
610            serde_json::from_str(&local_var_content).ok();
611        let local_var_error = ResponseContent {
612            status: local_var_status,
613            content: local_var_content,
614            entity: local_var_entity,
615        };
616        Err(Error::ResponseError(local_var_error))
617    }
618}
619
620pub async fn questions_list(
621    configuration: &configuration::Configuration,
622    params: QuestionsListParams,
623) -> Result<crate::models::PaginatedQuestionUserList, Error<QuestionsListError>> {
624    let local_var_configuration = configuration;
625
626    // unbox the parameters
627    let access = params.access;
628    let author = params.author;
629    let categories = params.categories;
630    let close_time__gt = params.close_time__gt;
631    let close_time__lt = params.close_time__lt;
632    let commented_by = params.commented_by;
633    let contest = params.contest;
634    let forecast_type = params.forecast_type;
635    let group = params.group;
636    let guessed_by = params.guessed_by;
637    let has_group = params.has_group;
638    let include_description = params.include_description;
639    let limit = params.limit;
640    let not_guessed_by = params.not_guessed_by;
641    let offset = params.offset;
642    let order_by = params.order_by;
643    let project = params.project;
644    let publish_time__gt = params.publish_time__gt;
645    let publish_time__lt = params.publish_time__lt;
646    let resolve_time__gt = params.resolve_time__gt;
647    let resolve_time__lt = params.resolve_time__lt;
648    let reversed_related = params.reversed_related;
649    let search = params.search;
650    let status = params.status;
651    let r#type = params.r#type;
652    let unconditional = params.unconditional;
653    let upvoted_by = params.upvoted_by;
654    let username = params.username;
655    let visible_from_project = params.visible_from_project;
656
657    let local_var_client = &local_var_configuration.client;
658
659    let local_var_uri_str = format!("{}/api2/questions/", local_var_configuration.base_path);
660    let mut local_var_req_builder =
661        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
662
663    if let Some(ref local_var_str) = access {
664        local_var_req_builder =
665            local_var_req_builder.query(&[("access", &local_var_str.to_string())]);
666    }
667    if let Some(ref local_var_str) = author {
668        local_var_req_builder =
669            local_var_req_builder.query(&[("author", &local_var_str.to_string())]);
670    }
671    if let Some(ref local_var_str) = categories {
672        local_var_req_builder =
673            local_var_req_builder.query(&[("categories", &local_var_str.to_string())]);
674    }
675    if let Some(ref local_var_str) = close_time__gt {
676        local_var_req_builder =
677            local_var_req_builder.query(&[("close_time__gt", &local_var_str.to_string())]);
678    }
679    if let Some(ref local_var_str) = close_time__lt {
680        local_var_req_builder =
681            local_var_req_builder.query(&[("close_time__lt", &local_var_str.to_string())]);
682    }
683    if let Some(ref local_var_str) = commented_by {
684        local_var_req_builder =
685            local_var_req_builder.query(&[("commented_by", &local_var_str.to_string())]);
686    }
687    if let Some(ref local_var_str) = contest {
688        local_var_req_builder =
689            local_var_req_builder.query(&[("contest", &local_var_str.to_string())]);
690    }
691    if let Some(ref local_var_str) = forecast_type {
692        local_var_req_builder =
693            local_var_req_builder.query(&[("forecast_type", &local_var_str.to_string())]);
694    }
695    if let Some(ref local_var_str) = group {
696        local_var_req_builder =
697            local_var_req_builder.query(&[("group", &local_var_str.to_string())]);
698    }
699    if let Some(ref local_var_str) = guessed_by {
700        local_var_req_builder =
701            local_var_req_builder.query(&[("guessed_by", &local_var_str.to_string())]);
702    }
703    if let Some(ref local_var_str) = has_group {
704        local_var_req_builder =
705            local_var_req_builder.query(&[("has_group", &local_var_str.to_string())]);
706    }
707    if let Some(ref local_var_str) = include_description {
708        local_var_req_builder =
709            local_var_req_builder.query(&[("include_description", &local_var_str.to_string())]);
710    }
711    if let Some(ref local_var_str) = limit {
712        local_var_req_builder =
713            local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
714    }
715    if let Some(ref local_var_str) = not_guessed_by {
716        local_var_req_builder =
717            local_var_req_builder.query(&[("not_guessed_by", &local_var_str.to_string())]);
718    }
719    if let Some(ref local_var_str) = offset {
720        local_var_req_builder =
721            local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
722    }
723    if let Some(ref local_var_str) = order_by {
724        local_var_req_builder =
725            local_var_req_builder.query(&[("order_by", &local_var_str.to_string())]);
726    }
727    if let Some(ref local_var_str) = project {
728        local_var_req_builder =
729            local_var_req_builder.query(&[("project", &local_var_str.to_string())]);
730    }
731    if let Some(ref local_var_str) = publish_time__gt {
732        local_var_req_builder =
733            local_var_req_builder.query(&[("publish_time__gt", &local_var_str.to_string())]);
734    }
735    if let Some(ref local_var_str) = publish_time__lt {
736        local_var_req_builder =
737            local_var_req_builder.query(&[("publish_time__lt", &local_var_str.to_string())]);
738    }
739    if let Some(ref local_var_str) = resolve_time__gt {
740        local_var_req_builder =
741            local_var_req_builder.query(&[("resolve_time__gt", &local_var_str.to_string())]);
742    }
743    if let Some(ref local_var_str) = resolve_time__lt {
744        local_var_req_builder =
745            local_var_req_builder.query(&[("resolve_time__lt", &local_var_str.to_string())]);
746    }
747    if let Some(ref local_var_str) = reversed_related {
748        local_var_req_builder =
749            local_var_req_builder.query(&[("reversed_related", &local_var_str.to_string())]);
750    }
751    if let Some(ref local_var_str) = search {
752        local_var_req_builder =
753            local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
754    }
755    if let Some(ref local_var_str) = status {
756        local_var_req_builder =
757            local_var_req_builder.query(&[("status", &local_var_str.to_string())]);
758    }
759    if let Some(ref local_var_str) = r#type {
760        local_var_req_builder =
761            local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
762    }
763    if let Some(ref local_var_str) = unconditional {
764        local_var_req_builder =
765            local_var_req_builder.query(&[("unconditional", &local_var_str.to_string())]);
766    }
767    if let Some(ref local_var_str) = upvoted_by {
768        local_var_req_builder =
769            local_var_req_builder.query(&[("upvoted_by", &local_var_str.to_string())]);
770    }
771    if let Some(ref local_var_str) = username {
772        local_var_req_builder =
773            local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
774    }
775    if let Some(ref local_var_str) = visible_from_project {
776        local_var_req_builder =
777            local_var_req_builder.query(&[("visible_from_project", &local_var_str.to_string())]);
778    }
779    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
780        local_var_req_builder =
781            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
782    }
783    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
784        local_var_req_builder = local_var_req_builder
785            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
786    };
787    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
788        local_var_req_builder =
789            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
790    };
791    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
792        let local_var_key = local_var_apikey.key.clone();
793        let local_var_value = match local_var_apikey.prefix {
794            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
795            None => local_var_key,
796        };
797        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
798    };
799
800    let local_var_req = local_var_req_builder.build()?;
801    let local_var_resp = local_var_client.execute(local_var_req).await?;
802
803    let local_var_status = local_var_resp.status();
804    let local_var_content = local_var_resp.text().await?;
805
806    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
807        serde_json::from_str(&local_var_content).map_err(Error::from)
808    } else {
809        let local_var_entity: Option<QuestionsListError> =
810            serde_json::from_str(&local_var_content).ok();
811        let local_var_error = ResponseContent {
812            status: local_var_status,
813            content: local_var_content,
814            entity: local_var_entity,
815        };
816        Err(Error::ResponseError(local_var_error))
817    }
818}
819
820pub async fn questions_partial_update(
821    configuration: &configuration::Configuration,
822    params: QuestionsPartialUpdateParams,
823) -> Result<crate::models::QuestionUpdate, Error<QuestionsPartialUpdateError>> {
824    let local_var_configuration = configuration;
825
826    // unbox the parameters
827    let id = params.id;
828    let patched_question_update = params.patched_question_update;
829
830    let local_var_client = &local_var_configuration.client;
831
832    let local_var_uri_str = format!(
833        "{}/api2/questions/{id}/",
834        local_var_configuration.base_path,
835        id = id
836    );
837    let mut local_var_req_builder =
838        local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
839
840    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
841        local_var_req_builder =
842            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
843    }
844    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
845        local_var_req_builder = local_var_req_builder
846            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
847    };
848    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
849        local_var_req_builder =
850            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
851    };
852    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
853        let local_var_key = local_var_apikey.key.clone();
854        let local_var_value = match local_var_apikey.prefix {
855            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
856            None => local_var_key,
857        };
858        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
859    };
860    local_var_req_builder = local_var_req_builder.json(&patched_question_update);
861
862    let local_var_req = local_var_req_builder.build()?;
863    let local_var_resp = local_var_client.execute(local_var_req).await?;
864
865    let local_var_status = local_var_resp.status();
866    let local_var_content = local_var_resp.text().await?;
867
868    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
869        serde_json::from_str(&local_var_content).map_err(Error::from)
870    } else {
871        let local_var_entity: Option<QuestionsPartialUpdateError> =
872            serde_json::from_str(&local_var_content).ok();
873        let local_var_error = ResponseContent {
874            status: local_var_status,
875            content: local_var_content,
876            entity: local_var_entity,
877        };
878        Err(Error::ResponseError(local_var_error))
879    }
880}
881
882pub async fn questions_predict_create(
883    configuration: &configuration::Configuration,
884    params: QuestionsPredictCreateParams,
885) -> Result<crate::models::PredictionInput, Error<QuestionsPredictCreateError>> {
886    let local_var_configuration = configuration;
887
888    // unbox the parameters
889    let id = params.id;
890    let prediction_input = params.prediction_input;
891
892    let local_var_client = &local_var_configuration.client;
893
894    let local_var_uri_str = format!(
895        "{}/api2/questions/{id}/predict/",
896        local_var_configuration.base_path,
897        id = id
898    );
899    let mut local_var_req_builder =
900        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
901
902    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
903        local_var_req_builder =
904            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
905    }
906    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
907        local_var_req_builder = local_var_req_builder
908            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
909    };
910    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
911        local_var_req_builder =
912            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
913    };
914    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
915        let local_var_key = local_var_apikey.key.clone();
916        let local_var_value = match local_var_apikey.prefix {
917            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
918            None => local_var_key,
919        };
920        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
921    };
922    local_var_req_builder = local_var_req_builder.json(&prediction_input);
923
924    let local_var_req = local_var_req_builder.build()?;
925    let local_var_resp = local_var_client.execute(local_var_req).await?;
926
927    let local_var_status = local_var_resp.status();
928    let local_var_content = local_var_resp.text().await?;
929
930    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
931        serde_json::from_str(&local_var_content).map_err(Error::from)
932    } else {
933        let local_var_entity: Option<QuestionsPredictCreateError> =
934            serde_json::from_str(&local_var_content).ok();
935        let local_var_error = ResponseContent {
936            status: local_var_status,
937            content: local_var_content,
938            entity: local_var_entity,
939        };
940        Err(Error::ResponseError(local_var_error))
941    }
942}
943
944/// This endpoint is used only for Tezos verification
945pub async fn questions_prediction_for_date_retrieve(
946    configuration: &configuration::Configuration,
947    params: QuestionsPredictionForDateRetrieveParams,
948) -> Result<crate::models::PredictionForDate, Error<QuestionsPredictionForDateRetrieveError>> {
949    let local_var_configuration = configuration;
950
951    // unbox the parameters
952    let id = params.id;
953
954    let local_var_client = &local_var_configuration.client;
955
956    let local_var_uri_str = format!(
957        "{}/api2/questions/{id}/prediction-for-date/",
958        local_var_configuration.base_path,
959        id = id
960    );
961    let mut local_var_req_builder =
962        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
963
964    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
965        local_var_req_builder =
966            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
967    }
968    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
969        local_var_req_builder = local_var_req_builder
970            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
971    };
972    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
973        local_var_req_builder =
974            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
975    };
976    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
977        let local_var_key = local_var_apikey.key.clone();
978        let local_var_value = match local_var_apikey.prefix {
979            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
980            None => local_var_key,
981        };
982        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
983    };
984
985    let local_var_req = local_var_req_builder.build()?;
986    let local_var_resp = local_var_client.execute(local_var_req).await?;
987
988    let local_var_status = local_var_resp.status();
989    let local_var_content = local_var_resp.text().await?;
990
991    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
992        serde_json::from_str(&local_var_content).map_err(Error::from)
993    } else {
994        let local_var_entity: Option<QuestionsPredictionForDateRetrieveError> =
995            serde_json::from_str(&local_var_content).ok();
996        let local_var_error = ResponseContent {
997            status: local_var_status,
998            content: local_var_content,
999            entity: local_var_entity,
1000        };
1001        Err(Error::ResponseError(local_var_error))
1002    }
1003}
1004
1005pub async fn questions_prediction_history_retrieve(
1006    configuration: &configuration::Configuration,
1007    params: QuestionsPredictionHistoryRetrieveParams,
1008) -> Result<crate::models::PredictionHistory, Error<QuestionsPredictionHistoryRetrieveError>> {
1009    let local_var_configuration = configuration;
1010
1011    // unbox the parameters
1012    let id = params.id;
1013
1014    let local_var_client = &local_var_configuration.client;
1015
1016    let local_var_uri_str = format!(
1017        "{}/api2/questions/{id}/prediction-history/",
1018        local_var_configuration.base_path,
1019        id = id
1020    );
1021    let mut local_var_req_builder =
1022        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1023
1024    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1025        local_var_req_builder =
1026            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1027    }
1028    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1029        local_var_req_builder = local_var_req_builder
1030            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
1031    };
1032    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
1033        local_var_req_builder =
1034            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
1035    };
1036    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1037        let local_var_key = local_var_apikey.key.clone();
1038        let local_var_value = match local_var_apikey.prefix {
1039            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
1040            None => local_var_key,
1041        };
1042        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1043    };
1044
1045    let local_var_req = local_var_req_builder.build()?;
1046    let local_var_resp = local_var_client.execute(local_var_req).await?;
1047
1048    let local_var_status = local_var_resp.status();
1049    let local_var_content = local_var_resp.text().await?;
1050
1051    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1052        serde_json::from_str(&local_var_content).map_err(Error::from)
1053    } else {
1054        let local_var_entity: Option<QuestionsPredictionHistoryRetrieveError> =
1055            serde_json::from_str(&local_var_content).ok();
1056        let local_var_error = ResponseContent {
1057            status: local_var_status,
1058            content: local_var_content,
1059            entity: local_var_entity,
1060        };
1061        Err(Error::ResponseError(local_var_error))
1062    }
1063}
1064
1065pub async fn questions_predictions_retrieve(
1066    configuration: &configuration::Configuration,
1067    params: QuestionsPredictionsRetrieveParams,
1068) -> Result<Vec<crate::models::ExtendedPredictionUsername>, Error<QuestionsPredictionsRetrieveError>>
1069{
1070    let local_var_configuration = configuration;
1071
1072    // unbox the parameters
1073    let id = params.id;
1074
1075    let local_var_client = &local_var_configuration.client;
1076
1077    let local_var_uri_str = format!(
1078        "{}/api2/questions/{id}/predictions/",
1079        local_var_configuration.base_path,
1080        id = id
1081    );
1082    let mut local_var_req_builder =
1083        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1084
1085    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1086        local_var_req_builder =
1087            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1088    }
1089    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1090        local_var_req_builder = local_var_req_builder
1091            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
1092    };
1093    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
1094        local_var_req_builder =
1095            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
1096    };
1097    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1098        let local_var_key = local_var_apikey.key.clone();
1099        let local_var_value = match local_var_apikey.prefix {
1100            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
1101            None => local_var_key,
1102        };
1103        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1104    };
1105
1106    let local_var_req = local_var_req_builder.build()?;
1107    let local_var_resp = local_var_client.execute(local_var_req).await?;
1108
1109    let local_var_status = local_var_resp.status();
1110    let local_var_content = local_var_resp.text().await?;
1111
1112    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1113        serde_json::from_str(&local_var_content).map_err(Error::from)
1114    } else {
1115        let local_var_entity: Option<QuestionsPredictionsRetrieveError> =
1116            serde_json::from_str(&local_var_content).ok();
1117        let local_var_error = ResponseContent {
1118            status: local_var_status,
1119            content: local_var_content,
1120            entity: local_var_entity,
1121        };
1122        Err(Error::ResponseError(local_var_error))
1123    }
1124}
1125
1126/// This endpoint is used for sharing Private and Draft questions with other users. If sharing private question - invited user will receive \"predictor\" permissions. If sharing draft question - invited user will receive \"coauthor\" permissions\"
1127pub async fn questions_question_sharing_create(
1128    configuration: &configuration::Configuration,
1129    params: QuestionsQuestionSharingCreateParams,
1130) -> Result<crate::models::ShareQuestion, Error<QuestionsQuestionSharingCreateError>> {
1131    let local_var_configuration = configuration;
1132
1133    // unbox the parameters
1134    let id = params.id;
1135    let username = params.username;
1136    let share_question = params.share_question;
1137
1138    let local_var_client = &local_var_configuration.client;
1139
1140    let local_var_uri_str = format!(
1141        "{}/api2/questions/{id}/question-sharing/{username}/",
1142        local_var_configuration.base_path,
1143        id = id,
1144        username = crate::apis::urlencode(username)
1145    );
1146    let mut local_var_req_builder =
1147        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1148
1149    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1150        local_var_req_builder =
1151            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1152    }
1153    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1154        local_var_req_builder = local_var_req_builder
1155            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
1156    };
1157    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
1158        local_var_req_builder =
1159            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
1160    };
1161    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1162        let local_var_key = local_var_apikey.key.clone();
1163        let local_var_value = match local_var_apikey.prefix {
1164            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
1165            None => local_var_key,
1166        };
1167        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1168    };
1169    local_var_req_builder = local_var_req_builder.json(&share_question);
1170
1171    let local_var_req = local_var_req_builder.build()?;
1172    let local_var_resp = local_var_client.execute(local_var_req).await?;
1173
1174    let local_var_status = local_var_resp.status();
1175    let local_var_content = local_var_resp.text().await?;
1176
1177    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1178        serde_json::from_str(&local_var_content).map_err(Error::from)
1179    } else {
1180        let local_var_entity: Option<QuestionsQuestionSharingCreateError> =
1181            serde_json::from_str(&local_var_content).ok();
1182        let local_var_error = ResponseContent {
1183            status: local_var_status,
1184            content: local_var_content,
1185            entity: local_var_entity,
1186        };
1187        Err(Error::ResponseError(local_var_error))
1188    }
1189}
1190
1191/// This endpoint is used for sharing Private and Draft questions with other users. If sharing private question - invited user will receive \"predictor\" permissions. If sharing draft question - invited user will receive \"coauthor\" permissions\"
1192pub async fn questions_question_sharing_destroy(
1193    configuration: &configuration::Configuration,
1194    params: QuestionsQuestionSharingDestroyParams,
1195) -> Result<(), Error<QuestionsQuestionSharingDestroyError>> {
1196    let local_var_configuration = configuration;
1197
1198    // unbox the parameters
1199    let id = params.id;
1200    let username = params.username;
1201
1202    let local_var_client = &local_var_configuration.client;
1203
1204    let local_var_uri_str = format!(
1205        "{}/api2/questions/{id}/question-sharing/{username}/",
1206        local_var_configuration.base_path,
1207        id = id,
1208        username = crate::apis::urlencode(username)
1209    );
1210    let mut local_var_req_builder =
1211        local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1212
1213    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1214        local_var_req_builder =
1215            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1216    }
1217    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1218        local_var_req_builder = local_var_req_builder
1219            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
1220    };
1221    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
1222        local_var_req_builder =
1223            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
1224    };
1225    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1226        let local_var_key = local_var_apikey.key.clone();
1227        let local_var_value = match local_var_apikey.prefix {
1228            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
1229            None => local_var_key,
1230        };
1231        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1232    };
1233
1234    let local_var_req = local_var_req_builder.build()?;
1235    let local_var_resp = local_var_client.execute(local_var_req).await?;
1236
1237    let local_var_status = local_var_resp.status();
1238    let local_var_content = local_var_resp.text().await?;
1239
1240    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1241        Ok(())
1242    } else {
1243        let local_var_entity: Option<QuestionsQuestionSharingDestroyError> =
1244            serde_json::from_str(&local_var_content).ok();
1245        let local_var_error = ResponseContent {
1246            status: local_var_status,
1247            content: local_var_content,
1248            entity: local_var_entity,
1249        };
1250        Err(Error::ResponseError(local_var_error))
1251    }
1252}
1253
1254pub async fn questions_remove_consideration_vote_create(
1255    configuration: &configuration::Configuration,
1256    params: QuestionsRemoveConsiderationVoteCreateParams,
1257) -> Result<(), Error<QuestionsRemoveConsiderationVoteCreateError>> {
1258    let local_var_configuration = configuration;
1259
1260    // unbox the parameters
1261    let id = params.id;
1262
1263    let local_var_client = &local_var_configuration.client;
1264
1265    let local_var_uri_str = format!(
1266        "{}/api2/questions/{id}/remove_consideration_vote/",
1267        local_var_configuration.base_path,
1268        id = id
1269    );
1270    let mut local_var_req_builder =
1271        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1272
1273    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1274        local_var_req_builder =
1275            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1276    }
1277    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1278        local_var_req_builder = local_var_req_builder
1279            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
1280    };
1281    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
1282        local_var_req_builder =
1283            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
1284    };
1285    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1286        let local_var_key = local_var_apikey.key.clone();
1287        let local_var_value = match local_var_apikey.prefix {
1288            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
1289            None => local_var_key,
1290        };
1291        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1292    };
1293
1294    let local_var_req = local_var_req_builder.build()?;
1295    let local_var_resp = local_var_client.execute(local_var_req).await?;
1296
1297    let local_var_status = local_var_resp.status();
1298    let local_var_content = local_var_resp.text().await?;
1299
1300    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1301        Ok(())
1302    } else {
1303        let local_var_entity: Option<QuestionsRemoveConsiderationVoteCreateError> =
1304            serde_json::from_str(&local_var_content).ok();
1305        let local_var_error = ResponseContent {
1306            status: local_var_status,
1307            content: local_var_content,
1308            entity: local_var_entity,
1309        };
1310        Err(Error::ResponseError(local_var_error))
1311    }
1312}
1313
1314pub async fn questions_resolve_create(
1315    configuration: &configuration::Configuration,
1316    params: QuestionsResolveCreateParams,
1317) -> Result<crate::models::QuestionResolve, Error<QuestionsResolveCreateError>> {
1318    let local_var_configuration = configuration;
1319
1320    // unbox the parameters
1321    let id = params.id;
1322    let question_resolve = params.question_resolve;
1323
1324    let local_var_client = &local_var_configuration.client;
1325
1326    let local_var_uri_str = format!(
1327        "{}/api2/questions/{id}/resolve/",
1328        local_var_configuration.base_path,
1329        id = id
1330    );
1331    let mut local_var_req_builder =
1332        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1333
1334    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1335        local_var_req_builder =
1336            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1337    }
1338    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1339        local_var_req_builder = local_var_req_builder
1340            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
1341    };
1342    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
1343        local_var_req_builder =
1344            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
1345    };
1346    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1347        let local_var_key = local_var_apikey.key.clone();
1348        let local_var_value = match local_var_apikey.prefix {
1349            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
1350            None => local_var_key,
1351        };
1352        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1353    };
1354    local_var_req_builder = local_var_req_builder.json(&question_resolve);
1355
1356    let local_var_req = local_var_req_builder.build()?;
1357    let local_var_resp = local_var_client.execute(local_var_req).await?;
1358
1359    let local_var_status = local_var_resp.status();
1360    let local_var_content = local_var_resp.text().await?;
1361
1362    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1363        serde_json::from_str(&local_var_content).map_err(Error::from)
1364    } else {
1365        let local_var_entity: Option<QuestionsResolveCreateError> =
1366            serde_json::from_str(&local_var_content).ok();
1367        let local_var_error = ResponseContent {
1368            status: local_var_status,
1369            content: local_var_content,
1370            entity: local_var_entity,
1371        };
1372        Err(Error::ResponseError(local_var_error))
1373    }
1374}
1375
1376pub async fn questions_retrieve(
1377    configuration: &configuration::Configuration,
1378    params: QuestionsRetrieveParams,
1379) -> Result<crate::models::QuestionUserDetail, Error<QuestionsRetrieveError>> {
1380    let local_var_configuration = configuration;
1381
1382    // unbox the parameters
1383    let id = params.id;
1384
1385    let local_var_client = &local_var_configuration.client;
1386
1387    let local_var_uri_str = format!(
1388        "{}/api2/questions/{id}/",
1389        local_var_configuration.base_path,
1390        id = id
1391    );
1392    let mut local_var_req_builder =
1393        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1394
1395    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1396        local_var_req_builder =
1397            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1398    }
1399    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1400        local_var_req_builder = local_var_req_builder
1401            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
1402    };
1403    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
1404        local_var_req_builder =
1405            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
1406    };
1407    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1408        let local_var_key = local_var_apikey.key.clone();
1409        let local_var_value = match local_var_apikey.prefix {
1410            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
1411            None => local_var_key,
1412        };
1413        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1414    };
1415
1416    let local_var_req = local_var_req_builder.build()?;
1417    let local_var_resp = local_var_client.execute(local_var_req).await?;
1418
1419    let local_var_status = local_var_resp.status();
1420    let local_var_content = local_var_resp.text().await?;
1421
1422    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1423        serde_json::from_str(&local_var_content).map_err(Error::from)
1424    } else {
1425        let local_var_entity: Option<QuestionsRetrieveError> =
1426            serde_json::from_str(&local_var_content).ok();
1427        let local_var_error = ResponseContent {
1428            status: local_var_status,
1429            content: local_var_content,
1430            entity: local_var_entity,
1431        };
1432        Err(Error::ResponseError(local_var_error))
1433    }
1434}
1435
1436pub async fn questions_show_community_create(
1437    configuration: &configuration::Configuration,
1438    params: QuestionsShowCommunityCreateParams,
1439) -> Result<crate::models::ShowCommunity, Error<QuestionsShowCommunityCreateError>> {
1440    let local_var_configuration = configuration;
1441
1442    // unbox the parameters
1443    let id = params.id;
1444    let show_community = params.show_community;
1445
1446    let local_var_client = &local_var_configuration.client;
1447
1448    let local_var_uri_str = format!(
1449        "{}/api2/questions/{id}/show-community/",
1450        local_var_configuration.base_path,
1451        id = id
1452    );
1453    let mut local_var_req_builder =
1454        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1455
1456    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1457        local_var_req_builder =
1458            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1459    }
1460    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1461        local_var_req_builder = local_var_req_builder
1462            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
1463    };
1464    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
1465        local_var_req_builder =
1466            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
1467    };
1468    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1469        let local_var_key = local_var_apikey.key.clone();
1470        let local_var_value = match local_var_apikey.prefix {
1471            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
1472            None => local_var_key,
1473        };
1474        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1475    };
1476    local_var_req_builder = local_var_req_builder.json(&show_community);
1477
1478    let local_var_req = local_var_req_builder.build()?;
1479    let local_var_resp = local_var_client.execute(local_var_req).await?;
1480
1481    let local_var_status = local_var_resp.status();
1482    let local_var_content = local_var_resp.text().await?;
1483
1484    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1485        serde_json::from_str(&local_var_content).map_err(Error::from)
1486    } else {
1487        let local_var_entity: Option<QuestionsShowCommunityCreateError> =
1488            serde_json::from_str(&local_var_content).ok();
1489        let local_var_error = ResponseContent {
1490            status: local_var_status,
1491            content: local_var_content,
1492            entity: local_var_entity,
1493        };
1494        Err(Error::ResponseError(local_var_error))
1495    }
1496}
1497
1498pub async fn questions_update(
1499    configuration: &configuration::Configuration,
1500    params: QuestionsUpdateParams,
1501) -> Result<crate::models::QuestionUpdate, Error<QuestionsUpdateError>> {
1502    let local_var_configuration = configuration;
1503
1504    // unbox the parameters
1505    let id = params.id;
1506    let question_update = params.question_update;
1507
1508    let local_var_client = &local_var_configuration.client;
1509
1510    let local_var_uri_str = format!(
1511        "{}/api2/questions/{id}/",
1512        local_var_configuration.base_path,
1513        id = id
1514    );
1515    let mut local_var_req_builder =
1516        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1517
1518    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1519        local_var_req_builder =
1520            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1521    }
1522    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1523        local_var_req_builder = local_var_req_builder
1524            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
1525    };
1526    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
1527        local_var_req_builder =
1528            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
1529    };
1530    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1531        let local_var_key = local_var_apikey.key.clone();
1532        let local_var_value = match local_var_apikey.prefix {
1533            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
1534            None => local_var_key,
1535        };
1536        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1537    };
1538    local_var_req_builder = local_var_req_builder.json(&question_update);
1539
1540    let local_var_req = local_var_req_builder.build()?;
1541    let local_var_resp = local_var_client.execute(local_var_req).await?;
1542
1543    let local_var_status = local_var_resp.status();
1544    let local_var_content = local_var_resp.text().await?;
1545
1546    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1547        serde_json::from_str(&local_var_content).map_err(Error::from)
1548    } else {
1549        let local_var_entity: Option<QuestionsUpdateError> =
1550            serde_json::from_str(&local_var_content).ok();
1551        let local_var_error = ResponseContent {
1552            status: local_var_status,
1553            content: local_var_content,
1554            entity: local_var_entity,
1555        };
1556        Err(Error::ResponseError(local_var_error))
1557    }
1558}
1559
1560pub async fn questions_vote_create(
1561    configuration: &configuration::Configuration,
1562    params: QuestionsVoteCreateParams,
1563) -> Result<crate::models::QuestionVote, Error<QuestionsVoteCreateError>> {
1564    let local_var_configuration = configuration;
1565
1566    // unbox the parameters
1567    let id = params.id;
1568    let question_vote = params.question_vote;
1569
1570    let local_var_client = &local_var_configuration.client;
1571
1572    let local_var_uri_str = format!(
1573        "{}/api2/questions/{id}/vote/",
1574        local_var_configuration.base_path,
1575        id = id
1576    );
1577    let mut local_var_req_builder =
1578        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1579
1580    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1581        local_var_req_builder =
1582            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1583    }
1584    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1585        local_var_req_builder = local_var_req_builder
1586            .basic_auth(local_var_auth_conf.0.clone(), local_var_auth_conf.1.clone());
1587    };
1588    if let Some(ref local_var_cookie) = local_var_configuration.cookie {
1589        local_var_req_builder =
1590            local_var_req_builder.header("Cookie", format!("sessionid={}", local_var_cookie.value));
1591    };
1592    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
1593        let local_var_key = local_var_apikey.key.clone();
1594        let local_var_value = match local_var_apikey.prefix {
1595            Some(ref local_var_prefix) => format!("{local_var_prefix} {local_var_key}"),
1596            None => local_var_key,
1597        };
1598        local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
1599    };
1600    local_var_req_builder = local_var_req_builder.json(&question_vote);
1601
1602    let local_var_req = local_var_req_builder.build()?;
1603    let local_var_resp = local_var_client.execute(local_var_req).await?;
1604
1605    let local_var_status = local_var_resp.status();
1606    let local_var_content = local_var_resp.text().await?;
1607
1608    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1609        serde_json::from_str(&local_var_content).map_err(Error::from)
1610    } else {
1611        let local_var_entity: Option<QuestionsVoteCreateError> =
1612            serde_json::from_str(&local_var_content).ok();
1613        let local_var_error = ResponseContent {
1614            status: local_var_status,
1615            content: local_var_content,
1616            entity: local_var_entity,
1617        };
1618        Err(Error::ResponseError(local_var_error))
1619    }
1620}