github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/rust/src/apis/repositories_api.rs (about)

     1  /*
     2   * lakeFS API
     3   *
     4   * lakeFS HTTP API
     5   *
     6   * The version of the OpenAPI document: 1.0.0
     7   * Contact: services@treeverse.io
     8   * Generated by: https://openapi-generator.tech
     9   */
    10  
    11  
    12  use reqwest;
    13  
    14  use crate::{apis::ResponseContent, models};
    15  use super::{Error, configuration};
    16  
    17  
    18  /// struct for typed errors of method [`create_repository`]
    19  #[derive(Debug, Clone, Serialize, Deserialize)]
    20  #[serde(untagged)]
    21  pub enum CreateRepositoryError {
    22      Status400(models::Error),
    23      Status401(models::Error),
    24      Status409(models::Error),
    25      Status420(),
    26      DefaultResponse(models::Error),
    27      UnknownValue(serde_json::Value),
    28  }
    29  
    30  /// struct for typed errors of method [`delete_gc_rules`]
    31  #[derive(Debug, Clone, Serialize, Deserialize)]
    32  #[serde(untagged)]
    33  pub enum DeleteGcRulesError {
    34      Status401(models::Error),
    35      Status403(models::Error),
    36      Status404(models::Error),
    37      Status420(),
    38      DefaultResponse(models::Error),
    39      UnknownValue(serde_json::Value),
    40  }
    41  
    42  /// struct for typed errors of method [`delete_repository`]
    43  #[derive(Debug, Clone, Serialize, Deserialize)]
    44  #[serde(untagged)]
    45  pub enum DeleteRepositoryError {
    46      Status401(models::Error),
    47      Status404(models::Error),
    48      Status420(),
    49      DefaultResponse(models::Error),
    50      UnknownValue(serde_json::Value),
    51  }
    52  
    53  /// struct for typed errors of method [`dump_status`]
    54  #[derive(Debug, Clone, Serialize, Deserialize)]
    55  #[serde(untagged)]
    56  pub enum DumpStatusError {
    57      Status400(models::Error),
    58      Status401(models::Error),
    59      Status404(models::Error),
    60      Status420(),
    61      DefaultResponse(models::Error),
    62      UnknownValue(serde_json::Value),
    63  }
    64  
    65  /// struct for typed errors of method [`dump_submit`]
    66  #[derive(Debug, Clone, Serialize, Deserialize)]
    67  #[serde(untagged)]
    68  pub enum DumpSubmitError {
    69      Status400(models::Error),
    70      Status401(models::Error),
    71      Status404(models::Error),
    72      DefaultResponse(models::Error),
    73      UnknownValue(serde_json::Value),
    74  }
    75  
    76  /// struct for typed errors of method [`get_branch_protection_rules`]
    77  #[derive(Debug, Clone, Serialize, Deserialize)]
    78  #[serde(untagged)]
    79  pub enum GetBranchProtectionRulesError {
    80      Status401(models::Error),
    81      Status404(models::Error),
    82      Status420(),
    83      DefaultResponse(models::Error),
    84      UnknownValue(serde_json::Value),
    85  }
    86  
    87  /// struct for typed errors of method [`get_gc_rules`]
    88  #[derive(Debug, Clone, Serialize, Deserialize)]
    89  #[serde(untagged)]
    90  pub enum GetGcRulesError {
    91      Status401(models::Error),
    92      Status404(models::Error),
    93      Status420(),
    94      DefaultResponse(models::Error),
    95      UnknownValue(serde_json::Value),
    96  }
    97  
    98  /// struct for typed errors of method [`get_repository`]
    99  #[derive(Debug, Clone, Serialize, Deserialize)]
   100  #[serde(untagged)]
   101  pub enum GetRepositoryError {
   102      Status401(models::Error),
   103      Status404(models::Error),
   104      Status420(),
   105      DefaultResponse(models::Error),
   106      UnknownValue(serde_json::Value),
   107  }
   108  
   109  /// struct for typed errors of method [`get_repository_metadata`]
   110  #[derive(Debug, Clone, Serialize, Deserialize)]
   111  #[serde(untagged)]
   112  pub enum GetRepositoryMetadataError {
   113      Status401(models::Error),
   114      Status404(models::Error),
   115      Status420(),
   116      DefaultResponse(models::Error),
   117      UnknownValue(serde_json::Value),
   118  }
   119  
   120  /// struct for typed errors of method [`list_repositories`]
   121  #[derive(Debug, Clone, Serialize, Deserialize)]
   122  #[serde(untagged)]
   123  pub enum ListRepositoriesError {
   124      Status401(models::Error),
   125      Status420(),
   126      DefaultResponse(models::Error),
   127      UnknownValue(serde_json::Value),
   128  }
   129  
   130  /// struct for typed errors of method [`restore_status`]
   131  #[derive(Debug, Clone, Serialize, Deserialize)]
   132  #[serde(untagged)]
   133  pub enum RestoreStatusError {
   134      Status400(models::Error),
   135      Status401(models::Error),
   136      Status404(models::Error),
   137      Status420(),
   138      DefaultResponse(models::Error),
   139      UnknownValue(serde_json::Value),
   140  }
   141  
   142  /// struct for typed errors of method [`restore_submit`]
   143  #[derive(Debug, Clone, Serialize, Deserialize)]
   144  #[serde(untagged)]
   145  pub enum RestoreSubmitError {
   146      Status400(models::Error),
   147      Status403(models::Error),
   148      Status401(models::Error),
   149      Status404(models::Error),
   150      DefaultResponse(models::Error),
   151      UnknownValue(serde_json::Value),
   152  }
   153  
   154  /// struct for typed errors of method [`set_branch_protection_rules`]
   155  #[derive(Debug, Clone, Serialize, Deserialize)]
   156  #[serde(untagged)]
   157  pub enum SetBranchProtectionRulesError {
   158      Status400(models::Error),
   159      Status401(models::Error),
   160      Status403(models::Error),
   161      Status404(models::Error),
   162      Status412(models::Error),
   163      Status420(),
   164      DefaultResponse(models::Error),
   165      UnknownValue(serde_json::Value),
   166  }
   167  
   168  /// struct for typed errors of method [`set_gc_rules`]
   169  #[derive(Debug, Clone, Serialize, Deserialize)]
   170  #[serde(untagged)]
   171  pub enum SetGcRulesError {
   172      Status401(models::Error),
   173      Status403(models::Error),
   174      Status404(models::Error),
   175      Status420(),
   176      DefaultResponse(models::Error),
   177      UnknownValue(serde_json::Value),
   178  }
   179  
   180  
   181  pub async fn create_repository(configuration: &configuration::Configuration, repository_creation: models::RepositoryCreation, bare: Option<bool>) -> Result<models::Repository, Error<CreateRepositoryError>> {
   182      let local_var_configuration = configuration;
   183  
   184      let local_var_client = &local_var_configuration.client;
   185  
   186      let local_var_uri_str = format!("{}/repositories", local_var_configuration.base_path);
   187      let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
   188  
   189      if let Some(ref local_var_str) = bare {
   190          local_var_req_builder = local_var_req_builder.query(&[("bare", &local_var_str.to_string())]);
   191      }
   192      if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
   193          local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
   194      }
   195      if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
   196          local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
   197      };
   198      if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
   199          local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
   200      };
   201      local_var_req_builder = local_var_req_builder.json(&repository_creation);
   202  
   203      let local_var_req = local_var_req_builder.build()?;
   204      let local_var_resp = local_var_client.execute(local_var_req).await?;
   205  
   206      let local_var_status = local_var_resp.status();
   207      let local_var_content = local_var_resp.text().await?;
   208  
   209      if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
   210          serde_json::from_str(&local_var_content).map_err(Error::from)
   211      } else {
   212          let local_var_entity: Option<CreateRepositoryError> = serde_json::from_str(&local_var_content).ok();
   213          let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
   214          Err(Error::ResponseError(local_var_error))
   215      }
   216  }
   217  
   218  pub async fn delete_gc_rules(configuration: &configuration::Configuration, repository: &str) -> Result<(), Error<DeleteGcRulesError>> {
   219      let local_var_configuration = configuration;
   220  
   221      let local_var_client = &local_var_configuration.client;
   222  
   223      let local_var_uri_str = format!("{}/repositories/{repository}/settings/gc_rules", local_var_configuration.base_path, repository=crate::apis::urlencode(repository));
   224      let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
   225  
   226      if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
   227          local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
   228      }
   229      if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
   230          local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
   231      };
   232      if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
   233          local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
   234      };
   235  
   236      let local_var_req = local_var_req_builder.build()?;
   237      let local_var_resp = local_var_client.execute(local_var_req).await?;
   238  
   239      let local_var_status = local_var_resp.status();
   240      let local_var_content = local_var_resp.text().await?;
   241  
   242      if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
   243          Ok(())
   244      } else {
   245          let local_var_entity: Option<DeleteGcRulesError> = serde_json::from_str(&local_var_content).ok();
   246          let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
   247          Err(Error::ResponseError(local_var_error))
   248      }
   249  }
   250  
   251  pub async fn delete_repository(configuration: &configuration::Configuration, repository: &str, force: Option<bool>) -> Result<(), Error<DeleteRepositoryError>> {
   252      let local_var_configuration = configuration;
   253  
   254      let local_var_client = &local_var_configuration.client;
   255  
   256      let local_var_uri_str = format!("{}/repositories/{repository}", local_var_configuration.base_path, repository=crate::apis::urlencode(repository));
   257      let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
   258  
   259      if let Some(ref local_var_str) = force {
   260          local_var_req_builder = local_var_req_builder.query(&[("force", &local_var_str.to_string())]);
   261      }
   262      if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
   263          local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
   264      }
   265      if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
   266          local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
   267      };
   268      if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
   269          local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
   270      };
   271  
   272      let local_var_req = local_var_req_builder.build()?;
   273      let local_var_resp = local_var_client.execute(local_var_req).await?;
   274  
   275      let local_var_status = local_var_resp.status();
   276      let local_var_content = local_var_resp.text().await?;
   277  
   278      if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
   279          Ok(())
   280      } else {
   281          let local_var_entity: Option<DeleteRepositoryError> = serde_json::from_str(&local_var_content).ok();
   282          let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
   283          Err(Error::ResponseError(local_var_error))
   284      }
   285  }
   286  
   287  pub async fn dump_status(configuration: &configuration::Configuration, repository: &str, task_id: &str) -> Result<models::RepositoryDumpStatus, Error<DumpStatusError>> {
   288      let local_var_configuration = configuration;
   289  
   290      let local_var_client = &local_var_configuration.client;
   291  
   292      let local_var_uri_str = format!("{}/repositories/{repository}/dump", local_var_configuration.base_path, repository=crate::apis::urlencode(repository));
   293      let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
   294  
   295      local_var_req_builder = local_var_req_builder.query(&[("task_id", &task_id.to_string())]);
   296      if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
   297          local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
   298      }
   299      if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
   300          local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
   301      };
   302      if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
   303          local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
   304      };
   305  
   306      let local_var_req = local_var_req_builder.build()?;
   307      let local_var_resp = local_var_client.execute(local_var_req).await?;
   308  
   309      let local_var_status = local_var_resp.status();
   310      let local_var_content = local_var_resp.text().await?;
   311  
   312      if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
   313          serde_json::from_str(&local_var_content).map_err(Error::from)
   314      } else {
   315          let local_var_entity: Option<DumpStatusError> = serde_json::from_str(&local_var_content).ok();
   316          let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
   317          Err(Error::ResponseError(local_var_error))
   318      }
   319  }
   320  
   321  pub async fn dump_submit(configuration: &configuration::Configuration, repository: &str) -> Result<models::TaskInfo, Error<DumpSubmitError>> {
   322      let local_var_configuration = configuration;
   323  
   324      let local_var_client = &local_var_configuration.client;
   325  
   326      let local_var_uri_str = format!("{}/repositories/{repository}/dump", local_var_configuration.base_path, repository=crate::apis::urlencode(repository));
   327      let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
   328  
   329      if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
   330          local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
   331      }
   332      if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
   333          local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
   334      };
   335      if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
   336          local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
   337      };
   338  
   339      let local_var_req = local_var_req_builder.build()?;
   340      let local_var_resp = local_var_client.execute(local_var_req).await?;
   341  
   342      let local_var_status = local_var_resp.status();
   343      let local_var_content = local_var_resp.text().await?;
   344  
   345      if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
   346          serde_json::from_str(&local_var_content).map_err(Error::from)
   347      } else {
   348          let local_var_entity: Option<DumpSubmitError> = serde_json::from_str(&local_var_content).ok();
   349          let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
   350          Err(Error::ResponseError(local_var_error))
   351      }
   352  }
   353  
   354  pub async fn get_branch_protection_rules(configuration: &configuration::Configuration, repository: &str) -> Result<Vec<models::BranchProtectionRule>, Error<GetBranchProtectionRulesError>> {
   355      let local_var_configuration = configuration;
   356  
   357      let local_var_client = &local_var_configuration.client;
   358  
   359      let local_var_uri_str = format!("{}/repositories/{repository}/settings/branch_protection", local_var_configuration.base_path, repository=crate::apis::urlencode(repository));
   360      let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
   361  
   362      if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
   363          local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
   364      }
   365      if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
   366          local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
   367      };
   368      if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
   369          local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
   370      };
   371  
   372      let local_var_req = local_var_req_builder.build()?;
   373      let local_var_resp = local_var_client.execute(local_var_req).await?;
   374  
   375      let local_var_status = local_var_resp.status();
   376      let local_var_content = local_var_resp.text().await?;
   377  
   378      if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
   379          serde_json::from_str(&local_var_content).map_err(Error::from)
   380      } else {
   381          let local_var_entity: Option<GetBranchProtectionRulesError> = serde_json::from_str(&local_var_content).ok();
   382          let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
   383          Err(Error::ResponseError(local_var_error))
   384      }
   385  }
   386  
   387  pub async fn get_gc_rules(configuration: &configuration::Configuration, repository: &str) -> Result<models::GarbageCollectionRules, Error<GetGcRulesError>> {
   388      let local_var_configuration = configuration;
   389  
   390      let local_var_client = &local_var_configuration.client;
   391  
   392      let local_var_uri_str = format!("{}/repositories/{repository}/settings/gc_rules", local_var_configuration.base_path, repository=crate::apis::urlencode(repository));
   393      let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
   394  
   395      if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
   396          local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
   397      }
   398      if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
   399          local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
   400      };
   401      if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
   402          local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
   403      };
   404  
   405      let local_var_req = local_var_req_builder.build()?;
   406      let local_var_resp = local_var_client.execute(local_var_req).await?;
   407  
   408      let local_var_status = local_var_resp.status();
   409      let local_var_content = local_var_resp.text().await?;
   410  
   411      if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
   412          serde_json::from_str(&local_var_content).map_err(Error::from)
   413      } else {
   414          let local_var_entity: Option<GetGcRulesError> = serde_json::from_str(&local_var_content).ok();
   415          let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
   416          Err(Error::ResponseError(local_var_error))
   417      }
   418  }
   419  
   420  pub async fn get_repository(configuration: &configuration::Configuration, repository: &str) -> Result<models::Repository, Error<GetRepositoryError>> {
   421      let local_var_configuration = configuration;
   422  
   423      let local_var_client = &local_var_configuration.client;
   424  
   425      let local_var_uri_str = format!("{}/repositories/{repository}", local_var_configuration.base_path, repository=crate::apis::urlencode(repository));
   426      let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
   427  
   428      if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
   429          local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
   430      }
   431      if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
   432          local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
   433      };
   434      if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
   435          local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
   436      };
   437  
   438      let local_var_req = local_var_req_builder.build()?;
   439      let local_var_resp = local_var_client.execute(local_var_req).await?;
   440  
   441      let local_var_status = local_var_resp.status();
   442      let local_var_content = local_var_resp.text().await?;
   443  
   444      if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
   445          serde_json::from_str(&local_var_content).map_err(Error::from)
   446      } else {
   447          let local_var_entity: Option<GetRepositoryError> = serde_json::from_str(&local_var_content).ok();
   448          let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
   449          Err(Error::ResponseError(local_var_error))
   450      }
   451  }
   452  
   453  pub async fn get_repository_metadata(configuration: &configuration::Configuration, repository: &str) -> Result<std::collections::HashMap<String, String>, Error<GetRepositoryMetadataError>> {
   454      let local_var_configuration = configuration;
   455  
   456      let local_var_client = &local_var_configuration.client;
   457  
   458      let local_var_uri_str = format!("{}/repositories/{repository}/metadata", local_var_configuration.base_path, repository=crate::apis::urlencode(repository));
   459      let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, 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 = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
   463      }
   464      if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
   465          local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
   466      };
   467      if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
   468          local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
   469      };
   470  
   471      let local_var_req = local_var_req_builder.build()?;
   472      let local_var_resp = local_var_client.execute(local_var_req).await?;
   473  
   474      let local_var_status = local_var_resp.status();
   475      let local_var_content = local_var_resp.text().await?;
   476  
   477      if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
   478          serde_json::from_str(&local_var_content).map_err(Error::from)
   479      } else {
   480          let local_var_entity: Option<GetRepositoryMetadataError> = serde_json::from_str(&local_var_content).ok();
   481          let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
   482          Err(Error::ResponseError(local_var_error))
   483      }
   484  }
   485  
   486  pub async fn list_repositories(configuration: &configuration::Configuration, prefix: Option<&str>, after: Option<&str>, amount: Option<i32>) -> Result<models::RepositoryList, Error<ListRepositoriesError>> {
   487      let local_var_configuration = configuration;
   488  
   489      let local_var_client = &local_var_configuration.client;
   490  
   491      let local_var_uri_str = format!("{}/repositories", local_var_configuration.base_path);
   492      let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
   493  
   494      if let Some(ref local_var_str) = prefix {
   495          local_var_req_builder = local_var_req_builder.query(&[("prefix", &local_var_str.to_string())]);
   496      }
   497      if let Some(ref local_var_str) = after {
   498          local_var_req_builder = local_var_req_builder.query(&[("after", &local_var_str.to_string())]);
   499      }
   500      if let Some(ref local_var_str) = amount {
   501          local_var_req_builder = local_var_req_builder.query(&[("amount", &local_var_str.to_string())]);
   502      }
   503      if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
   504          local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
   505      }
   506      if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
   507          local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
   508      };
   509      if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
   510          local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
   511      };
   512  
   513      let local_var_req = local_var_req_builder.build()?;
   514      let local_var_resp = local_var_client.execute(local_var_req).await?;
   515  
   516      let local_var_status = local_var_resp.status();
   517      let local_var_content = local_var_resp.text().await?;
   518  
   519      if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
   520          serde_json::from_str(&local_var_content).map_err(Error::from)
   521      } else {
   522          let local_var_entity: Option<ListRepositoriesError> = serde_json::from_str(&local_var_content).ok();
   523          let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
   524          Err(Error::ResponseError(local_var_error))
   525      }
   526  }
   527  
   528  pub async fn restore_status(configuration: &configuration::Configuration, repository: &str, task_id: &str) -> Result<models::RepositoryRestoreStatus, Error<RestoreStatusError>> {
   529      let local_var_configuration = configuration;
   530  
   531      let local_var_client = &local_var_configuration.client;
   532  
   533      let local_var_uri_str = format!("{}/repositories/{repository}/restore", local_var_configuration.base_path, repository=crate::apis::urlencode(repository));
   534      let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
   535  
   536      local_var_req_builder = local_var_req_builder.query(&[("task_id", &task_id.to_string())]);
   537      if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
   538          local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
   539      }
   540      if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
   541          local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
   542      };
   543      if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
   544          local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
   545      };
   546  
   547      let local_var_req = local_var_req_builder.build()?;
   548      let local_var_resp = local_var_client.execute(local_var_req).await?;
   549  
   550      let local_var_status = local_var_resp.status();
   551      let local_var_content = local_var_resp.text().await?;
   552  
   553      if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
   554          serde_json::from_str(&local_var_content).map_err(Error::from)
   555      } else {
   556          let local_var_entity: Option<RestoreStatusError> = serde_json::from_str(&local_var_content).ok();
   557          let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
   558          Err(Error::ResponseError(local_var_error))
   559      }
   560  }
   561  
   562  pub async fn restore_submit(configuration: &configuration::Configuration, repository: &str, refs_restore: models::RefsRestore) -> Result<models::TaskInfo, Error<RestoreSubmitError>> {
   563      let local_var_configuration = configuration;
   564  
   565      let local_var_client = &local_var_configuration.client;
   566  
   567      let local_var_uri_str = format!("{}/repositories/{repository}/restore", local_var_configuration.base_path, repository=crate::apis::urlencode(repository));
   568      let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
   569  
   570      if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
   571          local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
   572      }
   573      if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
   574          local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
   575      };
   576      if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
   577          local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
   578      };
   579      local_var_req_builder = local_var_req_builder.json(&refs_restore);
   580  
   581      let local_var_req = local_var_req_builder.build()?;
   582      let local_var_resp = local_var_client.execute(local_var_req).await?;
   583  
   584      let local_var_status = local_var_resp.status();
   585      let local_var_content = local_var_resp.text().await?;
   586  
   587      if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
   588          serde_json::from_str(&local_var_content).map_err(Error::from)
   589      } else {
   590          let local_var_entity: Option<RestoreSubmitError> = serde_json::from_str(&local_var_content).ok();
   591          let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
   592          Err(Error::ResponseError(local_var_error))
   593      }
   594  }
   595  
   596  pub async fn set_branch_protection_rules(configuration: &configuration::Configuration, repository: &str, branch_protection_rule: Vec<models::BranchProtectionRule>, if_match: Option<&str>) -> Result<(), Error<SetBranchProtectionRulesError>> {
   597      let local_var_configuration = configuration;
   598  
   599      let local_var_client = &local_var_configuration.client;
   600  
   601      let local_var_uri_str = format!("{}/repositories/{repository}/settings/branch_protection", local_var_configuration.base_path, repository=crate::apis::urlencode(repository));
   602      let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
   603  
   604      if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
   605          local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
   606      }
   607      if let Some(local_var_param_value) = if_match {
   608          local_var_req_builder = local_var_req_builder.header("If-Match", local_var_param_value.to_string());
   609      }
   610      if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
   611          local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
   612      };
   613      if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
   614          local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
   615      };
   616      local_var_req_builder = local_var_req_builder.json(&branch_protection_rule);
   617  
   618      let local_var_req = local_var_req_builder.build()?;
   619      let local_var_resp = local_var_client.execute(local_var_req).await?;
   620  
   621      let local_var_status = local_var_resp.status();
   622      let local_var_content = local_var_resp.text().await?;
   623  
   624      if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
   625          Ok(())
   626      } else {
   627          let local_var_entity: Option<SetBranchProtectionRulesError> = serde_json::from_str(&local_var_content).ok();
   628          let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
   629          Err(Error::ResponseError(local_var_error))
   630      }
   631  }
   632  
   633  pub async fn set_gc_rules(configuration: &configuration::Configuration, repository: &str, garbage_collection_rules: models::GarbageCollectionRules) -> Result<(), Error<SetGcRulesError>> {
   634      let local_var_configuration = configuration;
   635  
   636      let local_var_client = &local_var_configuration.client;
   637  
   638      let local_var_uri_str = format!("{}/repositories/{repository}/settings/gc_rules", local_var_configuration.base_path, repository=crate::apis::urlencode(repository));
   639      let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
   640  
   641      if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
   642          local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
   643      }
   644      if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
   645          local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
   646      };
   647      if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
   648          local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
   649      };
   650      local_var_req_builder = local_var_req_builder.json(&garbage_collection_rules);
   651  
   652      let local_var_req = local_var_req_builder.build()?;
   653      let local_var_resp = local_var_client.execute(local_var_req).await?;
   654  
   655      let local_var_status = local_var_resp.status();
   656      let local_var_content = local_var_resp.text().await?;
   657  
   658      if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
   659          Ok(())
   660      } else {
   661          let local_var_entity: Option<SetGcRulesError> = serde_json::from_str(&local_var_content).ok();
   662          let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
   663          Err(Error::ResponseError(local_var_error))
   664      }
   665  }
   666