#![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![format!("{}/", endpoint)]);
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 attachments_client(&self) -> attachments::Client {
attachments::Client(self.clone())
}
pub fn page_moves_client(&self) -> page_moves::Client {
page_moves::Client(self.clone())
}
pub fn page_stats_client(&self) -> page_stats::Client {
page_stats::Client(self.clone())
}
pub fn pages_client(&self) -> pages::Client {
pages::Client(self.clone())
}
pub fn pages_batch_client(&self) -> pages_batch::Client {
pages_batch::Client(self.clone())
}
pub fn wikis_client(&self) -> wikis::Client {
wikis::Client(self.clone())
}
}
pub mod wikis {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all wikis in a project or collection."]
#[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(),
}
}
#[doc = "Creates the wiki resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Parameters for the wiki creation."]
#[doc = "* `project`: Project ID or project name"]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::WikiCreateParametersV2>,
project: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
}
}
#[doc = "Gets the wiki corresponding to the wiki ID or wiki name provided."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `wiki_identifier`: Wiki ID or wiki name."]
#[doc = "* `project`: Project ID or project name"]
pub fn get(
&self,
organization: impl Into<String>,
wiki_identifier: impl Into<String>,
project: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
wiki_identifier: wiki_identifier.into(),
project: project.into(),
}
}
#[doc = "Updates the wiki corresponding to the wiki ID or wiki name provided using the update parameters."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Update parameters."]
#[doc = "* `wiki_identifier`: Wiki ID or wiki name."]
#[doc = "* `project`: Project ID or project name"]
pub fn update(
&self,
organization: impl Into<String>,
body: impl Into<models::WikiUpdateParameters>,
wiki_identifier: impl Into<String>,
project: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
wiki_identifier: wiki_identifier.into(),
project: project.into(),
}
}
#[doc = "Deletes the wiki corresponding to the wiki ID or wiki name provided."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `wiki_identifier`: Wiki ID or wiki name."]
#[doc = "* `project`: Project ID or project name"]
pub fn delete(
&self,
organization: impl Into<String>,
wiki_identifier: impl Into<String>,
project: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
wiki_identifier: wiki_identifier.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::WikiV2List> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiV2List = 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/wiki/wikis",
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::WikiV2List>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiV2List>>;
#[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::WikiV2> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiV2 = 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::WikiCreateParametersV2,
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/wiki/wikis",
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::WikiV2>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiV2>>;
#[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::WikiV2> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiV2 = 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) wiki_identifier: 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/wiki/wikis/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.wiki_identifier
))?;
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::WikiV2>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiV2>>;
#[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::WikiV2> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiV2 = 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::WikiUpdateParameters,
pub(crate) wiki_identifier: 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/wiki/wikis/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.wiki_identifier
))?;
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::WikiV2>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiV2>>;
#[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);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WikiV2> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiV2 = 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) wiki_identifier: 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/wiki/wikis/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.wiki_identifier
))?;
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<models::WikiV2>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiV2>>;
#[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 attachments {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Creates an attachment in the wiki."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Stream to upload"]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `wiki_identifier`: Wiki ID or wiki name."]
#[doc = "* `name`: Wiki attachment name."]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<String>,
project: impl Into<String>,
wiki_identifier: impl Into<String>,
name: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
wiki_identifier: wiki_identifier.into(),
name: name.into(),
version_descriptor_version: None,
version_descriptor_version_options: None,
version_descriptor_version_type: 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::WikiAttachment> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiAttachment = 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 e_tag(&self) -> azure_core::Result<&str> {
self.0
.get_str(&azure_core::headers::HeaderName::from_static("etag"))
}
}
#[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) project: String,
pub(crate) wiki_identifier: String,
pub(crate) name: 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 = "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/wiki/wikis/{}/attachments",
this.client.endpoint(),
&this.organization,
&this.project,
&this.wiki_identifier
))?;
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/octet-stream");
let req_body = azure_core::to_json(&this.body)?;
let name = &this.name;
req.url_mut().query_pairs_mut().append_pair("name", name);
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,
);
}
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::WikiAttachment>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiAttachment>>;
#[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 page_moves {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Creates a page move operation that updates the path and order of the page as provided in the parameters."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Page more operation parameters."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `wiki_identifier`: Wiki ID or wiki name."]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::WikiPageMoveParameters>,
project: impl Into<String>,
wiki_identifier: impl Into<String>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
wiki_identifier: wiki_identifier.into(),
comment: None,
version_descriptor_version: None,
version_descriptor_version_options: None,
version_descriptor_version_type: 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::WikiPageMove> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiPageMove = 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 e_tag(&self) -> azure_core::Result<&str> {
self.0
.get_str(&azure_core::headers::HeaderName::from_static("etag"))
}
}
#[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::WikiPageMoveParameters,
pub(crate) project: String,
pub(crate) wiki_identifier: String,
pub(crate) comment: 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 = "Comment that is to be associated with this page move."]
pub fn comment(mut self, comment: impl Into<String>) -> Self {
self.comment = Some(comment.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/wiki/wikis/{}/pagemoves",
this.client.endpoint(),
&this.organization,
&this.project,
&this.wiki_identifier
))?;
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(comment) = &this.comment {
req.url_mut()
.query_pairs_mut()
.append_pair("comment", comment);
}
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,
);
}
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::WikiPageMove>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiPageMove>>;
#[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 pages {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets metadata or content of the wiki page for the provided path. Content negotiation is done based on the `Accept` header sent in the request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `wiki_identifier`: Wiki ID or wiki name."]
pub fn get_page(
&self,
organization: impl Into<String>,
project: impl Into<String>,
wiki_identifier: impl Into<String>,
) -> get_page::RequestBuilder {
get_page::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
wiki_identifier: wiki_identifier.into(),
path: None,
recursion_level: None,
version_descriptor_version: None,
version_descriptor_version_options: None,
version_descriptor_version_type: None,
include_content: None,
}
}
#[doc = "Creates or edits a wiki page."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Wiki create or update operation parameters."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `wiki_identifier`: Wiki ID or wiki name."]
#[doc = "* `path`: Wiki page path."]
#[doc = "* `if_match`: Version of the page on which the change is to be made. Mandatory for `Edit` scenario. To be populated in the If-Match header of the request."]
pub fn create_or_update(
&self,
organization: impl Into<String>,
body: impl Into<models::WikiPageCreateOrUpdateParameters>,
project: impl Into<String>,
wiki_identifier: impl Into<String>,
path: impl Into<String>,
if_match: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
wiki_identifier: wiki_identifier.into(),
path: path.into(),
if_match: if_match.into(),
comment: None,
version_descriptor_version: None,
version_descriptor_version_options: None,
version_descriptor_version_type: None,
}
}
#[doc = "Deletes a wiki page."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `wiki_identifier`: Wiki ID or wiki name."]
#[doc = "* `path`: Wiki page path."]
pub fn delete_page(
&self,
organization: impl Into<String>,
project: impl Into<String>,
wiki_identifier: impl Into<String>,
path: impl Into<String>,
) -> delete_page::RequestBuilder {
delete_page::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
wiki_identifier: wiki_identifier.into(),
path: path.into(),
comment: None,
version_descriptor_version: None,
version_descriptor_version_options: None,
version_descriptor_version_type: None,
}
}
#[doc = "Gets metadata or content of the wiki page for the provided page id. Content negotiation is done based on the `Accept` header sent in the request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `wiki_identifier`: Wiki ID or wiki name.."]
#[doc = "* `id`: Wiki page ID."]
pub fn get_page_by_id(
&self,
organization: impl Into<String>,
project: impl Into<String>,
wiki_identifier: impl Into<String>,
id: i32,
) -> get_page_by_id::RequestBuilder {
get_page_by_id::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
wiki_identifier: wiki_identifier.into(),
id,
recursion_level: None,
include_content: None,
}
}
#[doc = "Edits a wiki page."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Wiki update operation parameters."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `wiki_identifier`: Wiki ID or wiki name."]
#[doc = "* `id`: Wiki page ID."]
#[doc = "* `if_match`: Version of the page on which the change is to be made. Mandatory for `Edit` scenario. To be populated in the If-Match header of the request."]
pub fn update(
&self,
organization: impl Into<String>,
body: impl Into<models::WikiPageCreateOrUpdateParameters>,
project: impl Into<String>,
wiki_identifier: impl Into<String>,
id: i32,
if_match: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
wiki_identifier: wiki_identifier.into(),
id,
if_match: if_match.into(),
comment: None,
}
}
#[doc = "Deletes a wiki page."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `wiki_identifier`: Wiki ID or wiki name."]
#[doc = "* `id`: Wiki page ID."]
pub fn delete_page_by_id(
&self,
organization: impl Into<String>,
project: impl Into<String>,
wiki_identifier: impl Into<String>,
id: i32,
) -> delete_page_by_id::RequestBuilder {
delete_page_by_id::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
wiki_identifier: wiki_identifier.into(),
id,
comment: None,
}
}
}
pub mod get_page {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WikiPage> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiPage = 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 e_tag(&self) -> azure_core::Result<&str> {
self.0
.get_str(&azure_core::headers::HeaderName::from_static("etag"))
}
}
#[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) wiki_identifier: String,
pub(crate) path: Option<String>,
pub(crate) recursion_level: 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>,
}
impl RequestBuilder {
#[doc = "Wiki page path."]
pub fn path(mut self, path: impl Into<String>) -> Self {
self.path = Some(path.into());
self
}
#[doc = "Recursion level for subpages retrieval. Defaults to `None` (Optional)."]
pub fn recursion_level(mut self, recursion_level: impl Into<String>) -> Self {
self.recursion_level = Some(recursion_level.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 the content of the page in the response for Json content type. Defaults to false (Optional)"]
pub fn include_content(mut self, include_content: bool) -> Self {
self.include_content = Some(include_content);
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/wiki/wikis/{}/pages",
this.client.endpoint(),
&this.organization,
&this.project,
&this.wiki_identifier
))?;
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(path) = &this.path {
req.url_mut().query_pairs_mut().append_pair("path", path);
}
if let Some(recursion_level) = &this.recursion_level {
req.url_mut()
.query_pairs_mut()
.append_pair("recursionLevel", recursion_level);
}
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());
}
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::WikiPage>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiPage>>;
#[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_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WikiPage> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiPage = 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 e_tag(&self) -> azure_core::Result<&str> {
self.0
.get_str(&azure_core::headers::HeaderName::from_static("etag"))
}
}
#[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::WikiPageCreateOrUpdateParameters,
pub(crate) project: String,
pub(crate) wiki_identifier: String,
pub(crate) path: String,
pub(crate) if_match: String,
pub(crate) comment: 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 = "Comment to be associated with the page operation."]
pub fn comment(mut self, comment: impl Into<String>) -> Self {
self.comment = Some(comment.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/wiki/wikis/{}/pages",
this.client.endpoint(),
&this.organization,
&this.project,
&this.wiki_identifier
))?;
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)?;
let path = &this.path;
req.url_mut().query_pairs_mut().append_pair("path", path);
req.insert_header("if-match", &this.if_match);
if let Some(comment) = &this.comment {
req.url_mut()
.query_pairs_mut()
.append_pair("comment", comment);
}
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,
);
}
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::WikiPage>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiPage>>;
#[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_page {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WikiPage> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiPage = 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 e_tag(&self) -> azure_core::Result<&str> {
self.0
.get_str(&azure_core::headers::HeaderName::from_static("etag"))
}
}
#[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) wiki_identifier: String,
pub(crate) path: String,
pub(crate) comment: 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 = "Comment to be associated with this page delete."]
pub fn comment(mut self, comment: impl Into<String>) -> Self {
self.comment = Some(comment.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/wiki/wikis/{}/pages",
this.client.endpoint(),
&this.organization,
&this.project,
&this.wiki_identifier
))?;
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 path = &this.path;
req.url_mut().query_pairs_mut().append_pair("path", path);
if let Some(comment) = &this.comment {
req.url_mut()
.query_pairs_mut()
.append_pair("comment", comment);
}
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::WikiPage>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiPage>>;
#[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_page_by_id {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WikiPage> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiPage = 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 e_tag(&self) -> azure_core::Result<&str> {
self.0
.get_str(&azure_core::headers::HeaderName::from_static("etag"))
}
}
#[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) wiki_identifier: String,
pub(crate) id: i32,
pub(crate) recursion_level: Option<String>,
pub(crate) include_content: Option<bool>,
}
impl RequestBuilder {
#[doc = "Recursion level for subpages retrieval. Defaults to `None` (Optional)."]
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 the content of the page in the response for Json content type. Defaults to false (Optional)"]
pub fn include_content(mut self, include_content: bool) -> Self {
self.include_content = Some(include_content);
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/wiki/wikis/{}/pages/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.wiki_identifier,
&this.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(recursion_level) = &this.recursion_level {
req.url_mut()
.query_pairs_mut()
.append_pair("recursionLevel", recursion_level);
}
if let Some(include_content) = &this.include_content {
req.url_mut()
.query_pairs_mut()
.append_pair("includeContent", &include_content.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::WikiPage>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiPage>>;
#[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::WikiPage> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiPage = 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 e_tag(&self) -> azure_core::Result<&str> {
self.0
.get_str(&azure_core::headers::HeaderName::from_static("etag"))
}
}
#[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::WikiPageCreateOrUpdateParameters,
pub(crate) project: String,
pub(crate) wiki_identifier: String,
pub(crate) id: i32,
pub(crate) if_match: String,
pub(crate) comment: Option<String>,
}
impl RequestBuilder {
#[doc = "Comment to be associated with the page operation."]
pub fn comment(mut self, comment: impl Into<String>) -> Self {
self.comment = Some(comment.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/wiki/wikis/{}/pages/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.wiki_identifier,
&this.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.insert_header("if-match", &this.if_match);
if let Some(comment) = &this.comment {
req.url_mut()
.query_pairs_mut()
.append_pair("comment", comment);
}
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::WikiPage>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiPage>>;
#[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_page_by_id {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WikiPage> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiPage = 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 e_tag(&self) -> azure_core::Result<&str> {
self.0
.get_str(&azure_core::headers::HeaderName::from_static("etag"))
}
}
#[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) wiki_identifier: String,
pub(crate) id: i32,
pub(crate) comment: Option<String>,
}
impl RequestBuilder {
#[doc = "Comment to be associated with this page delete."]
pub fn comment(mut self, comment: impl Into<String>) -> Self {
self.comment = Some(comment.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/wiki/wikis/{}/pages/{}",
this.client.endpoint(),
&this.organization,
&this.project,
&this.wiki_identifier,
&this.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");
if let Some(comment) = &this.comment {
req.url_mut()
.query_pairs_mut()
.append_pair("comment", comment);
}
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::WikiPage>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiPage>>;
#[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 page_stats {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Returns page detail corresponding to Page ID."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `wiki_identifier`: Wiki ID or wiki name."]
#[doc = "* `page_id`: Wiki page ID."]
pub fn get(
&self,
organization: impl Into<String>,
project: impl Into<String>,
wiki_identifier: impl Into<String>,
page_id: i32,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
project: project.into(),
wiki_identifier: wiki_identifier.into(),
page_id,
page_views_for_days: 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::WikiPageDetail> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiPageDetail = 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) wiki_identifier: String,
pub(crate) page_id: i32,
pub(crate) page_views_for_days: Option<i32>,
}
impl RequestBuilder {
#[doc = "last N days from the current day for which page views is to be returned. It's inclusive of current day."]
pub fn page_views_for_days(mut self, page_views_for_days: i32) -> Self {
self.page_views_for_days = Some(page_views_for_days);
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/wiki/wikis/{}/pages/{}/stats",
this.client.endpoint(),
&this.organization,
&this.project,
&this.wiki_identifier,
&this.page_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(page_views_for_days) = &this.page_views_for_days {
req.url_mut()
.query_pairs_mut()
.append_pair("pageViewsForDays", &page_views_for_days.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::WikiPageDetail>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiPageDetail>>;
#[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 pages_batch {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Returns pageable list of Wiki Pages"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Wiki batch page request."]
#[doc = "* `project`: Project ID or project name"]
#[doc = "* `wiki_identifier`: Wiki ID or wiki name."]
pub fn get(
&self,
organization: impl Into<String>,
body: impl Into<models::WikiPagesBatchRequest>,
project: impl Into<String>,
wiki_identifier: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
project: project.into(),
wiki_identifier: wiki_identifier.into(),
version_descriptor_version: None,
version_descriptor_version_options: None,
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::WikiPageDetailList> {
let bytes = self.0.into_body().collect().await?;
let body: models::WikiPageDetailList =
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::WikiPagesBatchRequest,
pub(crate) project: String,
pub(crate) wiki_identifier: 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 = "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/wiki/wikis/{}/pagesbatch",
this.client.endpoint(),
&this.organization,
&this.project,
&this.wiki_identifier
))?;
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(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,
);
}
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::WikiPageDetailList>;
type IntoFuture =
futures::future::BoxFuture<'static, azure_core::Result<models::WikiPageDetailList>>;
#[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 })
}
}
}
}