feat: async upload of medias

This commit is contained in:
VC
2023-11-15 14:32:23 +01:00
parent 00ba8bda42
commit b73d6340c9
5 changed files with 90 additions and 50 deletions

View File

@@ -104,7 +104,7 @@ pub async fn upload_simple_media(
config: &TwitterConfig,
u: &str,
d: &Option<String>,
) -> Result<u64, Box<dyn Error>> {
) -> Result<u64, Box<dyn Error + Send + Sync>> {
// initiate request parameters
let empty_request = EmptyRequest {}; // Why? Because fuck you, thats why!
let token = get_token(config);
@@ -152,7 +152,11 @@ pub async fn upload_simple_media(
}
/// This function updates the metadata given the current media_id and token
async fn metadata_create(config: &TwitterConfig, id: u64, m: &str) -> Result<(), Box<dyn Error>> {
async fn metadata_create(
config: &TwitterConfig,
id: u64,
m: &str,
) -> Result<(), Box<dyn Error + Send + Sync>> {
let token = get_token(config);
let empty_request = EmptyRequest {};
@@ -191,7 +195,7 @@ pub async fn upload_chunk_media(
config: &TwitterConfig,
u: &str,
t: &str,
) -> Result<u64, Box<dyn Error>> {
) -> Result<u64, Box<dyn Error + Send + Sync>> {
let empty_request = EmptyRequest {};
let token = get_token(config);