Skip to content

Commit

Permalink
add token verify endpoint (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabbifish authored Nov 8, 2019
1 parent 54864a3 commit 5cc2d9f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/endpoints/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,25 @@ impl<'a> Endpoint<UserDetails, (), ()> for GetUserDetails {
"user".to_string()
}
}

/// Validate User Token
/// Returns whether a given token is valid or not.
/// https://blog.cloudflare.com/api-tokens-general-availability/
///
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
pub struct UserTokenStatus {
pub id: String,
pub status: String,
}
impl ApiResult for UserTokenStatus {}

pub struct GetUserTokenStatus {}

impl<'a> Endpoint<UserTokenStatus, (), ()> for GetUserTokenStatus {
fn method(&self) -> Method {
Method::Get
}
fn path(&self) -> String {
"user/tokens/verify".to_string()
}
}

0 comments on commit 5cc2d9f

Please sign in to comment.