From 63d600c540e07a3fed7a9c1c7a8bc19d49b57ba7 Mon Sep 17 00:00:00 2001 From: Allan Nava Date: Thu, 19 Oct 2023 11:30:15 +0200 Subject: [PATCH] feat: added new api --- src/compress/compress.py | 44 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/src/compress/compress.py b/src/compress/compress.py index b5ed4b1..2dfb214 100644 --- a/src/compress/compress.py +++ b/src/compress/compress.py @@ -25,8 +25,8 @@ import requests, json # from .constants import * -from builtins import isinstance -from typing import Dict, List +#from builtins import isinstance +#from typing import Dict, List # # class CompressClient: @@ -79,4 +79,44 @@ def get_categories(self): }) ) # + #/** + # * + # * @param {string} apikey + # * @param {string} customer + # * @returns list of categories of the customer + # */ + def create_category(self, category_name : str): + return self.req.post(TNGRM_BASE_URL + GET_CATEGORIES, + headers={ + "Content-Type": "application/json", + }, + body = json.dumps({ + "api_key": self.api_key, + "client_id": self.client_id, + "category_name": category_name + }) + ) + # + #/** + # * upload video to minio s3 bucket with a presigned PUT url + # * + # * videos will not be displayed in compress platform, + # * + # * this is just a plain upload to s3 storage + # * @param {string} destination_folder + # * @param {string} filename + # * @param {file} file + # */ + def upload_s3(self, destination_folder : str, filename : str, filename ): + file_dest = destination_folder + "/" + filename + r = self.req.post(TNGRM_BASE_URL + PRESIGNED_URL_S3, + headers={ + "Content-Type": "application/json", + }, + body = json.dumps({ + "customer": self.customer_name, + "filename": file_dest + }) + ) + # \ No newline at end of file