use crate::{universals::HttpMethod, SupabaseClient};
impl SupabaseClient {
pub async fn rpc_call(
&self,
rpc_name: &str,
args: serde_json::Value, ) -> Result<Vec<serde_json::Value>, String> {
let path = format!("/rest/v1/rpc/{}", rpc_name);
let response = self
.request(&path, HttpMethod::Post, Some(args), false)
.await?;
let arr = response
.as_array()
.ok_or_else(|| "Expected JSON array from RPC".to_string())?;
Ok(arr.clone())
}
}