#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(clippy::redundant_clone)]
pub mod models;
#[derive(Clone)]
pub struct Client {
endpoint: String,
credential: crate::Credential,
scopes: Vec<String>,
pipeline: azure_core::Pipeline,
}
#[derive(Clone)]
pub struct ClientBuilder {
credential: crate::Credential,
endpoint: Option<String>,
scopes: Option<Vec<String>>,
options: azure_core::ClientOptions,
}
pub const DEFAULT_ENDPOINT: &str = "https://dev.azure.com";
impl ClientBuilder {
#[doc = "Create a new instance of `ClientBuilder`."]
#[must_use]
pub fn new(credential: crate::Credential) -> Self {
Self {
credential,
endpoint: None,
scopes: None,
options: azure_core::ClientOptions::default(),
}
}
#[doc = "Set the endpoint."]
#[must_use]
pub fn endpoint(mut self, endpoint: impl Into<String>) -> Self {
self.endpoint = Some(endpoint.into());
self
}
#[doc = "Set the scopes."]
#[must_use]
pub fn scopes(mut self, scopes: &[&str]) -> Self {
self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect());
self
}
#[doc = "Set the retry options."]
#[must_use]
pub fn retry(mut self, retry: impl Into<azure_core::RetryOptions>) -> Self {
self.options = self.options.retry(retry);
self
}
#[doc = "Set the transport options."]
#[must_use]
pub fn transport(mut self, transport: impl Into<azure_core::TransportOptions>) -> Self {
self.options = self.options.transport(transport);
self
}
#[doc = "Set per-call policies."]
#[must_use]
pub fn per_call_policies(
mut self,
policies: impl Into<Vec<std::sync::Arc<dyn azure_core::Policy>>>,
) -> Self {
self.options = self.options.per_call_policies(policies);
self
}
#[doc = "Convert the builder into a `Client` instance."]
#[must_use]
pub fn build(self) -> Client {
let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned());
let scopes = self
.scopes
.unwrap_or_else(|| vec![crate::ADO_SCOPE.to_string()]);
Client::new(endpoint, self.credential, scopes, self.options)
}
}
impl Client {
pub(crate) fn endpoint(&self) -> &str {
self.endpoint.as_str()
}
pub(crate) fn token_credential(&self) -> &crate::Credential {
&self.credential
}
#[allow(dead_code)]
pub(crate) fn scopes(&self) -> Vec<&str> {
self.scopes.iter().map(String::as_str).collect()
}
pub(crate) async fn send(
&self,
request: &mut azure_core::Request,
) -> azure_core::Result<azure_core::Response> {
let mut context = azure_core::Context::default();
self.pipeline.send(&mut context, request).await
}
#[doc = "Create a new `ClientBuilder`."]
#[must_use]
pub fn builder(credential: crate::Credential) -> ClientBuilder {
ClientBuilder::new(credential)
}
#[doc = "Create a new `Client`."]
#[must_use]
pub fn new(
endpoint: impl Into<String>,
credential: crate::Credential,
scopes: Vec<String>,
options: azure_core::ClientOptions,
) -> Self {
let endpoint = endpoint.into();
let pipeline = azure_core::Pipeline::new(
option_env!("CARGO_PKG_NAME"),
option_env!("CARGO_PKG_VERSION"),
options,
Vec::new(),
Vec::new(),
);
Self {
endpoint,
credential,
scopes,
pipeline,
}
}
pub fn annotated_tags_client(&self) -> annotated_tags::Client {
annotated_tags::Client(self.clone())
}
pub fn blobs_client(&self) -> blobs::Client {
blobs::Client(self.clone())
}
pub fn cherry_picks_client(&self) -> cherry_picks::Client {
cherry_picks::Client(self.clone())
}
pub fn commits_client(&self) -> commits::Client {
commits::Client(self.clone())
}
pub fn diffs_client(&self) -> diffs::Client {
diffs::Client(self.clone())
}
pub fn forks_client(&self) -> forks::Client {
forks::Client(self.clone())
}
pub fn import_requests_client(&self) -> import_requests::Client {
import_requests::Client(self.clone())
}
pub fn items_client(&self) -> items::Client {
items::Client(self.clone())
}
pub fn merge_bases_client(&self) -> merge_bases::Client {
merge_bases::Client(self.clone())
}
pub fn merges_client(&self) -> merges::Client {
merges::Client(self.clone())
}
pub fn policy_configurations_client(&self) -> policy_configurations::Client {
policy_configurations::Client(self.clone())
}
pub fn pull_request_attachments_client(&self) -> pull_request_attachments::Client {
pull_request_attachments::Client(self.clone())
}
pub fn pull_request_comment_likes_client(&self) -> pull_request_comment_likes::Client {
pull_request_comment_likes::Client(self.clone())
}
pub fn pull_request_commits_client(&self) -> pull_request_commits::Client {
pull_request_commits::Client(self.clone())
}
pub fn pull_request_iteration_changes_client(&self) -> pull_request_iteration_changes::Client {
pull_request_iteration_changes::Client(self.clone())
}
pub fn pull_request_iteration_statuses_client(
&self,
) -> pull_request_iteration_statuses::Client {
pull_request_iteration_statuses::Client(self.clone())
}
pub fn pull_request_iterations_client(&self) -> pull_request_iterations::Client {
pull_request_iterations::Client(self.clone())
}
pub fn pull_request_labels_client(&self) -> pull_request_labels::Client {
pull_request_labels::Client(self.clone())
}
pub fn pull_request_properties_client(&self) -> pull_request_properties::Client {
pull_request_properties::Client(self.clone())
}
pub fn pull_request_query_client(&self) -> pull_request_query::Client {
pull_request_query::Client(self.clone())
}
pub fn pull_request_reviewers_client(&self) -> pull_request_reviewers::Client {
pull_request_reviewers::Client(self.clone())
}
pub fn pull_request_share_client(&self) -> pull_request_share::Client {
pull_request_share::Client(self.clone())
}
pub fn pull_request_statuses_client(&self) -> pull_request_statuses::Client {
pull_request_statuses::Client(self.clone())
}
pub fn pull_request_thread_comments_client(&self) -> pull_request_thread_comments::Client {
pull_request_thread_comments::Client(self.clone())
}
pub fn pull_request_threads_client(&self) -> pull_request_threads::Client {
pull_request_threads::Client(self.clone())
}
pub fn pull_request_work_items_client(&self) -> pull_request_work_items::Client {
pull_request_work_items::Client(self.clone())
}
pub fn pull_requests_client(&self) -> pull_requests::Client {
pull_requests::Client(self.clone())
}
pub fn pushes_client(&self) -> pushes::Client {
pushes::Client(self.clone())
}
pub fn refs_client(&self) -> refs::Client {
refs::Client(self.clone())
}
pub fn refs_favorites_client(&self) -> refs_favorites::Client {
refs_favorites::Client(self.clone())
}
pub fn repositories_client(&self) -> repositories::Client {
repositories::Client(self.clone())
}
pub fn reverts_client(&self) -> reverts::Client {
reverts::Client(self.clone())
}
pub fn stats_client(&self) -> stats::Client {
stats::Client(self.clone())
}
pub fn statuses_client(&self) -> statuses::Client {
statuses::Client(self.clone())
}
pub fn suggestions_client(&self) -> suggestions::Client {
suggestions::Client(self.clone())
}
pub fn trees_client(&self) -> trees::Client {
trees::Client(self.clone())
}
}
pub mod repositories {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve a git repository."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `include_parent`: Set to true to include parent repository. Only available in authenticated calls."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_repository_with_parent(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
include_parent: bool,
project: impl Into<String>,
) -> get_repository_with_parent::RequestBuilder {
get_repository_with_parent::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
include_parent,
project: project.into(),
}
}
#[doc = "Retrieve deleted git repositories."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_deleted_repositories(
&self,
organization: impl Into<String>,
project: impl Into<String>,
) -> get_deleted_repositories::RequestBuilder {
get_deleted_repositories::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
}
}
#[doc = "Retrieve soft-deleted git repositories from the recycle bin."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_recycle_bin_repositories(
&self,
organization: impl Into<String>,
project: impl Into<String>,
) -> get_recycle_bin_repositories::RequestBuilder {
get_recycle_bin_repositories::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
}
}
#[doc = "Recover a soft-deleted Git repository. Recently deleted repositories go into a soft-delete state for a period of time before they are hard deleted and become unrecoverable."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `repository_id`: The ID of the repository."]
pub fn restore_repository_from_recycle_bin(
&self,
organization: impl Into<String>,
body: impl Into<models::GitRecycleBinRepositoryDetails>,
project: impl Into<String>,
repository_id: impl Into<String>,
) -> restore_repository_from_recycle_bin::RequestBuilder {
restore_repository_from_recycle_bin::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
repository_id: repository_id.into(),
}
}
#[doc = "Destroy (hard delete) a soft-deleted Git repository."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `repository_id`: The ID of the repository."]
pub fn delete_repository_from_recycle_bin(
&self,
organization: impl Into<String>,
project: impl Into<String>,
repository_id: impl Into<String>,
) -> delete_repository_from_recycle_bin::RequestBuilder {
delete_repository_from_recycle_bin::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
repository_id: repository_id.into(),
}
}
#[doc = "Retrieve git repositories."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
include_links: None,
include_all_urls: None,
include_hidden: None,
}
}
#[doc = "Create a git repository in a team project."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Specify the repo name, team project and/or parent repository. Team project information can be omitted from gitRepositoryToCreate if the request is project-scoped (i.e., includes project Id)."]
#[doc = "* `project`: Project ID or project name"]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::GitRepositoryCreateOptions>,
project: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
source_ref: None,
}
}
#[doc = "Retrieve a git repository."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_repository(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> get_repository::RequestBuilder {
get_repository::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
project: project.into(),
}
}
#[doc = "Updates the Git repository with either a new repo name or a new default branch."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Specify a new repo name or a new default branch of the repository"]
#[doc = "* `repository_id`: The ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn update(
&self,
organization: impl Into<String>,
body: impl Into<models::GitRepository>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
project: project.into(),
}
}
#[doc = "Delete a git repository"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn delete(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
project: project.into(),
}
}
}
pub mod get_repository_with_parent {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRepository> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRepository = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) include_parent: bool,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}?includeParent={}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.include_parent
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let include_parent = &this.include_parent;
req.url_mut()
.query_pairs_mut()
.append_pair("includeParent", &include_parent.to_string());
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRepository>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitRepository>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_deleted_repositories {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitDeletedRepositoryList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitDeletedRepositoryList = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/deletedrepositories",
this.client.endpoint(),
&this.organization,
&this.project
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitDeletedRepositoryList>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitDeletedRepositoryList>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_recycle_bin_repositories {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitDeletedRepositoryList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitDeletedRepositoryList = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/recycleBin/repositories",
this.client.endpoint(),
&this.organization,
&this.project
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitDeletedRepositoryList>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitDeletedRepositoryList>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod restore_repository_from_recycle_bin {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRepository> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRepository = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitRecycleBinRepositoryDetails,
pub(crate) project: String,
pub(crate) repository_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/recycleBin/repositories/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRepository>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitRepository>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_repository_from_recycle_bin {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) repository_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/recycleBin/repositories/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRepositoryList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRepositoryList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) include_links: Option<bool>,
pub(crate) include_all_urls: Option<bool>,
pub(crate) include_hidden: Option<bool>,
}
impl RequestBuilder {
#[doc = "(optional) Set to true to include reference links. The default value is false."]
pub fn include_links(mut self, include_links: bool) -> Self {
self.include_links = Some(include_links);
self
}
#[doc = "(optional) Set to true to include all remote URLs. The default value is false."]
pub fn include_all_urls(mut self, include_all_urls: bool) -> Self {
self.include_all_urls = Some(include_all_urls);
self
}
#[doc = "(optional) Set to true to include hidden repositories. The default value is false."]
pub fn include_hidden(mut self, include_hidden: bool) -> Self {
self.include_hidden = Some(include_hidden);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories",
this.client.endpoint(),
&this.organization,
&this.project
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(include_links) = &this.include_links {
req.url_mut()
.query_pairs_mut()
.append_pair("includeLinks", &include_links.to_string());
}
if let Some(include_all_urls) = &this.include_all_urls {
req.url_mut()
.query_pairs_mut()
.append_pair("includeAllUrls", &include_all_urls.to_string());
}
if let Some(include_hidden) = &this.include_hidden {
req.url_mut()
.query_pairs_mut()
.append_pair("includeHidden", &include_hidden.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRepositoryList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitRepositoryList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRepository> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRepository = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitRepositoryCreateOptions,
pub(crate) project: String,
pub(crate) source_ref: Option<String>,
}
impl RequestBuilder {
#[doc = "\\[optional\\] Specify the source refs to use while creating a fork repo"]
pub fn source_ref(mut self, source_ref: impl Into<String>) -> Self {
self.source_ref = Some(source_ref.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories",
this.client.endpoint(),
&this.organization,
&this.project
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
if let Some(source_ref) = &this.source_ref {
req.url_mut()
.query_pairs_mut()
.append_pair("sourceRef", source_ref);
}
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRepository>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitRepository>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_repository {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRepository> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRepository = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRepository>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitRepository>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRepository> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRepository = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitRepository,
pub(crate) repository_id: String,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRepository>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitRepository>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
}
pub mod commits {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve git commits for a project\n\nParameters that use the searchCriteria prefix in their name can be specified without it as query parameters, e.g. searchCriteria.$top -> $top"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The id or friendly name of the repository. To use the friendly name, projectId must also be specified."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_commits(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> get_commits::RequestBuilder {
get_commits::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
project: project.into(),
search_criteria_skip: None,
search_criteria_top: None,
search_criteria_author: None,
search_criteria_compare_version_version: None,
search_criteria_compare_version_version_options: None,
search_criteria_compare_version_version_type: None,
search_criteria_exclude_deletes: None,
search_criteria_from_commit_id: None,
search_criteria_from_date: None,
search_criteria_history_mode: None,
search_criteria_ids: Vec::new(),
search_criteria_include_links: None,
search_criteria_include_push_data: None,
search_criteria_include_user_image_url: None,
search_criteria_include_work_items: None,
search_criteria_item_path: None,
search_criteria_item_version_version: None,
search_criteria_item_version_version_options: None,
search_criteria_item_version_version_type: None,
search_criteria_show_oldest_commits_first: None,
search_criteria_to_commit_id: None,
search_criteria_to_date: None,
search_criteria_user: None,
}
}
#[doc = "Retrieve a list of commits associated with a particular push."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The id or friendly name of the repository. To use the friendly name, projectId must also be specified."]
#[doc = "* `push_id`: The id of the push."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_push_commits(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
push_id: i32,
project: impl Into<String>,
) -> get_push_commits::RequestBuilder {
get_push_commits::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
push_id,
project: project.into(),
top: None,
skip: None,
include_links: None,
}
}
#[doc = "Retrieve a particular commit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `commit_id`: The id of the commit."]
#[doc = "* `repository_id`: The id or friendly name of the repository. To use the friendly name, projectId must also be specified."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
commit_id: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
commit_id: commit_id.into(),
repository_id: repository_id.into(),
project: project.into(),
change_count: None,
}
}
#[doc = "Retrieve changes for a particular commit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `commit_id`: The id of the commit."]
#[doc = "* `repository_id`: The id or friendly name of the repository. To use the friendly name, projectId must also be specified."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_changes(
&self,
organization: impl Into<String>,
commit_id: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> get_changes::RequestBuilder {
get_changes::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
commit_id: commit_id.into(),
repository_id: repository_id.into(),
project: project.into(),
top: None,
skip: None,
}
}
#[doc = "Retrieve git commits for a project matching the search criteria"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Search options"]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_commits_batch(
&self,
organization: impl Into<String>,
body: impl Into<models::GitQueryCommitsCriteria>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> get_commits_batch::RequestBuilder {
get_commits_batch::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
project: project.into(),
skip: None,
top: None,
include_statuses: None,
}
}
}
pub mod get_commits {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitCommitRefList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitCommitRefList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) search_criteria_skip: Option<i32>,
pub(crate) search_criteria_top: Option<i32>,
pub(crate) search_criteria_author: Option<String>,
pub(crate) search_criteria_compare_version_version: Option<String>,
pub(crate) search_criteria_compare_version_version_options: Option<String>,
pub(crate) search_criteria_compare_version_version_type: Option<String>,
pub(crate) search_criteria_exclude_deletes: Option<bool>,
pub(crate) search_criteria_from_commit_id: Option<String>,
pub(crate) search_criteria_from_date: Option<String>,
pub(crate) search_criteria_history_mode: Option<String>,
pub(crate) search_criteria_ids: Vec<String>,
pub(crate) search_criteria_include_links: Option<bool>,
pub(crate) search_criteria_include_push_data: Option<bool>,
pub(crate) search_criteria_include_user_image_url: Option<bool>,
pub(crate) search_criteria_include_work_items: Option<bool>,
pub(crate) search_criteria_item_path: Option<String>,
pub(crate) search_criteria_item_version_version: Option<String>,
pub(crate) search_criteria_item_version_version_options: Option<String>,
pub(crate) search_criteria_item_version_version_type: Option<String>,
pub(crate) search_criteria_show_oldest_commits_first: Option<bool>,
pub(crate) search_criteria_to_commit_id: Option<String>,
pub(crate) search_criteria_to_date: Option<String>,
pub(crate) search_criteria_user: Option<String>,
}
impl RequestBuilder {
#[doc = "Number of entries to skip"]
pub fn search_criteria_skip(mut self, search_criteria_skip: i32) -> Self {
self.search_criteria_skip = Some(search_criteria_skip);
self
}
#[doc = "Maximum number of entries to retrieve"]
pub fn search_criteria_top(mut self, search_criteria_top: i32) -> Self {
self.search_criteria_top = Some(search_criteria_top);
self
}
#[doc = "Alias or display name of the author"]
pub fn search_criteria_author(
mut self,
search_criteria_author: impl Into<String>,
) -> Self {
self.search_criteria_author = Some(search_criteria_author.into());
self
}
#[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
pub fn search_criteria_compare_version_version(
mut self,
search_criteria_compare_version_version: impl Into<String>,
) -> Self {
self.search_criteria_compare_version_version =
Some(search_criteria_compare_version_version.into());
self
}
#[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
pub fn search_criteria_compare_version_version_options(
mut self,
search_criteria_compare_version_version_options: impl Into<String>,
) -> Self {
self.search_criteria_compare_version_version_options =
Some(search_criteria_compare_version_version_options.into());
self
}
#[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
pub fn search_criteria_compare_version_version_type(
mut self,
search_criteria_compare_version_version_type: impl Into<String>,
) -> Self {
self.search_criteria_compare_version_version_type =
Some(search_criteria_compare_version_version_type.into());
self
}
#[doc = "Only applies when an itemPath is specified. This determines whether to exclude delete entries of the specified path."]
pub fn search_criteria_exclude_deletes(
mut self,
search_criteria_exclude_deletes: bool,
) -> Self {
self.search_criteria_exclude_deletes = Some(search_criteria_exclude_deletes);
self
}
#[doc = "If provided, a lower bound for filtering commits alphabetically"]
pub fn search_criteria_from_commit_id(
mut self,
search_criteria_from_commit_id: impl Into<String>,
) -> Self {
self.search_criteria_from_commit_id = Some(search_criteria_from_commit_id.into());
self
}
#[doc = "If provided, only include history entries created after this date (string)"]
pub fn search_criteria_from_date(
mut self,
search_criteria_from_date: impl Into<String>,
) -> Self {
self.search_criteria_from_date = Some(search_criteria_from_date.into());
self
}
#[doc = "What Git history mode should be used. This only applies to the search criteria when Ids = null and an itemPath is specified."]
pub fn search_criteria_history_mode(
mut self,
search_criteria_history_mode: impl Into<String>,
) -> Self {
self.search_criteria_history_mode = Some(search_criteria_history_mode.into());
self
}
#[doc = "If provided, specifies the exact commit ids of the commits to fetch. May not be combined with other parameters."]
pub fn search_criteria_ids(mut self, search_criteria_ids: Vec<String>) -> Self {
self.search_criteria_ids = search_criteria_ids;
self
}
#[doc = "Whether to include the _links field on the shallow references"]
pub fn search_criteria_include_links(
mut self,
search_criteria_include_links: bool,
) -> Self {
self.search_criteria_include_links = Some(search_criteria_include_links);
self
}
#[doc = "Whether to include the push information"]
pub fn search_criteria_include_push_data(
mut self,
search_criteria_include_push_data: bool,
) -> Self {
self.search_criteria_include_push_data = Some(search_criteria_include_push_data);
self
}
#[doc = "Whether to include the image Url for committers and authors"]
pub fn search_criteria_include_user_image_url(
mut self,
search_criteria_include_user_image_url: bool,
) -> Self {
self.search_criteria_include_user_image_url =
Some(search_criteria_include_user_image_url);
self
}
#[doc = "Whether to include linked work items"]
pub fn search_criteria_include_work_items(
mut self,
search_criteria_include_work_items: bool,
) -> Self {
self.search_criteria_include_work_items = Some(search_criteria_include_work_items);
self
}
#[doc = "Path of item to search under"]
pub fn search_criteria_item_path(
mut self,
search_criteria_item_path: impl Into<String>,
) -> Self {
self.search_criteria_item_path = Some(search_criteria_item_path.into());
self
}
#[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
pub fn search_criteria_item_version_version(
mut self,
search_criteria_item_version_version: impl Into<String>,
) -> Self {
self.search_criteria_item_version_version =
Some(search_criteria_item_version_version.into());
self
}
#[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
pub fn search_criteria_item_version_version_options(
mut self,
search_criteria_item_version_version_options: impl Into<String>,
) -> Self {
self.search_criteria_item_version_version_options =
Some(search_criteria_item_version_version_options.into());
self
}
#[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
pub fn search_criteria_item_version_version_type(
mut self,
search_criteria_item_version_version_type: impl Into<String>,
) -> Self {
self.search_criteria_item_version_version_type =
Some(search_criteria_item_version_version_type.into());
self
}
#[doc = "If enabled, this option will ignore the itemVersion and compareVersion parameters"]
pub fn search_criteria_show_oldest_commits_first(
mut self,
search_criteria_show_oldest_commits_first: bool,
) -> Self {
self.search_criteria_show_oldest_commits_first =
Some(search_criteria_show_oldest_commits_first);
self
}
#[doc = "If provided, an upper bound for filtering commits alphabetically"]
pub fn search_criteria_to_commit_id(
mut self,
search_criteria_to_commit_id: impl Into<String>,
) -> Self {
self.search_criteria_to_commit_id = Some(search_criteria_to_commit_id.into());
self
}
#[doc = "If provided, only include history entries created before this date (string)"]
pub fn search_criteria_to_date(
mut self,
search_criteria_to_date: impl Into<String>,
) -> Self {
self.search_criteria_to_date = Some(search_criteria_to_date.into());
self
}
#[doc = "Alias or display name of the committer"]
pub fn search_criteria_user(mut self, search_criteria_user: impl Into<String>) -> Self {
self.search_criteria_user = Some(search_criteria_user.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/commits?",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(search_criteria_skip) = &this.search_criteria_skip {
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.$skip",
&search_criteria_skip.to_string(),
);
}
if let Some(search_criteria_top) = &this.search_criteria_top {
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.$top",
&search_criteria_top.to_string(),
);
}
if let Some(search_criteria_author) = &this.search_criteria_author {
req.url_mut()
.query_pairs_mut()
.append_pair("searchCriteria.author", search_criteria_author);
}
if let Some(search_criteria_compare_version_version) =
&this.search_criteria_compare_version_version
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.compareVersion.version",
search_criteria_compare_version_version,
);
}
if let Some(search_criteria_compare_version_version_options) =
&this.search_criteria_compare_version_version_options
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.compareVersion.versionOptions",
search_criteria_compare_version_version_options,
);
}
if let Some(search_criteria_compare_version_version_type) =
&this.search_criteria_compare_version_version_type
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.compareVersion.versionType",
search_criteria_compare_version_version_type,
);
}
if let Some(search_criteria_exclude_deletes) =
&this.search_criteria_exclude_deletes
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.excludeDeletes",
&search_criteria_exclude_deletes.to_string(),
);
}
if let Some(search_criteria_from_commit_id) =
&this.search_criteria_from_commit_id
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.fromCommitId",
search_criteria_from_commit_id,
);
}
if let Some(search_criteria_from_date) = &this.search_criteria_from_date {
req.url_mut()
.query_pairs_mut()
.append_pair("searchCriteria.fromDate", search_criteria_from_date);
}
if let Some(search_criteria_history_mode) =
&this.search_criteria_history_mode
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.historyMode",
search_criteria_history_mode,
);
}
if let Some(search_criteria_include_links) =
&this.search_criteria_include_links
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.includeLinks",
&search_criteria_include_links.to_string(),
);
}
if let Some(search_criteria_include_push_data) =
&this.search_criteria_include_push_data
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.includePushData",
&search_criteria_include_push_data.to_string(),
);
}
if let Some(search_criteria_include_user_image_url) =
&this.search_criteria_include_user_image_url
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.includeUserImageUrl",
&search_criteria_include_user_image_url.to_string(),
);
}
if let Some(search_criteria_include_work_items) =
&this.search_criteria_include_work_items
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.includeWorkItems",
&search_criteria_include_work_items.to_string(),
);
}
if let Some(search_criteria_item_path) = &this.search_criteria_item_path {
req.url_mut()
.query_pairs_mut()
.append_pair("searchCriteria.itemPath", search_criteria_item_path);
}
if let Some(search_criteria_item_version_version) =
&this.search_criteria_item_version_version
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.itemVersion.version",
search_criteria_item_version_version,
);
}
if let Some(search_criteria_item_version_version_options) =
&this.search_criteria_item_version_version_options
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.itemVersion.versionOptions",
search_criteria_item_version_version_options,
);
}
if let Some(search_criteria_item_version_version_type) =
&this.search_criteria_item_version_version_type
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.itemVersion.versionType",
search_criteria_item_version_version_type,
);
}
if let Some(search_criteria_show_oldest_commits_first) =
&this.search_criteria_show_oldest_commits_first
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.showOldestCommitsFirst",
&search_criteria_show_oldest_commits_first.to_string(),
);
}
if let Some(search_criteria_to_commit_id) =
&this.search_criteria_to_commit_id
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.toCommitId",
search_criteria_to_commit_id,
);
}
if let Some(search_criteria_to_date) = &this.search_criteria_to_date {
req.url_mut()
.query_pairs_mut()
.append_pair("searchCriteria.toDate", search_criteria_to_date);
}
if let Some(search_criteria_user) = &this.search_criteria_user {
req.url_mut()
.query_pairs_mut()
.append_pair("searchCriteria.user", search_criteria_user);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitCommitRefList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitCommitRefList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_push_commits {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitCommitRefList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitCommitRefList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) push_id: i32,
pub(crate) project: String,
pub(crate) top: Option<i32>,
pub(crate) skip: Option<i32>,
pub(crate) include_links: Option<bool>,
}
impl RequestBuilder {
#[doc = "The maximum number of commits to return (\"get the top x commits\")."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "The number of commits to skip."]
pub fn skip(mut self, skip: i32) -> Self {
self.skip = Some(skip);
self
}
#[doc = "Set to false to avoid including REST Url links for resources. Defaults to true."]
pub fn include_links(mut self, include_links: bool) -> Self {
self.include_links = Some(include_links);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/commits",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let push_id = &this.push_id;
req.url_mut()
.query_pairs_mut()
.append_pair("pushId", &push_id.to_string());
if let Some(top) = &this.top {
req.url_mut()
.query_pairs_mut()
.append_pair("top", &top.to_string());
}
if let Some(skip) = &this.skip {
req.url_mut()
.query_pairs_mut()
.append_pair("skip", &skip.to_string());
}
if let Some(include_links) = &this.include_links {
req.url_mut()
.query_pairs_mut()
.append_pair("includeLinks", &include_links.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitCommitRefList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitCommitRefList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitCommit> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitCommit = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) commit_id: String,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) change_count: Option<i32>,
}
impl RequestBuilder {
#[doc = "The number of changes to include in the result."]
pub fn change_count(mut self, change_count: i32) -> Self {
self.change_count = Some(change_count);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/commits/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.commit_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(change_count) = &this.change_count {
req.url_mut()
.query_pairs_mut()
.append_pair("changeCount", &change_count.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitCommit>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitCommit>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_changes {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitCommitChanges> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitCommitChanges =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) commit_id: String,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) top: Option<i32>,
pub(crate) skip: Option<i32>,
}
impl RequestBuilder {
#[doc = "The maximum number of changes to return."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "The number of changes to skip."]
pub fn skip(mut self, skip: i32) -> Self {
self.skip = Some(skip);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/commits/{}/changes",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.commit_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(top) = &this.top {
req.url_mut()
.query_pairs_mut()
.append_pair("top", &top.to_string());
}
if let Some(skip) = &this.skip {
req.url_mut()
.query_pairs_mut()
.append_pair("skip", &skip.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitCommitChanges>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitCommitChanges>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_commits_batch {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitCommitRefList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitCommitRefList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitQueryCommitsCriteria,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) skip: Option<i32>,
pub(crate) top: Option<i32>,
pub(crate) include_statuses: Option<bool>,
}
impl RequestBuilder {
#[doc = "Number of commits to skip."]
pub fn skip(mut self, skip: i32) -> Self {
self.skip = Some(skip);
self
}
#[doc = "Maximum number of commits to return."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "Set to true to include additional commit status information."]
pub fn include_statuses(mut self, include_statuses: bool) -> Self {
self.include_statuses = Some(include_statuses);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/commitsbatch",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
if let Some(skip) = &this.skip {
req.url_mut()
.query_pairs_mut()
.append_pair("$skip", &skip.to_string());
}
if let Some(top) = &this.top {
req.url_mut()
.query_pairs_mut()
.append_pair("$top", &top.to_string());
}
if let Some(include_statuses) = &this.include_statuses {
req.url_mut()
.query_pairs_mut()
.append_pair("includeStatuses", &include_statuses.to_string());
}
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitCommitRefList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitCommitRefList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod items {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `path`: The item path."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
path: impl Into<String>,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
path: path.into(),
project: project.into(),
scope_path: None,
recursion_level: None,
include_content_metadata: None,
latest_processed_change: None,
download: None,
format: None,
version_descriptor_version: None,
version_descriptor_version_options: None,
version_descriptor_version_type: None,
include_content: None,
resolve_lfs: None,
sanitize: None,
}
}
#[doc = "Get Item Metadata and/or Content for a collection of items. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
project: project.into(),
scope_path: None,
recursion_level: None,
include_content_metadata: None,
latest_processed_change: None,
download: None,
include_links: None,
format: None,
version_descriptor_version: None,
version_descriptor_version_options: None,
version_descriptor_version_type: None,
}
}
#[doc = "Post for retrieving a creating a batch out of a set of items in a repo / project given a list of paths or a long path"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Request data attributes: ItemDescriptors, IncludeContentMetadata, LatestProcessedChange, IncludeLinks. ItemDescriptors: Collection of items to fetch, including path, version, and recursion level. IncludeContentMetadata: Whether to include metadata for all items LatestProcessedChange: Whether to include shallow ref to commit that last changed each item. IncludeLinks: Whether to include the _links field on the shallow references."]
#[doc = "* `repository_id`: The name or ID of the repository"]
#[doc = "* `project`: Project ID or project name"]
pub fn get_items_batch(
&self,
organization: impl Into<String>,
body: impl Into<models::GitItemRequestData>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> get_items_batch::RequestBuilder {
get_items_batch::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
project: project.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitItem> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitItem = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) path: String,
pub(crate) project: String,
pub(crate) scope_path: Option<String>,
pub(crate) recursion_level: Option<String>,
pub(crate) include_content_metadata: Option<bool>,
pub(crate) latest_processed_change: Option<bool>,
pub(crate) download: Option<bool>,
pub(crate) format: Option<String>,
pub(crate) version_descriptor_version: Option<String>,
pub(crate) version_descriptor_version_options: Option<String>,
pub(crate) version_descriptor_version_type: Option<String>,
pub(crate) include_content: Option<bool>,
pub(crate) resolve_lfs: Option<bool>,
pub(crate) sanitize: Option<bool>,
}
impl RequestBuilder {
#[doc = "The path scope. The default is null."]
pub fn scope_path(mut self, scope_path: impl Into<String>) -> Self {
self.scope_path = Some(scope_path.into());
self
}
#[doc = "The recursion level of this request. The default is 'none', no recursion."]
pub fn recursion_level(mut self, recursion_level: impl Into<String>) -> Self {
self.recursion_level = Some(recursion_level.into());
self
}
#[doc = "Set to true to include content metadata. Default is false."]
pub fn include_content_metadata(mut self, include_content_metadata: bool) -> Self {
self.include_content_metadata = Some(include_content_metadata);
self
}
#[doc = "Set to true to include the latest changes. Default is false."]
pub fn latest_processed_change(mut self, latest_processed_change: bool) -> Self {
self.latest_processed_change = Some(latest_processed_change);
self
}
#[doc = "Set to true to download the response as a file. Default is false."]
pub fn download(mut self, download: bool) -> Self {
self.download = Some(download);
self
}
#[doc = "If specified, this overrides the HTTP Accept request header to return either 'json' or 'zip'. If format is specified, then api-version should also be specified as a query parameter."]
pub fn format(mut self, format: impl Into<String>) -> Self {
self.format = Some(format.into());
self
}
#[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
pub fn version_descriptor_version(
mut self,
version_descriptor_version: impl Into<String>,
) -> Self {
self.version_descriptor_version = Some(version_descriptor_version.into());
self
}
#[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
pub fn version_descriptor_version_options(
mut self,
version_descriptor_version_options: impl Into<String>,
) -> Self {
self.version_descriptor_version_options =
Some(version_descriptor_version_options.into());
self
}
#[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
pub fn version_descriptor_version_type(
mut self,
version_descriptor_version_type: impl Into<String>,
) -> Self {
self.version_descriptor_version_type = Some(version_descriptor_version_type.into());
self
}
#[doc = "Set to true to include item content when requesting json. Default is false."]
pub fn include_content(mut self, include_content: bool) -> Self {
self.include_content = Some(include_content);
self
}
#[doc = "Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false."]
pub fn resolve_lfs(mut self, resolve_lfs: bool) -> Self {
self.resolve_lfs = Some(resolve_lfs);
self
}
#[doc = "Set to true to sanitize an svg file and return it as image. Useful only if requested for svg file. Default is false."]
pub fn sanitize(mut self, sanitize: bool) -> Self {
self.sanitize = Some(sanitize);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/items?path={}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.path
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let path = &this.path;
req.url_mut().query_pairs_mut().append_pair("path", path);
if let Some(scope_path) = &this.scope_path {
req.url_mut()
.query_pairs_mut()
.append_pair("scopePath", scope_path);
}
if let Some(recursion_level) = &this.recursion_level {
req.url_mut()
.query_pairs_mut()
.append_pair("recursionLevel", recursion_level);
}
if let Some(include_content_metadata) = &this.include_content_metadata {
req.url_mut().query_pairs_mut().append_pair(
"includeContentMetadata",
&include_content_metadata.to_string(),
);
}
if let Some(latest_processed_change) = &this.latest_processed_change {
req.url_mut().query_pairs_mut().append_pair(
"latestProcessedChange",
&latest_processed_change.to_string(),
);
}
if let Some(download) = &this.download {
req.url_mut()
.query_pairs_mut()
.append_pair("download", &download.to_string());
}
if let Some(format) = &this.format {
req.url_mut()
.query_pairs_mut()
.append_pair("$format", format);
}
if let Some(version_descriptor_version) = &this.version_descriptor_version {
req.url_mut().query_pairs_mut().append_pair(
"versionDescriptor.version",
version_descriptor_version,
);
}
if let Some(version_descriptor_version_options) =
&this.version_descriptor_version_options
{
req.url_mut().query_pairs_mut().append_pair(
"versionDescriptor.versionOptions",
version_descriptor_version_options,
);
}
if let Some(version_descriptor_version_type) =
&this.version_descriptor_version_type
{
req.url_mut().query_pairs_mut().append_pair(
"versionDescriptor.versionType",
version_descriptor_version_type,
);
}
if let Some(include_content) = &this.include_content {
req.url_mut()
.query_pairs_mut()
.append_pair("includeContent", &include_content.to_string());
}
if let Some(resolve_lfs) = &this.resolve_lfs {
req.url_mut()
.query_pairs_mut()
.append_pair("resolveLfs", &resolve_lfs.to_string());
}
if let Some(sanitize) = &this.sanitize {
req.url_mut()
.query_pairs_mut()
.append_pair("sanitize", &sanitize.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitItem>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitItem>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitItemList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitItemList = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) scope_path: Option<String>,
pub(crate) recursion_level: Option<String>,
pub(crate) include_content_metadata: Option<bool>,
pub(crate) latest_processed_change: Option<bool>,
pub(crate) download: Option<bool>,
pub(crate) include_links: Option<bool>,
pub(crate) format: Option<String>,
pub(crate) version_descriptor_version: Option<String>,
pub(crate) version_descriptor_version_options: Option<String>,
pub(crate) version_descriptor_version_type: Option<String>,
}
impl RequestBuilder {
#[doc = "The path scope. The default is null."]
pub fn scope_path(mut self, scope_path: impl Into<String>) -> Self {
self.scope_path = Some(scope_path.into());
self
}
#[doc = "The recursion level of this request. The default is 'none', no recursion."]
pub fn recursion_level(mut self, recursion_level: impl Into<String>) -> Self {
self.recursion_level = Some(recursion_level.into());
self
}
#[doc = "Set to true to include content metadata. Default is false."]
pub fn include_content_metadata(mut self, include_content_metadata: bool) -> Self {
self.include_content_metadata = Some(include_content_metadata);
self
}
#[doc = "Set to true to include the latest changes. Default is false."]
pub fn latest_processed_change(mut self, latest_processed_change: bool) -> Self {
self.latest_processed_change = Some(latest_processed_change);
self
}
#[doc = "Set to true to download the response as a file. Default is false."]
pub fn download(mut self, download: bool) -> Self {
self.download = Some(download);
self
}
#[doc = "Set to true to include links to items. Default is false."]
pub fn include_links(mut self, include_links: bool) -> Self {
self.include_links = Some(include_links);
self
}
#[doc = "If specified, this overrides the HTTP Accept request header to return either 'json' or 'zip'. If format is specified, then api-version should also be specified as a query parameter."]
pub fn format(mut self, format: impl Into<String>) -> Self {
self.format = Some(format.into());
self
}
#[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
pub fn version_descriptor_version(
mut self,
version_descriptor_version: impl Into<String>,
) -> Self {
self.version_descriptor_version = Some(version_descriptor_version.into());
self
}
#[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
pub fn version_descriptor_version_options(
mut self,
version_descriptor_version_options: impl Into<String>,
) -> Self {
self.version_descriptor_version_options =
Some(version_descriptor_version_options.into());
self
}
#[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
pub fn version_descriptor_version_type(
mut self,
version_descriptor_version_type: impl Into<String>,
) -> Self {
self.version_descriptor_version_type = Some(version_descriptor_version_type.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/items",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(scope_path) = &this.scope_path {
req.url_mut()
.query_pairs_mut()
.append_pair("scopePath", scope_path);
}
if let Some(recursion_level) = &this.recursion_level {
req.url_mut()
.query_pairs_mut()
.append_pair("recursionLevel", recursion_level);
}
if let Some(include_content_metadata) = &this.include_content_metadata {
req.url_mut().query_pairs_mut().append_pair(
"includeContentMetadata",
&include_content_metadata.to_string(),
);
}
if let Some(latest_processed_change) = &this.latest_processed_change {
req.url_mut().query_pairs_mut().append_pair(
"latestProcessedChange",
&latest_processed_change.to_string(),
);
}
if let Some(download) = &this.download {
req.url_mut()
.query_pairs_mut()
.append_pair("download", &download.to_string());
}
if let Some(include_links) = &this.include_links {
req.url_mut()
.query_pairs_mut()
.append_pair("includeLinks", &include_links.to_string());
}
if let Some(format) = &this.format {
req.url_mut()
.query_pairs_mut()
.append_pair("$format", format);
}
if let Some(version_descriptor_version) = &this.version_descriptor_version {
req.url_mut().query_pairs_mut().append_pair(
"versionDescriptor.version",
version_descriptor_version,
);
}
if let Some(version_descriptor_version_options) =
&this.version_descriptor_version_options
{
req.url_mut().query_pairs_mut().append_pair(
"versionDescriptor.versionOptions",
version_descriptor_version_options,
);
}
if let Some(version_descriptor_version_type) =
&this.version_descriptor_version_type
{
req.url_mut().query_pairs_mut().append_pair(
"versionDescriptor.versionType",
version_descriptor_version_type,
);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitItemList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitItemList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_items_batch {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<Vec<String>> {
let bytes = self.0.into_body().collect().await?;
let body: Vec<String> = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitItemRequestData,
pub(crate) repository_id: String,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/itemsbatch",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<Vec<String>>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<Vec<String>>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod stats {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve statistics about a single branch."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `name`: Name of the branch."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
name: impl Into<String>,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
name: name.into(),
project: project.into(),
base_version_descriptor_version: None,
base_version_descriptor_version_options: None,
base_version_descriptor_version_type: None,
}
}
#[doc = "Retrieve statistics about all branches within a repository."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
project: project.into(),
base_version_descriptor_version: None,
base_version_descriptor_version_options: None,
base_version_descriptor_version_type: None,
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitBranchStats> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitBranchStats = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) name: String,
pub(crate) project: String,
pub(crate) base_version_descriptor_version: Option<String>,
pub(crate) base_version_descriptor_version_options: Option<String>,
pub(crate) base_version_descriptor_version_type: Option<String>,
}
impl RequestBuilder {
#[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
pub fn base_version_descriptor_version(
mut self,
base_version_descriptor_version: impl Into<String>,
) -> Self {
self.base_version_descriptor_version = Some(base_version_descriptor_version.into());
self
}
#[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
pub fn base_version_descriptor_version_options(
mut self,
base_version_descriptor_version_options: impl Into<String>,
) -> Self {
self.base_version_descriptor_version_options =
Some(base_version_descriptor_version_options.into());
self
}
#[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
pub fn base_version_descriptor_version_type(
mut self,
base_version_descriptor_version_type: impl Into<String>,
) -> Self {
self.base_version_descriptor_version_type =
Some(base_version_descriptor_version_type.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/stats/branches?name={}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let name = &this.name;
req.url_mut().query_pairs_mut().append_pair("name", name);
if let Some(base_version_descriptor_version) =
&this.base_version_descriptor_version
{
req.url_mut().query_pairs_mut().append_pair(
"baseVersionDescriptor.version",
base_version_descriptor_version,
);
}
if let Some(base_version_descriptor_version_options) =
&this.base_version_descriptor_version_options
{
req.url_mut().query_pairs_mut().append_pair(
"baseVersionDescriptor.versionOptions",
base_version_descriptor_version_options,
);
}
if let Some(base_version_descriptor_version_type) =
&this.base_version_descriptor_version_type
{
req.url_mut().query_pairs_mut().append_pair(
"baseVersionDescriptor.versionType",
base_version_descriptor_version_type,
);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitBranchStats>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitBranchStats>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitBranchStatsList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitBranchStatsList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) base_version_descriptor_version: Option<String>,
pub(crate) base_version_descriptor_version_options: Option<String>,
pub(crate) base_version_descriptor_version_type: Option<String>,
}
impl RequestBuilder {
#[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
pub fn base_version_descriptor_version(
mut self,
base_version_descriptor_version: impl Into<String>,
) -> Self {
self.base_version_descriptor_version = Some(base_version_descriptor_version.into());
self
}
#[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
pub fn base_version_descriptor_version_options(
mut self,
base_version_descriptor_version_options: impl Into<String>,
) -> Self {
self.base_version_descriptor_version_options =
Some(base_version_descriptor_version_options.into());
self
}
#[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
pub fn base_version_descriptor_version_type(
mut self,
base_version_descriptor_version_type: impl Into<String>,
) -> Self {
self.base_version_descriptor_version_type =
Some(base_version_descriptor_version_type.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/stats/branches",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(base_version_descriptor_version) =
&this.base_version_descriptor_version
{
req.url_mut().query_pairs_mut().append_pair(
"baseVersionDescriptor.version",
base_version_descriptor_version,
);
}
if let Some(base_version_descriptor_version_options) =
&this.base_version_descriptor_version_options
{
req.url_mut().query_pairs_mut().append_pair(
"baseVersionDescriptor.versionOptions",
base_version_descriptor_version_options,
);
}
if let Some(base_version_descriptor_version_type) =
&this.base_version_descriptor_version_type
{
req.url_mut().query_pairs_mut().append_pair(
"baseVersionDescriptor.versionType",
base_version_descriptor_version_type,
);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitBranchStatsList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitBranchStatsList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod refs_favorites {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the refs favorites for a repo and an identity."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
repository_id: None,
identity_id: None,
}
}
#[doc = "Creates a ref favorite"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: The ref favorite to create."]
#[doc = "* `project`: Project ID or project name"]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::GitRefFavorite>,
project: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
}
}
#[doc = "Gets the refs favorite for a favorite Id."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `favorite_id`: The Id of the requested ref favorite."]
pub fn get(
&self,
organization: impl Into<String>,
project: impl Into<String>,
favorite_id: i32,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
favorite_id,
}
}
#[doc = "Deletes the refs favorite specified"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `favorite_id`: The Id of the ref favorite to delete."]
pub fn delete(
&self,
organization: impl Into<String>,
project: impl Into<String>,
favorite_id: i32,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
favorite_id,
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRefFavoriteList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRefFavoriteList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) repository_id: Option<String>,
pub(crate) identity_id: Option<String>,
}
impl RequestBuilder {
#[doc = "The id of the repository."]
pub fn repository_id(mut self, repository_id: impl Into<String>) -> Self {
self.repository_id = Some(repository_id.into());
self
}
#[doc = "The id of the identity whose favorites are to be retrieved. If null, the requesting identity is used."]
pub fn identity_id(mut self, identity_id: impl Into<String>) -> Self {
self.identity_id = Some(identity_id.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/favorites/refs",
this.client.endpoint(),
&this.organization,
&this.project
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(repository_id) = &this.repository_id {
req.url_mut()
.query_pairs_mut()
.append_pair("repositoryId", repository_id);
}
if let Some(identity_id) = &this.identity_id {
req.url_mut()
.query_pairs_mut()
.append_pair("identityId", identity_id);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRefFavoriteList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitRefFavoriteList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRefFavorite> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRefFavorite = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitRefFavorite,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/favorites/refs",
this.client.endpoint(),
&this.organization,
&this.project
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRefFavorite>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitRefFavorite>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRefFavorite> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRefFavorite = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) favorite_id: i32,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/favorites/refs/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.favorite_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRefFavorite>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitRefFavorite>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) favorite_id: i32,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/favorites/refs/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.favorite_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
}
pub mod policy_configurations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve a list of policy configurations by a given set of scope/filtering criteria.\n\nBelow is a short description of how all of the query parameters interact with each other:\n- repositoryId set, refName set: returns all policy configurations that *apply* to a particular branch in a repository\n- repositoryId set, refName unset: returns all policy configurations that *apply* to a particular repository\n- repositoryId unset, refName unset: returns all policy configurations that are *defined* at the project level\n- repositoryId unset, refName set: returns all project-level branch policies, plus the project level configurations\nFor all of the examples above, when policyType is set, it'll restrict results to the given policy type"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
repository_id: None,
ref_name: None,
policy_type: None,
top: None,
continuation_token: None,
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PolicyConfigurationList> {
let bytes = self.0.into_body().collect().await?;
let body: models::PolicyConfigurationList = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
pub fn headers(&self) -> Headers {
Headers(self.0.headers())
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
pub struct Headers<'a>(&'a azure_core::headers::Headers);
impl<'a> Headers<'a> {
pub fn x_ms_continuationtoken(&self) -> azure_core::Result<&str> {
self.0
.get_str(&azure_core::headers::HeaderName::from_static(
"x-ms-continuationtoken",
))
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) repository_id: Option<String>,
pub(crate) ref_name: Option<String>,
pub(crate) policy_type: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) continuation_token: Option<String>,
}
impl RequestBuilder {
#[doc = "The repository id."]
pub fn repository_id(mut self, repository_id: impl Into<String>) -> Self {
self.repository_id = Some(repository_id.into());
self
}
#[doc = "The fully-qualified Git ref name (e.g. refs/heads/master)."]
pub fn ref_name(mut self, ref_name: impl Into<String>) -> Self {
self.ref_name = Some(ref_name.into());
self
}
#[doc = "The policy type filter."]
pub fn policy_type(mut self, policy_type: impl Into<String>) -> Self {
self.policy_type = Some(policy_type.into());
self
}
#[doc = "Maximum number of policies to return."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "Pass a policy configuration ID to fetch the next page of results, up to top number of results, for this endpoint."]
pub fn continuation_token(mut self, continuation_token: impl Into<String>) -> Self {
self.continuation_token = Some(continuation_token.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/policy/configurations",
this.client.endpoint(),
&this.organization,
&this.project
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(repository_id) = &this.repository_id {
req.url_mut()
.query_pairs_mut()
.append_pair("repositoryId", repository_id);
}
if let Some(ref_name) = &this.ref_name {
req.url_mut()
.query_pairs_mut()
.append_pair("refName", ref_name);
}
if let Some(policy_type) = &this.policy_type {
req.url_mut()
.query_pairs_mut()
.append_pair("policyType", policy_type);
}
if let Some(top) = &this.top {
req.url_mut()
.query_pairs_mut()
.append_pair("$top", &top.to_string());
}
if let Some(continuation_token) = &this.continuation_token {
req.url_mut()
.query_pairs_mut()
.append_pair("continuationToken", continuation_token);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::PolicyConfigurationList>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::PolicyConfigurationList>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod pull_requests {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve all pull requests matching a specified criteria.\n\nPlease note that description field will be truncated up to 400 symbols in the result."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_pull_requests_by_project(
&self,
organization: impl Into<String>,
project: impl Into<String>,
) -> get_pull_requests_by_project::RequestBuilder {
get_pull_requests_by_project::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
search_criteria_creator_id: None,
search_criteria_include_links: None,
search_criteria_repository_id: None,
search_criteria_reviewer_id: None,
search_criteria_source_ref_name: None,
search_criteria_source_repository_id: None,
search_criteria_status: None,
search_criteria_target_ref_name: None,
max_comment_length: None,
skip: None,
top: None,
}
}
#[doc = "Retrieve a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `pull_request_id`: The ID of the pull request to retrieve."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_pull_request_by_id(
&self,
organization: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> get_pull_request_by_id::RequestBuilder {
get_pull_request_by_id::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
pull_request_id,
project: project.into(),
}
}
#[doc = "Retrieve all pull requests matching a specified criteria.\n\nPlease note that description field will be truncated up to 400 symbols in the result."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_pull_requests(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> get_pull_requests::RequestBuilder {
get_pull_requests::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
project: project.into(),
search_criteria_creator_id: None,
search_criteria_include_links: None,
search_criteria_repository_id: None,
search_criteria_reviewer_id: None,
search_criteria_source_ref_name: None,
search_criteria_source_repository_id: None,
search_criteria_status: None,
search_criteria_target_ref_name: None,
max_comment_length: None,
skip: None,
top: None,
}
}
#[doc = "Create a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `create_options`: The pull request to create."]
pub fn create(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
create_options: impl Into<models::GitPullRequestCreateOptions>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
project: project.into(),
create_options: create_options.into(),
supports_iterations: None,
}
}
#[doc = "Retrieve a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: The ID of the pull request to retrieve."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_pull_request(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> get_pull_request::RequestBuilder {
get_pull_request::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
max_comment_length: None,
skip: None,
top: None,
include_commits: None,
include_work_item_refs: None,
}
}
#[doc = "Update a pull request\n\nThese are the properties that can be updated with the API:\n - Status\n - Title\n - Description (up to 4000 characters)\n - CompletionOptions\n - MergeOptions\n - AutoCompleteSetBy.Id\n - TargetRefName (when the PR retargeting feature is enabled)\n Attempting to update other properties outside of this list will either cause the server to throw an `InvalidArgumentValueException`,\n or to silently ignore the update."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `pull_request_id`: The ID of the pull request to retrieve."]
#[doc = "* `update_options`: The pull request content to update."]
pub fn update(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
pull_request_id: i32,
update_options: impl Into<models::GitPullRequestUpdateOptions>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
project: project.into(),
pull_request_id,
update_options: update_options.into(),
include_commits: None,
include_work_item_refs: None,
}
}
}
pub mod get_pull_requests_by_project {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPullRequestList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) search_criteria_creator_id: Option<String>,
pub(crate) search_criteria_include_links: Option<bool>,
pub(crate) search_criteria_repository_id: Option<String>,
pub(crate) search_criteria_reviewer_id: Option<String>,
pub(crate) search_criteria_source_ref_name: Option<String>,
pub(crate) search_criteria_source_repository_id: Option<String>,
pub(crate) search_criteria_status: Option<String>,
pub(crate) search_criteria_target_ref_name: Option<String>,
pub(crate) max_comment_length: Option<i32>,
pub(crate) skip: Option<i32>,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "If set, search for pull requests that were created by this identity."]
pub fn search_criteria_creator_id(
mut self,
search_criteria_creator_id: impl Into<String>,
) -> Self {
self.search_criteria_creator_id = Some(search_criteria_creator_id.into());
self
}
#[doc = "Whether to include the _links field on the shallow references"]
pub fn search_criteria_include_links(
mut self,
search_criteria_include_links: bool,
) -> Self {
self.search_criteria_include_links = Some(search_criteria_include_links);
self
}
#[doc = "If set, search for pull requests whose target branch is in this repository."]
pub fn search_criteria_repository_id(
mut self,
search_criteria_repository_id: impl Into<String>,
) -> Self {
self.search_criteria_repository_id = Some(search_criteria_repository_id.into());
self
}
#[doc = "If set, search for pull requests that have this identity as a reviewer."]
pub fn search_criteria_reviewer_id(
mut self,
search_criteria_reviewer_id: impl Into<String>,
) -> Self {
self.search_criteria_reviewer_id = Some(search_criteria_reviewer_id.into());
self
}
#[doc = "If set, search for pull requests from this branch."]
pub fn search_criteria_source_ref_name(
mut self,
search_criteria_source_ref_name: impl Into<String>,
) -> Self {
self.search_criteria_source_ref_name = Some(search_criteria_source_ref_name.into());
self
}
#[doc = "If set, search for pull requests whose source branch is in this repository."]
pub fn search_criteria_source_repository_id(
mut self,
search_criteria_source_repository_id: impl Into<String>,
) -> Self {
self.search_criteria_source_repository_id =
Some(search_criteria_source_repository_id.into());
self
}
#[doc = "If set, search for pull requests that are in this state. Defaults to Active if unset."]
pub fn search_criteria_status(
mut self,
search_criteria_status: impl Into<String>,
) -> Self {
self.search_criteria_status = Some(search_criteria_status.into());
self
}
#[doc = "If set, search for pull requests into this branch."]
pub fn search_criteria_target_ref_name(
mut self,
search_criteria_target_ref_name: impl Into<String>,
) -> Self {
self.search_criteria_target_ref_name = Some(search_criteria_target_ref_name.into());
self
}
#[doc = "Not used."]
pub fn max_comment_length(mut self, max_comment_length: i32) -> Self {
self.max_comment_length = Some(max_comment_length);
self
}
#[doc = "The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100."]
pub fn skip(mut self, skip: i32) -> Self {
self.skip = Some(skip);
self
}
#[doc = "The number of pull requests to retrieve."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/pullrequests",
this.client.endpoint(),
&this.organization,
&this.project
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(search_criteria_creator_id) = &this.search_criteria_creator_id {
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.creatorId",
search_criteria_creator_id,
);
}
if let Some(search_criteria_include_links) =
&this.search_criteria_include_links
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.includeLinks",
&search_criteria_include_links.to_string(),
);
}
if let Some(search_criteria_repository_id) =
&this.search_criteria_repository_id
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.repositoryId",
search_criteria_repository_id,
);
}
if let Some(search_criteria_reviewer_id) = &this.search_criteria_reviewer_id
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.reviewerId",
search_criteria_reviewer_id,
);
}
if let Some(search_criteria_source_ref_name) =
&this.search_criteria_source_ref_name
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.sourceRefName",
search_criteria_source_ref_name,
);
}
if let Some(search_criteria_source_repository_id) =
&this.search_criteria_source_repository_id
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.sourceRepositoryId",
search_criteria_source_repository_id,
);
}
if let Some(search_criteria_status) = &this.search_criteria_status {
req.url_mut()
.query_pairs_mut()
.append_pair("searchCriteria.status", search_criteria_status);
}
if let Some(search_criteria_target_ref_name) =
&this.search_criteria_target_ref_name
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.targetRefName",
search_criteria_target_ref_name,
);
}
if let Some(max_comment_length) = &this.max_comment_length {
req.url_mut()
.query_pairs_mut()
.append_pair("maxCommentLength", &max_comment_length.to_string());
}
if let Some(skip) = &this.skip {
req.url_mut()
.query_pairs_mut()
.append_pair("$skip", &skip.to_string());
}
if let Some(top) = &this.top {
req.url_mut()
.query_pairs_mut()
.append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitPullRequestList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_pull_request_by_id {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPullRequest> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequest = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/pullrequests/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequest>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitPullRequest>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_pull_requests {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPullRequestList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) search_criteria_creator_id: Option<String>,
pub(crate) search_criteria_include_links: Option<bool>,
pub(crate) search_criteria_repository_id: Option<String>,
pub(crate) search_criteria_reviewer_id: Option<String>,
pub(crate) search_criteria_source_ref_name: Option<String>,
pub(crate) search_criteria_source_repository_id: Option<String>,
pub(crate) search_criteria_status: Option<String>,
pub(crate) search_criteria_target_ref_name: Option<String>,
pub(crate) max_comment_length: Option<i32>,
pub(crate) skip: Option<i32>,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "If set, search for pull requests that were created by this identity."]
pub fn search_criteria_creator_id(
mut self,
search_criteria_creator_id: impl Into<String>,
) -> Self {
self.search_criteria_creator_id = Some(search_criteria_creator_id.into());
self
}
#[doc = "Whether to include the _links field on the shallow references"]
pub fn search_criteria_include_links(
mut self,
search_criteria_include_links: bool,
) -> Self {
self.search_criteria_include_links = Some(search_criteria_include_links);
self
}
#[doc = "If set, search for pull requests whose target branch is in this repository."]
pub fn search_criteria_repository_id(
mut self,
search_criteria_repository_id: impl Into<String>,
) -> Self {
self.search_criteria_repository_id = Some(search_criteria_repository_id.into());
self
}
#[doc = "If set, search for pull requests that have this identity as a reviewer."]
pub fn search_criteria_reviewer_id(
mut self,
search_criteria_reviewer_id: impl Into<String>,
) -> Self {
self.search_criteria_reviewer_id = Some(search_criteria_reviewer_id.into());
self
}
#[doc = "If set, search for pull requests from this branch."]
pub fn search_criteria_source_ref_name(
mut self,
search_criteria_source_ref_name: impl Into<String>,
) -> Self {
self.search_criteria_source_ref_name = Some(search_criteria_source_ref_name.into());
self
}
#[doc = "If set, search for pull requests whose source branch is in this repository."]
pub fn search_criteria_source_repository_id(
mut self,
search_criteria_source_repository_id: impl Into<String>,
) -> Self {
self.search_criteria_source_repository_id =
Some(search_criteria_source_repository_id.into());
self
}
#[doc = "If set, search for pull requests that are in this state. Defaults to Active if unset."]
pub fn search_criteria_status(
mut self,
search_criteria_status: impl Into<String>,
) -> Self {
self.search_criteria_status = Some(search_criteria_status.into());
self
}
#[doc = "If set, search for pull requests into this branch."]
pub fn search_criteria_target_ref_name(
mut self,
search_criteria_target_ref_name: impl Into<String>,
) -> Self {
self.search_criteria_target_ref_name = Some(search_criteria_target_ref_name.into());
self
}
#[doc = "Not used."]
pub fn max_comment_length(mut self, max_comment_length: i32) -> Self {
self.max_comment_length = Some(max_comment_length);
self
}
#[doc = "The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100."]
pub fn skip(mut self, skip: i32) -> Self {
self.skip = Some(skip);
self
}
#[doc = "The number of pull requests to retrieve."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullrequests",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(search_criteria_creator_id) = &this.search_criteria_creator_id {
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.creatorId",
search_criteria_creator_id,
);
}
if let Some(search_criteria_include_links) =
&this.search_criteria_include_links
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.includeLinks",
&search_criteria_include_links.to_string(),
);
}
if let Some(search_criteria_repository_id) =
&this.search_criteria_repository_id
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.repositoryId",
search_criteria_repository_id,
);
}
if let Some(search_criteria_reviewer_id) = &this.search_criteria_reviewer_id
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.reviewerId",
search_criteria_reviewer_id,
);
}
if let Some(search_criteria_source_ref_name) =
&this.search_criteria_source_ref_name
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.sourceRefName",
search_criteria_source_ref_name,
);
}
if let Some(search_criteria_source_repository_id) =
&this.search_criteria_source_repository_id
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.sourceRepositoryId",
search_criteria_source_repository_id,
);
}
if let Some(search_criteria_status) = &this.search_criteria_status {
req.url_mut()
.query_pairs_mut()
.append_pair("searchCriteria.status", search_criteria_status);
}
if let Some(search_criteria_target_ref_name) =
&this.search_criteria_target_ref_name
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.targetRefName",
search_criteria_target_ref_name,
);
}
if let Some(max_comment_length) = &this.max_comment_length {
req.url_mut()
.query_pairs_mut()
.append_pair("maxCommentLength", &max_comment_length.to_string());
}
if let Some(skip) = &this.skip {
req.url_mut()
.query_pairs_mut()
.append_pair("$skip", &skip.to_string());
}
if let Some(top) = &this.top {
req.url_mut()
.query_pairs_mut()
.append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitPullRequestList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPullRequest> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequest = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) create_options: models::GitPullRequestCreateOptions,
pub(crate) supports_iterations: Option<bool>,
}
impl RequestBuilder {
#[doc = "If true, subsequent pushes to the pull request will be individually reviewable. Set this to false for large pull requests for performance reasons if this functionality is not needed."]
pub fn supports_iterations(mut self, supports_iterations: bool) -> Self {
self.supports_iterations = Some(supports_iterations);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullrequests",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.create_options)?;
if let Some(supports_iterations) = &this.supports_iterations {
req.url_mut().query_pairs_mut().append_pair(
"supportsIterations",
&supports_iterations.to_string(),
);
}
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequest>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitPullRequest>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_pull_request {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPullRequest> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequest = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
pub(crate) max_comment_length: Option<i32>,
pub(crate) skip: Option<i32>,
pub(crate) top: Option<i32>,
pub(crate) include_commits: Option<bool>,
pub(crate) include_work_item_refs: Option<bool>,
}
impl RequestBuilder {
#[doc = "Not used."]
pub fn max_comment_length(mut self, max_comment_length: i32) -> Self {
self.max_comment_length = Some(max_comment_length);
self
}
#[doc = "Not used."]
pub fn skip(mut self, skip: i32) -> Self {
self.skip = Some(skip);
self
}
#[doc = "Not used."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "If true, the pull request will be returned with the associated commits."]
pub fn include_commits(mut self, include_commits: bool) -> Self {
self.include_commits = Some(include_commits);
self
}
#[doc = "If true, the pull request will be returned with the associated work item references."]
pub fn include_work_item_refs(mut self, include_work_item_refs: bool) -> Self {
self.include_work_item_refs = Some(include_work_item_refs);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullrequests/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(max_comment_length) = &this.max_comment_length {
req.url_mut()
.query_pairs_mut()
.append_pair("maxCommentLength", &max_comment_length.to_string());
}
if let Some(skip) = &this.skip {
req.url_mut()
.query_pairs_mut()
.append_pair("$skip", &skip.to_string());
}
if let Some(top) = &this.top {
req.url_mut()
.query_pairs_mut()
.append_pair("$top", &top.to_string());
}
if let Some(include_commits) = &this.include_commits {
req.url_mut()
.query_pairs_mut()
.append_pair("includeCommits", &include_commits.to_string());
}
if let Some(include_work_item_refs) = &this.include_work_item_refs {
req.url_mut().query_pairs_mut().append_pair(
"includeWorkItemRefs",
&include_work_item_refs.to_string(),
);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequest>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitPullRequest>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPullRequest> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequest = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) pull_request_id: i32,
pub(crate) update_options: models::GitPullRequestUpdateOptions,
pub(crate) include_commits: Option<bool>,
pub(crate) include_work_item_refs: Option<bool>,
}
impl RequestBuilder {
#[doc = "If true, the pull request will be returned with the associated commits."]
pub fn include_commits(mut self, include_commits: bool) -> Self {
self.include_commits = Some(include_commits);
self
}
#[doc = "If true, the pull request will be returned with the associated work item references."]
pub fn include_work_item_refs(mut self, include_work_item_refs: bool) -> Self {
self.include_work_item_refs = Some(include_work_item_refs);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullrequests/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(include_commits) = &this.include_commits {
req.url_mut()
.query_pairs_mut()
.append_pair("includeCommits", &include_commits.to_string());
}
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.update_options)?;
if let Some(include_work_item_refs) = &this.include_work_item_refs {
req.url_mut().query_pairs_mut().append_pair(
"includeWorkItemRefs",
&include_work_item_refs.to_string(),
);
}
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequest>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitPullRequest>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod annotated_tags {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Create an annotated tag.\n\nRepositories have both a name and an identifier. Identifiers are globally unique, but several projects\nmay contain a repository of the same name. You don't need to include the project if you specify a\nrepository by ID. However, if you specify a repository by name, you must also specify the project (by name or ID)."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Object containing details of tag to be created."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `repository_id`: ID or name of the repository."]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::GitAnnotatedTag>,
project: impl Into<String>,
repository_id: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
repository_id: repository_id.into(),
}
}
#[doc = "Get an annotated tag.\n\nRepositories have both a name and an identifier. Identifiers are globally unique, but several projects\nmay contain a repository of the same name. You don't need to include the project if you specify a\nrepository by ID. However, if you specify a repository by name, you must also specify the project (by name or ID)."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `repository_id`: ID or name of the repository."]
#[doc = "* `object_id`: ObjectId (Sha1Id) of tag to get."]
pub fn get(
&self,
organization: impl Into<String>,
project: impl Into<String>,
repository_id: impl Into<String>,
object_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
repository_id: repository_id.into(),
object_id: object_id.into(),
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitAnnotatedTag> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitAnnotatedTag =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitAnnotatedTag,
pub(crate) project: String,
pub(crate) repository_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/annotatedtags",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitAnnotatedTag>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitAnnotatedTag>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitAnnotatedTag> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitAnnotatedTag =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) repository_id: String,
pub(crate) object_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/annotatedtags/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.object_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitAnnotatedTag>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitAnnotatedTag>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod blobs {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets one or more blobs in a zip file download."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Blob IDs (SHA1 hashes) to be returned in the zip file."]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_blobs_zip(
&self,
organization: impl Into<String>,
body: Vec<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> get_blobs_zip::RequestBuilder {
get_blobs_zip::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body,
repository_id: repository_id.into(),
project: project.into(),
filename: None,
}
}
#[doc = "Get a single blob.\n\nRepositories have both a name and an identifier. Identifiers are globally unique,\nbut several projects may contain a repository of the same name. You don't need to include\nthe project if you specify a repository by ID. However, if you specify a repository by name,\nyou must also specify the project (by name or ID)."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `sha1`: SHA1 hash of the file. You can get the SHA1 of a file using the \"Git/Items/Get Item\" endpoint."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_blob(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
sha1: impl Into<String>,
project: impl Into<String>,
) -> get_blob::RequestBuilder {
get_blob::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
sha1: sha1.into(),
project: project.into(),
download: None,
file_name: None,
format: None,
resolve_lfs: None,
}
}
}
pub mod get_blobs_zip {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<String> {
let bytes = self.0.into_body().collect().await?;
let body: String = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: Vec<String>,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) filename: Option<String>,
}
impl RequestBuilder {
pub fn filename(mut self, filename: impl Into<String>) -> Self {
self.filename = Some(filename.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/blobs",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
if let Some(filename) = &this.filename {
req.url_mut()
.query_pairs_mut()
.append_pair("filename", filename);
}
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<String>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<String>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_blob {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitBlobRef> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitBlobRef = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) sha1: String,
pub(crate) project: String,
pub(crate) download: Option<bool>,
pub(crate) file_name: Option<String>,
pub(crate) format: Option<String>,
pub(crate) resolve_lfs: Option<bool>,
}
impl RequestBuilder {
#[doc = "If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if format is zip"]
pub fn download(mut self, download: bool) -> Self {
self.download = Some(download);
self
}
#[doc = "Provide a filename to use for a download."]
pub fn file_name(mut self, file_name: impl Into<String>) -> Self {
self.file_name = Some(file_name.into());
self
}
#[doc = "Options: json, zip, text, octetstream. If not set, defaults to the MIME type set in the Accept header."]
pub fn format(mut self, format: impl Into<String>) -> Self {
self.format = Some(format.into());
self
}
#[doc = "If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or format types"]
pub fn resolve_lfs(mut self, resolve_lfs: bool) -> Self {
self.resolve_lfs = Some(resolve_lfs);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/blobs/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.sha1
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(download) = &this.download {
req.url_mut()
.query_pairs_mut()
.append_pair("download", &download.to_string());
}
if let Some(file_name) = &this.file_name {
req.url_mut()
.query_pairs_mut()
.append_pair("fileName", file_name);
}
if let Some(format) = &this.format {
req.url_mut()
.query_pairs_mut()
.append_pair("$format", format);
}
if let Some(resolve_lfs) = &this.resolve_lfs {
req.url_mut()
.query_pairs_mut()
.append_pair("resolveLfs", &resolve_lfs.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitBlobRef>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitBlobRef>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod cherry_picks {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve information about a cherry pick operation for a specific branch. This operation is expensive due to the underlying object structure, so this API only looks at the 1000 most recent cherry pick operations."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `repository_id`: ID of the repository."]
#[doc = "* `ref_name`: The GitAsyncRefOperationParameters generatedRefName used for the cherry pick operation."]
pub fn get_cherry_pick_for_ref_name(
&self,
organization: impl Into<String>,
project: impl Into<String>,
repository_id: impl Into<String>,
ref_name: impl Into<String>,
) -> get_cherry_pick_for_ref_name::RequestBuilder {
get_cherry_pick_for_ref_name::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
repository_id: repository_id.into(),
ref_name: ref_name.into(),
}
}
#[doc = "Cherry pick a specific commit or commits that are associated to a pull request into a new branch."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `repository_id`: ID of the repository."]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::GitAsyncRefOperationParameters>,
project: impl Into<String>,
repository_id: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
repository_id: repository_id.into(),
}
}
#[doc = "Retrieve information about a cherry pick operation by cherry pick Id."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `cherry_pick_id`: ID of the cherry pick."]
#[doc = "* `repository_id`: ID of the repository."]
pub fn get_cherry_pick(
&self,
organization: impl Into<String>,
project: impl Into<String>,
cherry_pick_id: i32,
repository_id: impl Into<String>,
) -> get_cherry_pick::RequestBuilder {
get_cherry_pick::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
cherry_pick_id,
repository_id: repository_id.into(),
}
}
}
pub mod get_cherry_pick_for_ref_name {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitCherryPick> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitCherryPick = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) repository_id: String,
pub(crate) ref_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/cherryPicks",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let ref_name = &this.ref_name;
req.url_mut()
.query_pairs_mut()
.append_pair("refName", ref_name);
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitCherryPick>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitCherryPick>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitCherryPick> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitCherryPick = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitAsyncRefOperationParameters,
pub(crate) project: String,
pub(crate) repository_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/cherryPicks",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitCherryPick>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitCherryPick>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_cherry_pick {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitCherryPick> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitCherryPick = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) cherry_pick_id: i32,
pub(crate) repository_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/cherryPicks/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.cherry_pick_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitCherryPick>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitCherryPick>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod statuses {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get statuses associated with the Git commit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `commit_id`: ID of the Git commit."]
#[doc = "* `repository_id`: ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
commit_id: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
commit_id: commit_id.into(),
repository_id: repository_id.into(),
project: project.into(),
top: None,
skip: None,
latest_only: None,
}
}
#[doc = "Create Git commit status."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Git commit status object to create."]
#[doc = "* `commit_id`: ID of the Git commit."]
#[doc = "* `repository_id`: ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::GitStatus>,
commit_id: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
commit_id: commit_id.into(),
repository_id: repository_id.into(),
project: project.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitStatusList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitStatusList = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) commit_id: String,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) top: Option<i32>,
pub(crate) skip: Option<i32>,
pub(crate) latest_only: Option<bool>,
}
impl RequestBuilder {
#[doc = "Optional. The number of statuses to retrieve. Default is 1000."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "Optional. The number of statuses to ignore. Default is 0. For example, to retrieve results 101-150, set top to 50 and skip to 100."]
pub fn skip(mut self, skip: i32) -> Self {
self.skip = Some(skip);
self
}
#[doc = "The flag indicates whether to get only latest statuses grouped by `Context.Name` and `Context.Genre`."]
pub fn latest_only(mut self, latest_only: bool) -> Self {
self.latest_only = Some(latest_only);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/commits/{}/statuses",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.commit_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(top) = &this.top {
req.url_mut()
.query_pairs_mut()
.append_pair("top", &top.to_string());
}
if let Some(skip) = &this.skip {
req.url_mut()
.query_pairs_mut()
.append_pair("skip", &skip.to_string());
}
if let Some(latest_only) = &this.latest_only {
req.url_mut()
.query_pairs_mut()
.append_pair("latestOnly", &latest_only.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitStatusList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitStatusList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitStatus> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitStatus = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitStatus,
pub(crate) commit_id: String,
pub(crate) repository_id: String,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/commits/{}/statuses",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.commit_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitStatus>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitStatus>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod diffs {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Find the closest common commit (the merge base) between base and target commits, and get the diff between either the base and target commits or common and target commits."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
project: project.into(),
diff_common_commit: None,
top: None,
skip: None,
base_version: None,
base_version_options: None,
base_version_type: None,
target_version: None,
target_version_options: None,
target_version_type: None,
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitCommitDiffs> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitCommitDiffs = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) diff_common_commit: Option<bool>,
pub(crate) top: Option<i32>,
pub(crate) skip: Option<i32>,
pub(crate) base_version: Option<String>,
pub(crate) base_version_options: Option<String>,
pub(crate) base_version_type: Option<String>,
pub(crate) target_version: Option<String>,
pub(crate) target_version_options: Option<String>,
pub(crate) target_version_type: Option<String>,
}
impl RequestBuilder {
#[doc = "If true, diff between common and target commits. If false, diff between base and target commits."]
pub fn diff_common_commit(mut self, diff_common_commit: bool) -> Self {
self.diff_common_commit = Some(diff_common_commit);
self
}
#[doc = "Maximum number of changes to return. Defaults to 100."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "Number of changes to skip"]
pub fn skip(mut self, skip: i32) -> Self {
self.skip = Some(skip);
self
}
#[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
pub fn base_version(mut self, base_version: impl Into<String>) -> Self {
self.base_version = Some(base_version.into());
self
}
#[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
pub fn base_version_options(mut self, base_version_options: impl Into<String>) -> Self {
self.base_version_options = Some(base_version_options.into());
self
}
#[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
pub fn base_version_type(mut self, base_version_type: impl Into<String>) -> Self {
self.base_version_type = Some(base_version_type.into());
self
}
#[doc = "Version string identifier (name of tag/branch, SHA1 of commit)"]
pub fn target_version(mut self, target_version: impl Into<String>) -> Self {
self.target_version = Some(target_version.into());
self
}
#[doc = "Version options - Specify additional modifiers to version (e.g Previous)"]
pub fn target_version_options(
mut self,
target_version_options: impl Into<String>,
) -> Self {
self.target_version_options = Some(target_version_options.into());
self
}
#[doc = "Version type (branch, tag, or commit). Determines how Id is interpreted"]
pub fn target_version_type(mut self, target_version_type: impl Into<String>) -> Self {
self.target_version_type = Some(target_version_type.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/diffs/commits",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(diff_common_commit) = &this.diff_common_commit {
req.url_mut()
.query_pairs_mut()
.append_pair("diffCommonCommit", &diff_common_commit.to_string());
}
if let Some(top) = &this.top {
req.url_mut()
.query_pairs_mut()
.append_pair("$top", &top.to_string());
}
if let Some(skip) = &this.skip {
req.url_mut()
.query_pairs_mut()
.append_pair("$skip", &skip.to_string());
}
if let Some(base_version) = &this.base_version {
req.url_mut()
.query_pairs_mut()
.append_pair("baseVersion", base_version);
}
if let Some(base_version_options) = &this.base_version_options {
req.url_mut()
.query_pairs_mut()
.append_pair("baseVersionOptions", base_version_options);
}
if let Some(base_version_type) = &this.base_version_type {
req.url_mut()
.query_pairs_mut()
.append_pair("baseVersionType", base_version_type);
}
if let Some(target_version) = &this.target_version {
req.url_mut()
.query_pairs_mut()
.append_pair("targetVersion", target_version);
}
if let Some(target_version_options) = &this.target_version_options {
req.url_mut()
.query_pairs_mut()
.append_pair("targetVersionOptions", target_version_options);
}
if let Some(target_version_type) = &this.target_version_type {
req.url_mut()
.query_pairs_mut()
.append_pair("targetVersionType", target_version_type);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitCommitDiffs>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitCommitDiffs>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod import_requests {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve import requests for a repository."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `repository_id`: The name or ID of the repository."]
pub fn query(
&self,
organization: impl Into<String>,
project: impl Into<String>,
repository_id: impl Into<String>,
) -> query::RequestBuilder {
query::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
repository_id: repository_id.into(),
include_abandoned: None,
}
}
#[doc = "Create an import request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: The import request to create."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `repository_id`: The name or ID of the repository."]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::GitImportRequest>,
project: impl Into<String>,
repository_id: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
repository_id: repository_id.into(),
}
}
#[doc = "Retrieve a particular import request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `import_request_id`: The unique identifier for the import request."]
pub fn get(
&self,
organization: impl Into<String>,
project: impl Into<String>,
repository_id: impl Into<String>,
import_request_id: i32,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
repository_id: repository_id.into(),
import_request_id,
}
}
#[doc = "Retry or abandon a failed import request.\n\nThere can only be one active import request associated with a repository. Marking a failed import request abandoned makes it inactive."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: The updated version of the import request. Currently, the only change allowed is setting the Status to Queued or Abandoned."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `import_request_id`: The unique identifier for the import request to update."]
pub fn update(
&self,
organization: impl Into<String>,
body: impl Into<models::GitImportRequest>,
project: impl Into<String>,
repository_id: impl Into<String>,
import_request_id: i32,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
repository_id: repository_id.into(),
import_request_id,
}
}
}
pub mod query {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitImportRequestList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitImportRequestList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) repository_id: String,
pub(crate) include_abandoned: Option<bool>,
}
impl RequestBuilder {
#[doc = "Set to true to include abandoned import requests in the results."]
pub fn include_abandoned(mut self, include_abandoned: bool) -> Self {
self.include_abandoned = Some(include_abandoned);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/importRequests",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(include_abandoned) = &this.include_abandoned {
req.url_mut()
.query_pairs_mut()
.append_pair("includeAbandoned", &include_abandoned.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitImportRequestList>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitImportRequestList>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitImportRequest> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitImportRequest =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitImportRequest,
pub(crate) project: String,
pub(crate) repository_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/importRequests",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitImportRequest>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitImportRequest>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitImportRequest> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitImportRequest =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) repository_id: String,
pub(crate) import_request_id: i32,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/importRequests/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.import_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitImportRequest>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitImportRequest>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitImportRequest> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitImportRequest =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitImportRequest,
pub(crate) project: String,
pub(crate) repository_id: String,
pub(crate) import_request_id: i32,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/importRequests/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.import_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitImportRequest>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitImportRequest>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod pull_request_query {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "This API is used to find what pull requests are related to a given commit. It can be used to either find the pull request that created a particular merge commit or it can be used to find all pull requests that have ever merged a particular commit. The input is a list of queries which each contain a list of commits. For each commit that you search against, you will get back a dictionary of commit -> pull requests."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: The list of queries to perform."]
#[doc = "* `repository_id`: ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
body: impl Into<models::GitPullRequestQuery>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
project: project.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPullRequestQuery> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestQuery =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitPullRequestQuery,
pub(crate) repository_id: String,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullrequestquery",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestQuery>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitPullRequestQuery>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod pull_request_attachments {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get a list of files attached to a given pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
#[doc = "Get the file content of a pull request attachment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `file_name`: The name of the attachment."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
file_name: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
file_name: file_name.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
#[doc = "Attach a new file to a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Stream to upload"]
#[doc = "* `file_name`: The name of the file."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<String>,
file_name: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
file_name: file_name.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
#[doc = "Delete a pull request attachment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `file_name`: The name of the attachment to delete."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn delete(
&self,
organization: impl Into<String>,
file_name: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
file_name: file_name.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::AttachmentList> {
let bytes = self.0.into_body().collect().await?;
let body: models::AttachmentList = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/attachments",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::AttachmentList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::AttachmentList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<String> {
let bytes = self.0.into_body().collect().await?;
let body: String = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) file_name: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/attachments/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id,
&this.file_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<String>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<String>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Attachment> {
let bytes = self.0.into_body().collect().await?;
let body: models::Attachment = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: String,
pub(crate) file_name: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/attachments/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id,
&this.file_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/octet-stream");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Attachment>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::Attachment>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) file_name: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/attachments/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id,
&this.file_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
}
pub mod pull_request_commits {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get the commits for the specified pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: ID or name of the repository."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_pull_request_commits(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> get_pull_request_commits::RequestBuilder {
get_pull_request_commits::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
top: None,
continuation_token: None,
}
}
#[doc = "Get the commits for the specified iteration of a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: ID or name of the repository."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `iteration_id`: ID of the iteration from which to get the commits."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_pull_request_iteration_commits(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
iteration_id: i32,
project: impl Into<String>,
) -> get_pull_request_iteration_commits::RequestBuilder {
get_pull_request_iteration_commits::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
iteration_id,
project: project.into(),
top: None,
skip: None,
}
}
}
pub mod get_pull_request_commits {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitCommitRefList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitCommitRefList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
pub(crate) top: Option<i32>,
pub(crate) continuation_token: Option<String>,
}
impl RequestBuilder {
#[doc = "Maximum number of commits to return."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "The continuation token used for pagination."]
pub fn continuation_token(mut self, continuation_token: impl Into<String>) -> Self {
self.continuation_token = Some(continuation_token.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/commits",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(top) = &this.top {
req.url_mut()
.query_pairs_mut()
.append_pair("$top", &top.to_string());
}
if let Some(continuation_token) = &this.continuation_token {
req.url_mut()
.query_pairs_mut()
.append_pair("continuationToken", continuation_token);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitCommitRefList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitCommitRefList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_pull_request_iteration_commits {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitCommitRefList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitCommitRefList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) iteration_id: i32,
pub(crate) project: String,
pub(crate) top: Option<i32>,
pub(crate) skip: Option<i32>,
}
impl RequestBuilder {
#[doc = "Maximum number of commits to return. The maximum number of commits that can be returned per batch is 500."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "Number of commits to skip."]
pub fn skip(mut self, skip: i32) -> Self {
self.skip = Some(skip);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}/commits" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . iteration_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(top) = &this.top {
req.url_mut()
.query_pairs_mut()
.append_pair("top", &top.to_string());
}
if let Some(skip) = &this.skip {
req.url_mut()
.query_pairs_mut()
.append_pair("skip", &skip.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitCommitRefList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitCommitRefList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod pull_request_iterations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get the list of iterations for the specified pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: ID or name of the repository."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
include_commits: None,
}
}
#[doc = "Get the specified iteration for a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: ID or name of the repository."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `iteration_id`: ID of the pull request iteration to return."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
iteration_id: i32,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
iteration_id,
project: project.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(
self,
) -> azure_core::Result<models::GitPullRequestIterationList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestIterationList = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
pub(crate) include_commits: Option<bool>,
}
impl RequestBuilder {
#[doc = "If true, include the commits associated with each iteration in the response."]
pub fn include_commits(mut self, include_commits: bool) -> Self {
self.include_commits = Some(include_commits);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(include_commits) = &this.include_commits {
req.url_mut()
.query_pairs_mut()
.append_pair("includeCommits", &include_commits.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestIterationList>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitPullRequestIterationList>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPullRequestIteration> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestIteration = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) iteration_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id,
&this.iteration_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestIteration>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitPullRequestIteration>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod pull_request_iteration_changes {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve the changes made in a pull request between two iterations."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `iteration_id`: ID of the pull request iteration. <br /> Iteration one is the head of the source branch at the time the pull request is created and subsequent iterations are created when there are pushes to the source branch. Allowed values are between 1 and the maximum iteration on this pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
iteration_id: i32,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
iteration_id,
project: project.into(),
top: None,
skip: None,
compare_to: None,
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(
self,
) -> azure_core::Result<models::GitPullRequestIterationChanges> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestIterationChanges = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) iteration_id: i32,
pub(crate) project: String,
pub(crate) top: Option<i32>,
pub(crate) skip: Option<i32>,
pub(crate) compare_to: Option<i32>,
}
impl RequestBuilder {
#[doc = "Optional. The number of changes to retrieve. The default value is 100 and the maximum value is 2000."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "Optional. The number of changes to ignore. For example, to retrieve changes 101-150, set top 50 and skip to 100."]
pub fn skip(mut self, skip: i32) -> Self {
self.skip = Some(skip);
self
}
#[doc = "ID of the pull request iteration to compare against. The default value is zero which indicates the comparison is made against the common commit between the source and target branches"]
pub fn compare_to(mut self, compare_to: i32) -> Self {
self.compare_to = Some(compare_to);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}/changes" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . iteration_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(top) = &this.top {
req.url_mut()
.query_pairs_mut()
.append_pair("$top", &top.to_string());
}
if let Some(skip) = &this.skip {
req.url_mut()
.query_pairs_mut()
.append_pair("$skip", &skip.to_string());
}
if let Some(compare_to) = &this.compare_to {
req.url_mut()
.query_pairs_mut()
.append_pair("$compareTo", &compare_to.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestIterationChanges>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitPullRequestIterationChanges>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod pull_request_iteration_statuses {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get all the statuses associated with a pull request iteration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `iteration_id`: ID of the pull request iteration."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
iteration_id: i32,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
iteration_id,
project: project.into(),
}
}
#[doc = "Create a pull request status on the iteration. This operation will have the same result as Create status on pull request with specified iteration ID in the request body.\n\nThe only required field for the status is `Context.Name` that uniquely identifies the status.\nNote that `iterationId` in the request body is optional since `iterationId` can be specified in the URL.\nA conflict between `iterationId` in the URL and `iterationId` in the request body will result in status code 400."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Pull request status to create."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `iteration_id`: ID of the pull request iteration."]
#[doc = "* `project`: Project ID or project name"]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::GitPullRequestStatus>,
repository_id: impl Into<String>,
pull_request_id: i32,
iteration_id: i32,
project: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
pull_request_id,
iteration_id,
project: project.into(),
}
}
#[doc = "Update pull request iteration statuses collection. The only supported operation type is `remove`.\n\nThis operation allows to delete multiple statuses in one call.\nThe path of the `remove` operation should refer to the ID of the pull request status.\nFor example `path=\"/1\"` refers to the pull request status with ID 1."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Operations to apply to the pull request statuses in JSON Patch format."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `iteration_id`: ID of the pull request iteration."]
#[doc = "* `project`: Project ID or project name"]
pub fn update(
&self,
organization: impl Into<String>,
body: impl Into<models::JsonPatchDocument>,
repository_id: impl Into<String>,
pull_request_id: i32,
iteration_id: i32,
project: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
pull_request_id,
iteration_id,
project: project.into(),
}
}
#[doc = "Get the specific pull request iteration status by ID. The status ID is unique within the pull request across all iterations."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `iteration_id`: ID of the pull request iteration."]
#[doc = "* `status_id`: ID of the pull request status."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
iteration_id: i32,
status_id: i32,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
iteration_id,
status_id,
project: project.into(),
}
}
#[doc = "Delete pull request iteration status.\n\nYou can remove multiple statuses in one call by using Update operation."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `iteration_id`: ID of the pull request iteration."]
#[doc = "* `status_id`: ID of the pull request status."]
#[doc = "* `project`: Project ID or project name"]
pub fn delete(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
iteration_id: i32,
status_id: i32,
project: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
iteration_id,
status_id,
project: project.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPullRequestStatusList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestStatusList = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) iteration_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}/statuses" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . iteration_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestStatusList>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitPullRequestStatusList>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPullRequestStatus> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestStatus =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitPullRequestStatus,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) iteration_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}/statuses" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . iteration_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestStatus>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitPullRequestStatus>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::JsonPatchDocument,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) iteration_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}/statuses" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . iteration_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json-patch+json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPullRequestStatus> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestStatus =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) iteration_id: i32,
pub(crate) status_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}/statuses/{}" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . iteration_id , & this . status_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestStatus>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitPullRequestStatus>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) iteration_id: i32,
pub(crate) status_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/iterations/{}/statuses/{}" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . iteration_id , & this . status_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
}
pub mod pull_request_labels {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get all the labels assigned to a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
project_id: None,
}
}
#[doc = "Create a label for a specified pull request. The only required field is the name of the new label."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Label to assign to the pull request."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::WebApiCreateTagRequestData>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
project_id: None,
}
}
#[doc = "Retrieves a single label that has been assigned to a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `label_id_or_name`: The name or ID of the label requested."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
label_id_or_name: impl Into<String>,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
label_id_or_name: label_id_or_name.into(),
project: project.into(),
project_id: None,
}
}
#[doc = "Removes a label from the set of those assigned to the pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `label_id_or_name`: The name or ID of the label requested."]
#[doc = "* `project`: Project ID or project name"]
pub fn delete(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
label_id_or_name: impl Into<String>,
project: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
label_id_or_name: label_id_or_name.into(),
project: project.into(),
project_id: None,
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WebApiTagDefinitionList> {
let bytes = self.0.into_body().collect().await?;
let body: models::WebApiTagDefinitionList = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
pub(crate) project_id: Option<String>,
}
impl RequestBuilder {
#[doc = "Project ID or project name."]
pub fn project_id(mut self, project_id: impl Into<String>) -> Self {
self.project_id = Some(project_id.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/labels",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(project_id) = &this.project_id {
req.url_mut()
.query_pairs_mut()
.append_pair("projectId", project_id);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::WebApiTagDefinitionList>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::WebApiTagDefinitionList>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WebApiTagDefinition> {
let bytes = self.0.into_body().collect().await?;
let body: models::WebApiTagDefinition =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::WebApiCreateTagRequestData,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
pub(crate) project_id: Option<String>,
}
impl RequestBuilder {
#[doc = "Project ID or project name."]
pub fn project_id(mut self, project_id: impl Into<String>) -> Self {
self.project_id = Some(project_id.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/labels",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
if let Some(project_id) = &this.project_id {
req.url_mut()
.query_pairs_mut()
.append_pair("projectId", project_id);
}
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::WebApiTagDefinition>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::WebApiTagDefinition>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WebApiTagDefinition> {
let bytes = self.0.into_body().collect().await?;
let body: models::WebApiTagDefinition =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) label_id_or_name: String,
pub(crate) project: String,
pub(crate) project_id: Option<String>,
}
impl RequestBuilder {
#[doc = "Project ID or project name."]
pub fn project_id(mut self, project_id: impl Into<String>) -> Self {
self.project_id = Some(project_id.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/labels/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id,
&this.label_id_or_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(project_id) = &this.project_id {
req.url_mut()
.query_pairs_mut()
.append_pair("projectId", project_id);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::WebApiTagDefinition>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::WebApiTagDefinition>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) label_id_or_name: String,
pub(crate) project: String,
pub(crate) project_id: Option<String>,
}
impl RequestBuilder {
#[doc = "Project ID or project name."]
pub fn project_id(mut self, project_id: impl Into<String>) -> Self {
self.project_id = Some(project_id.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/labels/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id,
&this.label_id_or_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(project_id) = &this.project_id {
req.url_mut()
.query_pairs_mut()
.append_pair("projectId", project_id);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
}
pub mod pull_request_properties {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get external properties of the pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
#[doc = "Create or update pull request external properties. The patch operation can be `add`, `replace` or `remove`. For `add` operation, the path can be empty. If the path is empty, the value must be a list of key value pairs. For `replace` operation, the path cannot be empty. If the path does not exist, the property will be added to the collection. For `remove` operation, the path cannot be empty. If the path does not exist, no action will be performed."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Properties to add, replace or remove in JSON Patch format."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn update(
&self,
organization: impl Into<String>,
body: impl Into<models::JsonPatchDocument>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PropertiesCollection> {
let bytes = self.0.into_body().collect().await?;
let body: models::PropertiesCollection =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/properties",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::PropertiesCollection>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::PropertiesCollection>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PropertiesCollection> {
let bytes = self.0.into_body().collect().await?;
let body: models::PropertiesCollection =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::JsonPatchDocument,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/properties",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json-patch+json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::PropertiesCollection>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::PropertiesCollection>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod pull_request_reviewers {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve the reviewers for a pull request"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
#[doc = "Add reviewers to a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Reviewers to add to the pull request."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn create_pull_request_reviewers(
&self,
organization: impl Into<String>,
body: Vec<models::IdentityRef>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> create_pull_request_reviewers::RequestBuilder {
create_pull_request_reviewers::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body,
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
#[doc = "Add an unmaterialized identity to the reviewers of a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Reviewer to add to the pull request."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn create_unmaterialized_pull_request_reviewer(
&self,
organization: impl Into<String>,
body: impl Into<models::IdentityRefWithVote>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> create_unmaterialized_pull_request_reviewer::RequestBuilder {
create_unmaterialized_pull_request_reviewer::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
#[doc = "Reset the votes of multiple reviewers on a pull request. NOTE: This endpoint only supports updating votes, but does not support updating required reviewers (use policy) or display names."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: IDs of the reviewers whose votes will be reset to zero"]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request"]
#[doc = "* `project`: Project ID or project name"]
pub fn update_pull_request_reviewers(
&self,
organization: impl Into<String>,
body: Vec<models::IdentityRefWithVote>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> update_pull_request_reviewers::RequestBuilder {
update_pull_request_reviewers::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body,
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
#[doc = "Retrieve information about a particular reviewer on a pull request"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `reviewer_id`: ID of the reviewer."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
reviewer_id: impl Into<String>,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
reviewer_id: reviewer_id.into(),
project: project.into(),
}
}
#[doc = "Add a reviewer to a pull request or cast a vote."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Reviewer's vote.<br />If the reviewer's ID is included here, it must match the reviewerID parameter.<br />Reviewers can set their own vote with this method. When adding other reviewers, vote must be set to zero."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `reviewer_id`: ID of the reviewer."]
#[doc = "* `project`: Project ID or project name"]
pub fn create_pull_request_reviewer(
&self,
organization: impl Into<String>,
body: impl Into<models::IdentityRefWithVote>,
repository_id: impl Into<String>,
pull_request_id: i32,
reviewer_id: impl Into<String>,
project: impl Into<String>,
) -> create_pull_request_reviewer::RequestBuilder {
create_pull_request_reviewer::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
pull_request_id,
reviewer_id: reviewer_id.into(),
project: project.into(),
}
}
#[doc = "Edit a reviewer entry. These fields are patchable: isFlagged, hasDeclined"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Reviewer data.<br />If the reviewer's ID is included here, it must match the reviewerID parameter."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `reviewer_id`: ID of the reviewer."]
#[doc = "* `project`: Project ID or project name"]
pub fn update_pull_request_reviewer(
&self,
organization: impl Into<String>,
body: impl Into<models::IdentityRefWithVote>,
repository_id: impl Into<String>,
pull_request_id: i32,
reviewer_id: impl Into<String>,
project: impl Into<String>,
) -> update_pull_request_reviewer::RequestBuilder {
update_pull_request_reviewer::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
pull_request_id,
reviewer_id: reviewer_id.into(),
project: project.into(),
}
}
#[doc = "Remove a reviewer from a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `reviewer_id`: ID of the reviewer to remove."]
#[doc = "* `project`: Project ID or project name"]
pub fn delete(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
reviewer_id: impl Into<String>,
project: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
reviewer_id: reviewer_id.into(),
project: project.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IdentityRefWithVoteList> {
let bytes = self.0.into_body().collect().await?;
let body: models::IdentityRefWithVoteList = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::IdentityRefWithVoteList>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::IdentityRefWithVoteList>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_pull_request_reviewers {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IdentityRefWithVoteList> {
let bytes = self.0.into_body().collect().await?;
let body: models::IdentityRefWithVoteList = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: Vec<models::IdentityRef>,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::IdentityRefWithVoteList>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::IdentityRefWithVoteList>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_unmaterialized_pull_request_reviewer {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IdentityRefWithVote> {
let bytes = self.0.into_body().collect().await?;
let body: models::IdentityRefWithVote =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::IdentityRefWithVote,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::IdentityRefWithVote>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::IdentityRefWithVote>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_pull_request_reviewers {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: Vec<models::IdentityRefWithVote>,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IdentityRefWithVote> {
let bytes = self.0.into_body().collect().await?;
let body: models::IdentityRefWithVote =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) reviewer_id: String,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id,
&this.reviewer_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::IdentityRefWithVote>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::IdentityRefWithVote>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_pull_request_reviewer {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IdentityRefWithVote> {
let bytes = self.0.into_body().collect().await?;
let body: models::IdentityRefWithVote =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::IdentityRefWithVote,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) reviewer_id: String,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id,
&this.reviewer_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::IdentityRefWithVote>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::IdentityRefWithVote>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_pull_request_reviewer {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IdentityRefWithVote> {
let bytes = self.0.into_body().collect().await?;
let body: models::IdentityRefWithVote =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::IdentityRefWithVote,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) reviewer_id: String,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id,
&this.reviewer_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::IdentityRefWithVote>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::IdentityRefWithVote>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) reviewer_id: String,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/reviewers/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id,
&this.reviewer_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
}
pub mod pull_request_share {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Sends an e-mail notification about a specific pull request to a set of recipients"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: ID of the git repository."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn share_pull_request(
&self,
organization: impl Into<String>,
body: impl Into<models::ShareNotificationContext>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> share_pull_request::RequestBuilder {
share_pull_request::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
}
pub mod share_pull_request {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::ShareNotificationContext,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/share",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
}
pub mod pull_request_statuses {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get all the statuses associated with a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
#[doc = "Create a pull request status.\n\nThe only required field for the status is `Context.Name` that uniquely identifies the status.\nNote that you can specify iterationId in the request body to post the status on the iteration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Pull request status to create."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::GitPullRequestStatus>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
#[doc = "Update pull request statuses collection. The only supported operation type is `remove`.\n\nThis operation allows to delete multiple statuses in one call.\nThe path of the `remove` operation should refer to the ID of the pull request status.\nFor example `path=\"/1\"` refers to the pull request status with ID 1."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Operations to apply to the pull request statuses in JSON Patch format."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn update(
&self,
organization: impl Into<String>,
body: impl Into<models::JsonPatchDocument>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
#[doc = "Get the specific pull request status by ID. The status ID is unique within the pull request across all iterations."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `status_id`: ID of the pull request status."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
status_id: i32,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
status_id,
project: project.into(),
}
}
#[doc = "Delete pull request status.\n\nYou can remove multiple statuses in one call by using Update operation."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request’s target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `status_id`: ID of the pull request status."]
#[doc = "* `project`: Project ID or project name"]
pub fn delete(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
status_id: i32,
project: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
status_id,
project: project.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPullRequestStatusList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestStatusList = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/statuses",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestStatusList>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitPullRequestStatusList>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPullRequestStatus> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestStatus =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitPullRequestStatus,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/statuses",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestStatus>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitPullRequestStatus>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::JsonPatchDocument,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/statuses",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json-patch+json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPullRequestStatus> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestStatus =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) status_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/statuses/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id,
&this.status_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestStatus>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitPullRequestStatus>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) status_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/statuses/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id,
&this.status_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
}
pub mod pull_request_threads {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve all threads in a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
iteration: None,
base_iteration: None,
}
}
#[doc = "Create a thread in a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: The thread to create. Thread must contain at least one comment."]
#[doc = "* `repository_id`: Repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::GitPullRequestCommentThread>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
#[doc = "Retrieve a thread in a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `thread_id`: ID of the thread."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
thread_id: i32,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
thread_id,
project: project.into(),
iteration: None,
base_iteration: None,
}
}
#[doc = "Update a thread in a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: The thread content that should be updated."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `thread_id`: ID of the thread to update."]
#[doc = "* `project`: Project ID or project name"]
pub fn update(
&self,
organization: impl Into<String>,
body: impl Into<models::GitPullRequestCommentThread>,
repository_id: impl Into<String>,
pull_request_id: i32,
thread_id: i32,
project: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
pull_request_id,
thread_id,
project: project.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(
self,
) -> azure_core::Result<models::GitPullRequestCommentThreadList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestCommentThreadList = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
pub(crate) iteration: Option<i32>,
pub(crate) base_iteration: Option<i32>,
}
impl RequestBuilder {
#[doc = "If specified, thread positions will be tracked using this iteration as the right side of the diff."]
pub fn iteration(mut self, iteration: i32) -> Self {
self.iteration = Some(iteration);
self
}
#[doc = "If specified, thread positions will be tracked using this iteration as the left side of the diff."]
pub fn base_iteration(mut self, base_iteration: i32) -> Self {
self.base_iteration = Some(base_iteration);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(iteration) = &this.iteration {
req.url_mut()
.query_pairs_mut()
.append_pair("$iteration", &iteration.to_string());
}
if let Some(base_iteration) = &this.base_iteration {
req.url_mut()
.query_pairs_mut()
.append_pair("$baseIteration", &base_iteration.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestCommentThreadList>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitPullRequestCommentThreadList>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(
self,
) -> azure_core::Result<models::GitPullRequestCommentThread> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestCommentThread = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitPullRequestCommentThread,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestCommentThread>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitPullRequestCommentThread>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(
self,
) -> azure_core::Result<models::GitPullRequestCommentThread> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestCommentThread = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) thread_id: i32,
pub(crate) project: String,
pub(crate) iteration: Option<i32>,
pub(crate) base_iteration: Option<i32>,
}
impl RequestBuilder {
#[doc = "If specified, thread position will be tracked using this iteration as the right side of the diff."]
pub fn iteration(mut self, iteration: i32) -> Self {
self.iteration = Some(iteration);
self
}
#[doc = "If specified, thread position will be tracked using this iteration as the left side of the diff."]
pub fn base_iteration(mut self, base_iteration: i32) -> Self {
self.base_iteration = Some(base_iteration);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id,
&this.thread_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(iteration) = &this.iteration {
req.url_mut()
.query_pairs_mut()
.append_pair("$iteration", &iteration.to_string());
}
if let Some(base_iteration) = &this.base_iteration {
req.url_mut()
.query_pairs_mut()
.append_pair("$baseIteration", &base_iteration.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestCommentThread>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitPullRequestCommentThread>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(
self,
) -> azure_core::Result<models::GitPullRequestCommentThread> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPullRequestCommentThread = serde_json::from_slice(&bytes)
.map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitPullRequestCommentThread,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) thread_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id,
&this.thread_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPullRequestCommentThread>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitPullRequestCommentThread>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod pull_request_thread_comments {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve all comments associated with a specific thread in a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `thread_id`: ID of the thread."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
thread_id: i32,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
thread_id,
project: project.into(),
}
}
#[doc = "Create a comment on a specific thread in a pull request (up to 500 comments can be created per thread)."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: The comment to create. Comments can be up to 150,000 characters."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `thread_id`: ID of the thread that the desired comment is in."]
#[doc = "* `project`: Project ID or project name"]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::Comment>,
repository_id: impl Into<String>,
pull_request_id: i32,
thread_id: i32,
project: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
pull_request_id,
thread_id,
project: project.into(),
}
}
#[doc = "Retrieve a comment associated with a specific thread in a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `thread_id`: ID of the thread that the desired comment is in."]
#[doc = "* `comment_id`: ID of the comment."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
thread_id: i32,
comment_id: i32,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
thread_id,
comment_id,
project: project.into(),
}
}
#[doc = "Update a comment associated with a specific thread in a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: The comment content that should be updated. Comments can be up to 150,000 characters."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `thread_id`: ID of the thread that the desired comment is in."]
#[doc = "* `comment_id`: ID of the comment to update."]
#[doc = "* `project`: Project ID or project name"]
pub fn update(
&self,
organization: impl Into<String>,
body: impl Into<models::Comment>,
repository_id: impl Into<String>,
pull_request_id: i32,
thread_id: i32,
comment_id: i32,
project: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
pull_request_id,
thread_id,
comment_id,
project: project.into(),
}
}
#[doc = "Delete a comment associated with a specific thread in a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `thread_id`: ID of the thread that the desired comment is in."]
#[doc = "* `comment_id`: ID of the comment."]
#[doc = "* `project`: Project ID or project name"]
pub fn delete(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
thread_id: i32,
comment_id: i32,
project: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
thread_id,
comment_id,
project: project.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CommentList> {
let bytes = self.0.into_body().collect().await?;
let body: models::CommentList = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) thread_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . thread_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::CommentList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::CommentList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Comment> {
let bytes = self.0.into_body().collect().await?;
let body: models::Comment = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::Comment,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) thread_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . thread_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Comment>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::Comment>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Comment> {
let bytes = self.0.into_body().collect().await?;
let body: models::Comment = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) thread_id: i32,
pub(crate) comment_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments/{}" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . thread_id , & this . comment_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Comment>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::Comment>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Comment> {
let bytes = self.0.into_body().collect().await?;
let body: models::Comment = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::Comment,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) thread_id: i32,
pub(crate) comment_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments/{}" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . thread_id , & this . comment_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Comment>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::Comment>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) thread_id: i32,
pub(crate) comment_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments/{}" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . thread_id , & this . comment_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
}
pub mod pull_request_comment_likes {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get likes for a comment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `thread_id`: The ID of the thread that contains the comment."]
#[doc = "* `comment_id`: The ID of the comment."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
thread_id: i32,
comment_id: i32,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
thread_id,
comment_id,
project: project.into(),
}
}
#[doc = "Add a like on a comment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `thread_id`: The ID of the thread that contains the comment."]
#[doc = "* `comment_id`: The ID of the comment."]
#[doc = "* `project`: Project ID or project name"]
pub fn create(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
thread_id: i32,
comment_id: i32,
project: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
thread_id,
comment_id,
project: project.into(),
}
}
#[doc = "Delete a like on a comment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The repository ID of the pull request's target branch."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `thread_id`: The ID of the thread that contains the comment."]
#[doc = "* `comment_id`: The ID of the comment."]
#[doc = "* `project`: Project ID or project name"]
pub fn delete(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
thread_id: i32,
comment_id: i32,
project: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
thread_id,
comment_id,
project: project.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IdentityRefList> {
let bytes = self.0.into_body().collect().await?;
let body: models::IdentityRefList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) thread_id: i32,
pub(crate) comment_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments/{}/likes" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . thread_id , & this . comment_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::IdentityRefList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::IdentityRefList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) thread_id: i32,
pub(crate) comment_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments/{}/likes" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . thread_id , & this . comment_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) thread_id: i32,
pub(crate) comment_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/threads/{}/comments/{}/likes" , this . client . endpoint () , & this . organization , & this . project , & this . repository_id , & this . pull_request_id , & this . thread_id , & this . comment_id)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = futures::future::BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
}
pub mod pull_request_work_items {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve a list of work items associated with a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: ID or name of the repository."]
#[doc = "* `pull_request_id`: ID of the pull request."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
pull_request_id: i32,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
pull_request_id,
project: project.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResourceRefList> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResourceRefList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) pull_request_id: i32,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pullRequests/{}/workitems",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.pull_request_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::ResourceRefList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::ResourceRefList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod pushes {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves pushes associated with the specified repository."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
project: project.into(),
skip: None,
top: None,
search_criteria_from_date: None,
search_criteria_include_links: None,
search_criteria_include_ref_updates: None,
search_criteria_pusher_id: None,
search_criteria_ref_name: None,
search_criteria_to_date: None,
}
}
#[doc = "Push changes to the repository."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::GitPush>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
project: project.into(),
}
}
#[doc = "Retrieves a particular push."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `push_id`: ID of the push."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
push_id: i32,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
push_id,
project: project.into(),
include_commits: None,
include_ref_updates: None,
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPushList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPushList = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) skip: Option<i32>,
pub(crate) top: Option<i32>,
pub(crate) search_criteria_from_date: Option<time::OffsetDateTime>,
pub(crate) search_criteria_include_links: Option<bool>,
pub(crate) search_criteria_include_ref_updates: Option<bool>,
pub(crate) search_criteria_pusher_id: Option<String>,
pub(crate) search_criteria_ref_name: Option<String>,
pub(crate) search_criteria_to_date: Option<time::OffsetDateTime>,
}
impl RequestBuilder {
#[doc = "Number of pushes to skip."]
pub fn skip(mut self, skip: i32) -> Self {
self.skip = Some(skip);
self
}
#[doc = "Number of pushes to return."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references."]
pub fn search_criteria_from_date(
mut self,
search_criteria_from_date: impl Into<time::OffsetDateTime>,
) -> Self {
self.search_criteria_from_date = Some(search_criteria_from_date.into());
self
}
#[doc = "Whether to include the _links field on the shallow references"]
pub fn search_criteria_include_links(
mut self,
search_criteria_include_links: bool,
) -> Self {
self.search_criteria_include_links = Some(search_criteria_include_links);
self
}
#[doc = "Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references."]
pub fn search_criteria_include_ref_updates(
mut self,
search_criteria_include_ref_updates: bool,
) -> Self {
self.search_criteria_include_ref_updates =
Some(search_criteria_include_ref_updates);
self
}
#[doc = "Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references."]
pub fn search_criteria_pusher_id(
mut self,
search_criteria_pusher_id: impl Into<String>,
) -> Self {
self.search_criteria_pusher_id = Some(search_criteria_pusher_id.into());
self
}
#[doc = "Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references."]
pub fn search_criteria_ref_name(
mut self,
search_criteria_ref_name: impl Into<String>,
) -> Self {
self.search_criteria_ref_name = Some(search_criteria_ref_name.into());
self
}
#[doc = "Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references."]
pub fn search_criteria_to_date(
mut self,
search_criteria_to_date: impl Into<time::OffsetDateTime>,
) -> Self {
self.search_criteria_to_date = Some(search_criteria_to_date.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pushes",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(skip) = &this.skip {
req.url_mut()
.query_pairs_mut()
.append_pair("$skip", &skip.to_string());
}
if let Some(top) = &this.top {
req.url_mut()
.query_pairs_mut()
.append_pair("$top", &top.to_string());
}
if let Some(search_criteria_from_date) = &this.search_criteria_from_date {
let formatted_date_time =
crate::date_time::format_date_time(search_criteria_from_date)?;
req.url_mut()
.query_pairs_mut()
.append_pair("searchCriteria.fromDate", &formatted_date_time);
}
if let Some(search_criteria_include_links) =
&this.search_criteria_include_links
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.includeLinks",
&search_criteria_include_links.to_string(),
);
}
if let Some(search_criteria_include_ref_updates) =
&this.search_criteria_include_ref_updates
{
req.url_mut().query_pairs_mut().append_pair(
"searchCriteria.includeRefUpdates",
&search_criteria_include_ref_updates.to_string(),
);
}
if let Some(search_criteria_pusher_id) = &this.search_criteria_pusher_id {
req.url_mut()
.query_pairs_mut()
.append_pair("searchCriteria.pusherId", search_criteria_pusher_id);
}
if let Some(search_criteria_ref_name) = &this.search_criteria_ref_name {
req.url_mut()
.query_pairs_mut()
.append_pair("searchCriteria.refName", search_criteria_ref_name);
}
if let Some(search_criteria_to_date) = &this.search_criteria_to_date {
let formatted_date_time =
crate::date_time::format_date_time(search_criteria_to_date)?;
req.url_mut()
.query_pairs_mut()
.append_pair("searchCriteria.toDate", &formatted_date_time);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPushList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitPushList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPush> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPush = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitPush,
pub(crate) repository_id: String,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pushes",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPush>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitPush>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitPush> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitPush = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) push_id: i32,
pub(crate) project: String,
pub(crate) include_commits: Option<i32>,
pub(crate) include_ref_updates: Option<bool>,
}
impl RequestBuilder {
#[doc = "The number of commits to include in the result."]
pub fn include_commits(mut self, include_commits: i32) -> Self {
self.include_commits = Some(include_commits);
self
}
#[doc = "If true, include the list of refs that were updated by the push."]
pub fn include_ref_updates(mut self, include_ref_updates: bool) -> Self {
self.include_ref_updates = Some(include_ref_updates);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/pushes/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.push_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(include_commits) = &this.include_commits {
req.url_mut()
.query_pairs_mut()
.append_pair("includeCommits", &include_commits.to_string());
}
if let Some(include_ref_updates) = &this.include_ref_updates {
req.url_mut()
.query_pairs_mut()
.append_pair("includeRefUpdates", &include_ref_updates.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitPush>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitPush>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod refs {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Queries the provided repository for its refs and returns them."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
project: project.into(),
filter: None,
include_links: None,
include_statuses: None,
include_my_branches: None,
latest_statuses_only: None,
peel_tags: None,
filter_contains: None,
top: None,
continuation_token: None,
}
}
#[doc = "Creating, updating, or deleting refs(branches).\n\nUpdating a ref means making it point at a different commit than it used to. You must specify both the old and new commit to avoid race conditions."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: List of ref updates to attempt to perform"]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn update_refs(
&self,
organization: impl Into<String>,
body: Vec<models::GitRefUpdate>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> update_refs::RequestBuilder {
update_refs::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body,
repository_id: repository_id.into(),
project: project.into(),
project_id: None,
}
}
#[doc = "Lock or Unlock a branch."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: The ref update action (lock/unlock) to perform"]
#[doc = "* `repository_id`: The name or ID of the repository."]
#[doc = "* `filter`: The name of the branch to lock/unlock"]
#[doc = "* `project`: Project ID or project name"]
pub fn update_ref(
&self,
organization: impl Into<String>,
body: impl Into<models::GitRefUpdate>,
repository_id: impl Into<String>,
filter: impl Into<String>,
project: impl Into<String>,
) -> update_ref::RequestBuilder {
update_ref::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_id: repository_id.into(),
filter: filter.into(),
project: project.into(),
project_id: None,
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRefList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRefList = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) filter: Option<String>,
pub(crate) include_links: Option<bool>,
pub(crate) include_statuses: Option<bool>,
pub(crate) include_my_branches: Option<bool>,
pub(crate) latest_statuses_only: Option<bool>,
pub(crate) peel_tags: Option<bool>,
pub(crate) filter_contains: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) continuation_token: Option<String>,
}
impl RequestBuilder {
#[doc = "\\[optional\\] A filter to apply to the refs (starts with)."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "\\[optional\\] Specifies if referenceLinks should be included in the result. default is false."]
pub fn include_links(mut self, include_links: bool) -> Self {
self.include_links = Some(include_links);
self
}
#[doc = "\\[optional\\] Includes up to the first 1000 commit statuses for each ref. The default value is false."]
pub fn include_statuses(mut self, include_statuses: bool) -> Self {
self.include_statuses = Some(include_statuses);
self
}
#[doc = "\\[optional\\] Includes only branches that the user owns, the branches the user favorites, and the default branch. The default value is false. Cannot be combined with the filter parameter."]
pub fn include_my_branches(mut self, include_my_branches: bool) -> Self {
self.include_my_branches = Some(include_my_branches);
self
}
#[doc = "(optional) Set to true to include only the tip commit status for each ref. This option requires `includeStatuses` to be true. The default value is false."]
pub fn latest_statuses_only(mut self, latest_statuses_only: bool) -> Self {
self.latest_statuses_only = Some(latest_statuses_only);
self
}
#[doc = "\\[optional\\] Annotated tags will populate the PeeledObjectId property. default is false."]
pub fn peel_tags(mut self, peel_tags: bool) -> Self {
self.peel_tags = Some(peel_tags);
self
}
#[doc = "\\[optional\\] A filter to apply to the refs (contains)."]
pub fn filter_contains(mut self, filter_contains: impl Into<String>) -> Self {
self.filter_contains = Some(filter_contains.into());
self
}
#[doc = "\\[optional\\] Maximum number of refs to return. It cannot be bigger than 1000. If it is not provided but continuation token is, top will default to 100."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "The continuation token used for pagination."]
pub fn continuation_token(mut self, continuation_token: impl Into<String>) -> Self {
self.continuation_token = Some(continuation_token.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/refs",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(filter) = &this.filter {
req.url_mut()
.query_pairs_mut()
.append_pair("filter", filter);
}
if let Some(include_links) = &this.include_links {
req.url_mut()
.query_pairs_mut()
.append_pair("includeLinks", &include_links.to_string());
}
if let Some(include_statuses) = &this.include_statuses {
req.url_mut()
.query_pairs_mut()
.append_pair("includeStatuses", &include_statuses.to_string());
}
if let Some(include_my_branches) = &this.include_my_branches {
req.url_mut()
.query_pairs_mut()
.append_pair("includeMyBranches", &include_my_branches.to_string());
}
if let Some(latest_statuses_only) = &this.latest_statuses_only {
req.url_mut().query_pairs_mut().append_pair(
"latestStatusesOnly",
&latest_statuses_only.to_string(),
);
}
if let Some(peel_tags) = &this.peel_tags {
req.url_mut()
.query_pairs_mut()
.append_pair("peelTags", &peel_tags.to_string());
}
if let Some(filter_contains) = &this.filter_contains {
req.url_mut()
.query_pairs_mut()
.append_pair("filterContains", filter_contains);
}
if let Some(top) = &this.top {
req.url_mut()
.query_pairs_mut()
.append_pair("$top", &top.to_string());
}
if let Some(continuation_token) = &this.continuation_token {
req.url_mut()
.query_pairs_mut()
.append_pair("continuationToken", continuation_token);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRefList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitRefList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_refs {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRefUpdateResultList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRefUpdateResultList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: Vec<models::GitRefUpdate>,
pub(crate) repository_id: String,
pub(crate) project: String,
pub(crate) project_id: Option<String>,
}
impl RequestBuilder {
#[doc = "ID or name of the team project. Optional if specifying an ID for repository."]
pub fn project_id(mut self, project_id: impl Into<String>) -> Self {
self.project_id = Some(project_id.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/refs",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
if let Some(project_id) = &this.project_id {
req.url_mut()
.query_pairs_mut()
.append_pair("projectId", project_id);
}
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRefUpdateResultList>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitRefUpdateResultList>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_ref {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRef> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRef = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitRefUpdate,
pub(crate) repository_id: String,
pub(crate) filter: String,
pub(crate) project: String,
pub(crate) project_id: Option<String>,
}
impl RequestBuilder {
#[doc = "ID or name of the team project. Optional if specifying an ID for repository."]
pub fn project_id(mut self, project_id: impl Into<String>) -> Self {
self.project_id = Some(project_id.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/refs",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
let filter = &this.filter;
req.url_mut()
.query_pairs_mut()
.append_pair("filter", filter);
if let Some(project_id) = &this.project_id {
req.url_mut()
.query_pairs_mut()
.append_pair("projectId", project_id);
}
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRef>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitRef>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod reverts {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve information about a revert operation for a specific branch."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `repository_id`: ID of the repository."]
#[doc = "* `ref_name`: The GitAsyncRefOperationParameters generatedRefName used for the revert operation."]
pub fn get_revert_for_ref_name(
&self,
organization: impl Into<String>,
project: impl Into<String>,
repository_id: impl Into<String>,
ref_name: impl Into<String>,
) -> get_revert_for_ref_name::RequestBuilder {
get_revert_for_ref_name::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
repository_id: repository_id.into(),
ref_name: ref_name.into(),
}
}
#[doc = "Starts the operation to create a new branch which reverts changes introduced by either a specific commit or commits that are associated to a pull request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `repository_id`: ID of the repository."]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::GitAsyncRefOperationParameters>,
project: impl Into<String>,
repository_id: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
repository_id: repository_id.into(),
}
}
#[doc = "Retrieve information about a revert operation by revert Id."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `revert_id`: ID of the revert operation."]
#[doc = "* `repository_id`: ID of the repository."]
pub fn get_revert(
&self,
organization: impl Into<String>,
project: impl Into<String>,
revert_id: i32,
repository_id: impl Into<String>,
) -> get_revert::RequestBuilder {
get_revert::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
revert_id,
repository_id: repository_id.into(),
}
}
}
pub mod get_revert_for_ref_name {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRevert> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRevert = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) repository_id: String,
pub(crate) ref_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/reverts",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let ref_name = &this.ref_name;
req.url_mut()
.query_pairs_mut()
.append_pair("refName", ref_name);
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRevert>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitRevert>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRevert> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRevert = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitAsyncRefOperationParameters,
pub(crate) project: String,
pub(crate) repository_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/reverts",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRevert>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitRevert>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_revert {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRevert> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRevert = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) revert_id: i32,
pub(crate) repository_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/reverts/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.revert_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRevert>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitRevert>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod suggestions {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve a pull request suggestion for a particular repository or team project."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: ID of the git repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
project: project.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitSuggestionList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitSuggestionList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) project: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/suggestions",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitSuggestionList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitSuggestionList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod trees {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository.\n\nRepositories have both a name and an identifier. Identifiers are globally unique, but several projects may contain a repository of the same name. You don't need to include the project if you specify a repository by ID. However, if you specify a repository by name, you must also specify the project (by name or ID."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_id`: Repository Id."]
#[doc = "* `sha1`: SHA1 hash of the tree object."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
repository_id: impl Into<String>,
sha1: impl Into<String>,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_id: repository_id.into(),
sha1: sha1.into(),
project: project.into(),
project_id: None,
recursive: None,
file_name: None,
format: None,
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitTreeRef> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitTreeRef = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_id: String,
pub(crate) sha1: String,
pub(crate) project: String,
pub(crate) project_id: Option<String>,
pub(crate) recursive: Option<bool>,
pub(crate) file_name: Option<String>,
pub(crate) format: Option<String>,
}
impl RequestBuilder {
#[doc = "Project Id."]
pub fn project_id(mut self, project_id: impl Into<String>) -> Self {
self.project_id = Some(project_id.into());
self
}
#[doc = "Search recursively. Include trees underneath this tree. Default is false."]
pub fn recursive(mut self, recursive: bool) -> Self {
self.recursive = Some(recursive);
self
}
#[doc = "Name to use if a .zip file is returned. Default is the object ID."]
pub fn file_name(mut self, file_name: impl Into<String>) -> Self {
self.file_name = Some(file_name.into());
self
}
#[doc = "Use \"zip\". Defaults to the MIME type set in the Accept header."]
pub fn format(mut self, format: impl Into<String>) -> Self {
self.format = Some(format.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/trees/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_id,
&this.sha1
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(project_id) = &this.project_id {
req.url_mut()
.query_pairs_mut()
.append_pair("projectId", project_id);
}
if let Some(recursive) = &this.recursive {
req.url_mut()
.query_pairs_mut()
.append_pair("recursive", &recursive.to_string());
}
if let Some(file_name) = &this.file_name {
req.url_mut()
.query_pairs_mut()
.append_pair("fileName", file_name);
}
if let Some(format) = &this.format {
req.url_mut()
.query_pairs_mut()
.append_pair("$format", format);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitTreeRef>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitTreeRef>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod merge_bases {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Find the merge bases of two commits, optionally across forks. If otherRepositoryId is not specified, the merge bases will only be calculated within the context of the local repositoryNameOrId."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_name_or_id`: ID or name of the local repository."]
#[doc = "* `commit_id`: First commit, usually the tip of the target branch of the potential merge."]
#[doc = "* `other_commit_id`: Other commit, usually the tip of the source branch of the potential merge."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_name_or_id: impl Into<String>,
commit_id: impl Into<String>,
other_commit_id: impl Into<String>,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_name_or_id: repository_name_or_id.into(),
commit_id: commit_id.into(),
other_commit_id: other_commit_id.into(),
project: project.into(),
other_collection_id: None,
other_repository_id: None,
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitCommitRefList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitCommitRefList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_name_or_id: String,
pub(crate) commit_id: String,
pub(crate) other_commit_id: String,
pub(crate) project: String,
pub(crate) other_collection_id: Option<String>,
pub(crate) other_repository_id: Option<String>,
}
impl RequestBuilder {
#[doc = "The collection ID where otherCommitId lives."]
pub fn other_collection_id(mut self, other_collection_id: impl Into<String>) -> Self {
self.other_collection_id = Some(other_collection_id.into());
self
}
#[doc = "The repository ID where otherCommitId lives."]
pub fn other_repository_id(mut self, other_repository_id: impl Into<String>) -> Self {
self.other_repository_id = Some(other_repository_id.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/commits/{}/mergebases",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_name_or_id,
&this.commit_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
let other_commit_id = &this.other_commit_id;
req.url_mut()
.query_pairs_mut()
.append_pair("otherCommitId", other_commit_id);
if let Some(other_collection_id) = &this.other_collection_id {
req.url_mut()
.query_pairs_mut()
.append_pair("otherCollectionId", other_collection_id);
}
if let Some(other_repository_id) = &this.other_repository_id {
req.url_mut()
.query_pairs_mut()
.append_pair("otherRepositoryId", other_repository_id);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitCommitRefList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitCommitRefList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod forks {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieve all forks of a repository in the collection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_name_or_id`: The name or ID of the repository."]
#[doc = "* `collection_id`: Team project collection ID."]
#[doc = "* `project`: Project ID or project name"]
pub fn list(
&self,
organization: impl Into<String>,
repository_name_or_id: impl Into<String>,
collection_id: impl Into<String>,
project: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_name_or_id: repository_name_or_id.into(),
collection_id: collection_id.into(),
project: project.into(),
include_links: None,
}
}
#[doc = "Retrieve all requested fork sync operations on this repository."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_name_or_id`: The name or ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_fork_sync_requests(
&self,
organization: impl Into<String>,
repository_name_or_id: impl Into<String>,
project: impl Into<String>,
) -> get_fork_sync_requests::RequestBuilder {
get_fork_sync_requests::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_name_or_id: repository_name_or_id.into(),
project: project.into(),
include_abandoned: None,
include_links: None,
}
}
#[doc = "Request that another repository's refs be fetched into this one. It syncs two existing forks. To create a fork, please see the <a href=\"https://docs.microsoft.com/en-us/rest/api/vsts/git/repositories/create?view=azure-devops-rest-5.1\"> repositories endpoint</a>"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Source repository and ref mapping."]
#[doc = "* `repository_name_or_id`: The name or ID of the repository."]
#[doc = "* `project`: Project ID or project name"]
pub fn create_fork_sync_request(
&self,
organization: impl Into<String>,
body: impl Into<models::GitForkSyncRequestParameters>,
repository_name_or_id: impl Into<String>,
project: impl Into<String>,
) -> create_fork_sync_request::RequestBuilder {
create_fork_sync_request::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
repository_name_or_id: repository_name_or_id.into(),
project: project.into(),
include_links: None,
}
}
#[doc = "Get a specific fork sync operation's details."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `repository_name_or_id`: The name or ID of the repository."]
#[doc = "* `fork_sync_operation_id`: OperationId of the sync request."]
#[doc = "* `project`: Project ID or project name"]
pub fn get_fork_sync_request(
&self,
organization: impl Into<String>,
repository_name_or_id: impl Into<String>,
fork_sync_operation_id: i32,
project: impl Into<String>,
) -> get_fork_sync_request::RequestBuilder {
get_fork_sync_request::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
repository_name_or_id: repository_name_or_id.into(),
fork_sync_operation_id,
project: project.into(),
include_links: None,
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitRepositoryRefList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitRepositoryRefList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_name_or_id: String,
pub(crate) collection_id: String,
pub(crate) project: String,
pub(crate) include_links: Option<bool>,
}
impl RequestBuilder {
#[doc = "Set to true to include links."]
pub fn include_links(mut self, include_links: bool) -> Self {
self.include_links = Some(include_links);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/forks/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_name_or_id,
&this.collection_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(include_links) = &this.include_links {
req.url_mut()
.query_pairs_mut()
.append_pair("includeLinks", &include_links.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitRepositoryRefList>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitRepositoryRefList>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_fork_sync_requests {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitForkSyncRequestList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitForkSyncRequestList =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_name_or_id: String,
pub(crate) project: String,
pub(crate) include_abandoned: Option<bool>,
pub(crate) include_links: Option<bool>,
}
impl RequestBuilder {
#[doc = "Set to true to include abandoned requests."]
pub fn include_abandoned(mut self, include_abandoned: bool) -> Self {
self.include_abandoned = Some(include_abandoned);
self
}
#[doc = "Set to true to include links."]
pub fn include_links(mut self, include_links: bool) -> Self {
self.include_links = Some(include_links);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/forkSyncRequests",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_name_or_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(include_abandoned) = &this.include_abandoned {
req.url_mut()
.query_pairs_mut()
.append_pair("includeAbandoned", &include_abandoned.to_string());
}
if let Some(include_links) = &this.include_links {
req.url_mut()
.query_pairs_mut()
.append_pair("includeLinks", &include_links.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitForkSyncRequestList>;
type IntoFuture = futures::future::BoxFuture<
'static,
azure_core::Result<models::GitForkSyncRequestList>,
>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_fork_sync_request {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitForkSyncRequest> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitForkSyncRequest =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitForkSyncRequestParameters,
pub(crate) repository_name_or_id: String,
pub(crate) project: String,
pub(crate) include_links: Option<bool>,
}
impl RequestBuilder {
#[doc = "Set to true to include links"]
pub fn include_links(mut self, include_links: bool) -> Self {
self.include_links = Some(include_links);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/forkSyncRequests",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_name_or_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
if let Some(include_links) = &this.include_links {
req.url_mut()
.query_pairs_mut()
.append_pair("includeLinks", &include_links.to_string());
}
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitForkSyncRequest>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitForkSyncRequest>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_fork_sync_request {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitForkSyncRequest> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitForkSyncRequest =
serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) repository_name_or_id: String,
pub(crate) fork_sync_operation_id: i32,
pub(crate) project: String,
pub(crate) include_links: Option<bool>,
}
impl RequestBuilder {
#[doc = "Set to true to include links."]
pub fn include_links(mut self, include_links: bool) -> Self {
self.include_links = Some(include_links);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/forkSyncRequests/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_name_or_id,
&this.fork_sync_operation_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(include_links) = &this.include_links {
req.url_mut()
.query_pairs_mut()
.append_pair("includeLinks", &include_links.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitForkSyncRequest>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitForkSyncRequest>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod merges {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Request a git merge operation. Currently we support merging only 2 commits."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Parents commitIds and merge commit messsage."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `repository_name_or_id`: The name or ID of the repository."]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::GitMergeParameters>,
project: impl Into<String>,
repository_name_or_id: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
repository_name_or_id: repository_name_or_id.into(),
include_links: None,
}
}
#[doc = "Get a specific merge operation's details."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `repository_name_or_id`: The name or ID of the repository."]
#[doc = "* `merge_operation_id`: OperationId of the merge request."]
pub fn get(
&self,
organization: impl Into<String>,
project: impl Into<String>,
repository_name_or_id: impl Into<String>,
merge_operation_id: i32,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
repository_name_or_id: repository_name_or_id.into(),
merge_operation_id,
include_links: None,
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitMerge> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitMerge = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::GitMergeParameters,
pub(crate) project: String,
pub(crate) repository_name_or_id: String,
pub(crate) include_links: Option<bool>,
}
impl RequestBuilder {
#[doc = "Set to true to include links"]
pub fn include_links(mut self, include_links: bool) -> Self {
self.include_links = Some(include_links);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/merges",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_name_or_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
if let Some(include_links) = &this.include_links {
req.url_mut()
.query_pairs_mut()
.append_pair("includeLinks", &include_links.to_string());
}
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitMerge>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitMerge>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GitMerge> {
let bytes = self.0.into_body().collect().await?;
let body: models::GitMerge = serde_json::from_slice(&bytes).map_err(|e| {
azure_core::error::Error::full(
azure_core::error::ErrorKind::DataConversion,
e,
format!(
"Failed to deserialize response:\n{}",
String::from_utf8_lossy(&bytes)
),
)
})?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" The building of a request is typically finalized by invoking `.await` on"]
#[doc = r" `RequestBuilder`. This implicitly invokes the [`IntoFuture::into_future()`](#method.into_future)"]
#[doc = r" method, which converts `RequestBuilder` into a future that executes the request"]
#[doc = r" operation and returns a `Result` with the parsed response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details (e.g. to inspect"]
#[doc = r" response headers or raw body data) then you can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future that resolves to a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) project: String,
pub(crate) repository_name_or_id: String,
pub(crate) merge_operation_id: i32,
pub(crate) include_links: Option<bool>,
}
impl RequestBuilder {
#[doc = "Set to true to include links"]
pub fn include_links(mut self, include_links: bool) -> Self {
self.include_links = Some(include_links);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/{}/_apis/git/repositories/{}/merges/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.repository_name_or_id,
&this.merge_operation_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes)
.await?
{
req.insert_header(azure_core::headers::AUTHORIZATION, auth_header);
}
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "7.1-preview");
if let Some(include_links) = &this.include_links {
req.url_mut()
.query_pairs_mut()
.append_pair("includeLinks", &include_links.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GitMerge>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::GitMerge>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}