mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-23 05:02:17 +00:00
feat: Add comprehensive API client modules and JWT authentication to Rust SDK
- Add hmac, sha2, and base64 dependencies to Cargo.toml for JWT support - Add README.md with installation instructions, architecture overview, and API examples for all SDK modules - Add AuthProvider class with API key and JWT token support (generate_jwt_token, validate_jwt_token, get_headers, clear_token_cache methods) - Add HTTPClient base class with retry logic, error handling, and timeout management - Add SubscriberAPI module
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
use crate::client::HTTPClient;
|
||||
use crate::error::TelecomError;
|
||||
use crate::types::GraphQLRequest;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub struct GraphQLAPI {
|
||||
client: HTTPClient,
|
||||
}
|
||||
|
||||
impl GraphQLAPI {
|
||||
pub fn new(client: HTTPClient) -> Self {
|
||||
Self { client }
|
||||
}
|
||||
|
||||
pub async fn execute(
|
||||
&self,
|
||||
query: String,
|
||||
variables: Option<HashMap<String, serde_json::Value>>,
|
||||
) -> Result<HashMap<String, serde_json::Value>, TelecomError> {
|
||||
let req = GraphQLRequest { query, variables };
|
||||
self.client.post("/graphql", Some(&req)).await
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user