pub struct Profile {
pub client: Client,
}requests only.Fields§
§client: ClientImplementations§
Source§impl Profile
impl Profile
Sourcepub async fn retrieve<'a>(&'a self) -> Result<Profile, Error>
pub async fn retrieve<'a>(&'a self) -> Result<Profile, Error>
Perform a GET request to /api/profile/.
User profile view, only available when logged in
async fn example_profile_retrieve() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: paperless_api_client::types::Profile = client.profile().retrieve().await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn partial_update<'a>(
&'a self,
body: &PatchedProfileRequest,
) -> Result<Profile, Error>
pub async fn partial_update<'a>( &'a self, body: &PatchedProfileRequest, ) -> Result<Profile, Error>
Perform a PATCH request to /api/profile/.
User profile view, only available when logged in
async fn example_profile_partial_update() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: paperless_api_client::types::Profile = client
.profile()
.partial_update(&paperless_api_client::types::PatchedProfileRequest {
email: Some("email@example.com".to_string()),
password: Some("some-string".to_string()),
first_name: Some("some-string".to_string()),
last_name: Some("some-string".to_string()),
})
.await?;
println!("{:?}", result);
Ok(())
}Perform a POST request to /api/profile/disconnect_social_account/.
Disconnects a social account provider from the user account
async fn example_profile_disconnect_social_account_create() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: i64 = client
.profile()
.disconnect_social_account_create(
&paperless_api_client::types::ProfileDisconnectSocialAccountCreateRequestBody { id: 4 as i64 },
)
.await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn generate_auth_token_create<'a>(&'a self) -> Result<String, Error>
pub async fn generate_auth_token_create<'a>(&'a self) -> Result<String, Error>
Perform a POST request to /api/profile/generate_auth_token/.
Generates (or re-generates) an auth token, requires a logged in user unlike the default DRF endpoint
async fn example_profile_generate_auth_token_create() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: String = client.profile().generate_auth_token_create().await?;
println!("{:?}", result);
Ok(())
}Perform a GET request to /api/profile/social_account_providers/.
List of social account providers
async fn example_profile_social_account_providers_retrieve() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: std::collections::HashMap<String, serde_json::Value> =
client.profile().social_account_providers_retrieve().await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn totp_retrieve<'a>(
&'a self,
) -> Result<HashMap<String, Value>, Error>
pub async fn totp_retrieve<'a>( &'a self, ) -> Result<HashMap<String, Value>, Error>
Perform a GET request to /api/profile/totp/.
Generates a new TOTP secret and returns the URL and SVG
async fn example_profile_totp_retrieve() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: std::collections::HashMap<String, serde_json::Value> =
client.profile().totp_retrieve().await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn totp_create<'a>(
&'a self,
body: &ProfileTotpCreateRequestBody,
) -> Result<HashMap<String, Value>, Error>
pub async fn totp_create<'a>( &'a self, body: &ProfileTotpCreateRequestBody, ) -> Result<HashMap<String, Value>, Error>
Perform a POST request to /api/profile/totp/.
Validates a TOTP code and activates the TOTP authenticator
async fn example_profile_totp_create() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: std::collections::HashMap<String, serde_json::Value> = client
.profile()
.totp_create(&paperless_api_client::types::ProfileTotpCreateRequestBody {
secret: "some-string".to_string(),
code: "some-string".to_string(),
})
.await?;
println!("{:?}", result);
Ok(())
}Sourcepub async fn totp_destroy<'a>(&'a self) -> Result<bool, Error>
pub async fn totp_destroy<'a>(&'a self) -> Result<bool, Error>
Perform a DELETE request to /api/profile/totp/.
Deactivates the TOTP authenticator
async fn example_profile_totp_destroy() -> anyhow::Result<()> {
let client = paperless_api_client::Client::new_from_env();
let result: bool = client.profile().totp_destroy().await?;
println!("{:?}", result);
Ok(())
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Profile
impl !RefUnwindSafe for Profile
impl Send for Profile
impl Sync for Profile
impl Unpin for Profile
impl !UnwindSafe for Profile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more