use std::{error::Error, fs::File};
use reqwest::Client;
use crate::{
api::file::File as BaserowFile,
error::{FileUploadError, TokenAuthError},
BaserowTable, Configuration, TableField,
};
#[async_trait::async_trait]
pub trait BaserowClient {
async fn token_auth(&self) -> Result<Box<dyn BaserowClient>, TokenAuthError>;
async fn table_fields(&self, table_id: u64) -> Result<Vec<TableField>, Box<dyn Error>>;
fn table_by_id(&self, id: u64) -> BaserowTable;
async fn upload_file(
&self,
file: File,
filename: String,
) -> Result<BaserowFile, FileUploadError>;
async fn upload_file_via_url(&self, url: &str) -> Result<BaserowFile, FileUploadError>;
fn get_configuration(&self) -> Configuration;
fn get_client(&self) -> Client;
}