open-payments 0.1.2

Open Payments Rust SDK library with types, HTTP client and signature utilities
Documentation
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
}