-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtoken.rs
More file actions
25 lines (23 loc) · 804 Bytes
/
token.rs
File metadata and controls
25 lines (23 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use crate::client::AuthenticatedOpenPaymentsClient;
use crate::request::AuthenticatedRequest;
use crate::types::AccessTokenResponse;
use crate::Result;
use reqwest::Method;
pub(crate) async fn rotate_access_token(
client: &AuthenticatedOpenPaymentsClient,
token_manage_url: &str,
access_token: Option<&str>,
) -> Result<AccessTokenResponse> {
AuthenticatedRequest::new(client, Method::POST, token_manage_url.to_string())
.build_and_execute(access_token)
.await
}
pub(crate) async fn revoke_access_token(
client: &AuthenticatedOpenPaymentsClient,
token_manage_url: &str,
access_token: Option<&str>,
) -> Result<()> {
AuthenticatedRequest::new(client, Method::DELETE, token_manage_url.to_string())
.build_and_execute(access_token)
.await
}