From efcf716cb73ab07bf5f0f80f2579a30b32c67c15 Mon Sep 17 00:00:00 2001 From: Allan Nava Date: Thu, 16 Nov 2023 16:13:24 +0100 Subject: [PATCH] solve categories and upload --- compress/api_category.go | 5 ++++- compress/api_upload.go | 14 +++++++++++--- compress/compress.go | 4 ++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/compress/api_category.go b/compress/api_category.go index 2411e30..f547ee9 100644 --- a/compress/api_category.go +++ b/compress/api_category.go @@ -12,7 +12,10 @@ import ( * @returns list of categories of the customer */ -func (o *compress) GetCategories(requestBody categoriesRequest) ([]Category, error) { +func (o *compress) GetCategories() ([]Category, error) { + requestBody := &categoriesRequest{ + BaseModel: BaseModel{ClientId: o.GetCliendId(), ApiKey: o.apiKey}, + } // if errs := validator.Validate(requestBody); errs != nil { // values not valid, deal with errors here diff --git a/compress/api_upload.go b/compress/api_upload.go index 414cbda..235630e 100644 --- a/compress/api_upload.go +++ b/compress/api_upload.go @@ -52,7 +52,7 @@ func (o *compress) GetUploads(uploadsPaginated UploadsPaginated) ([]VideoUploadI */ func (o *compress) GetSingleUpload( jobid int ) (*VideoUploadInfo, error) { - requestBody := jobidProgressRequest{ + requestBody := &jobidProgressRequest{ BaseModel: BaseModel{ClientId: o.GetCliendId(), ApiKey: o.apiKey}, JobId: jobid, } @@ -81,7 +81,7 @@ func (o *compress) GetSingleUpload( jobid int ) (*VideoUploadInfo, error) { * @returns progressStateResponse */ func (o *compress) GetJobidProgress( jobid int ) (*VideoUploadInfo, error) { - requestBody := jobidProgressRequest{ + requestBody := &jobidProgressRequest{ BaseModel: BaseModel{ClientId: o.GetCliendId(), ApiKey: o.apiKey}, JobId: jobid, } @@ -111,7 +111,15 @@ func (o *compress) GetJobidProgress( jobid int ) (*VideoUploadInfo, error) { * @param {string} api_key * @param {number} jobid */ -func (o *compress) SetPublishedUpload(requestBody publishedUploadRequest) (*VideoUploadInfo, error) { +func (o *compress) SetPublishedUpload( jobid, published int ) (*VideoUploadInfo, error) { + if published > 1 && published < 0{ + return fmt.Errorf("published need to be 0 or 1") + } + requestBody := &publishedUploadRequest{ + BaseModel: BaseModel{ClientId: o.GetCliendId(), ApiKey: o.apiKey}, + JobId: jobid, + Published: published + } // if errs := validator.Validate(requestBody); errs != nil { // values not valid, deal with errors here diff --git a/compress/compress.go b/compress/compress.go index 0dde1ff..08a3829 100644 --- a/compress/compress.go +++ b/compress/compress.go @@ -14,9 +14,9 @@ type ICompress interface { GetUploads(uploadsPaginated UploadsPaginated) ([]VideoUploadInfo, error) // need to change it with args GetSingleUpload( jobid int ) (*VideoUploadInfo, error) GetJobidProgress( jobid int ) (*VideoUploadInfo, error) - SetPublishedUpload(requestBody publishedUploadRequest) (*VideoUploadInfo, error) + SetPublishedUpload( jobid, published int ) (*VideoUploadInfo, error) UploadS3(destinationFolder string, filename string) error - GetCategories(requestBody categoriesRequest) ([]Category, error) + GetCategories() ([]Category, error) CreateCategory(requestBody createCategoryRequest) (*Category, error) GetRestreamers( startFrom, amount int ) ([]Restreamer, error) GetSingleRestreamer( instanceName string ) (*Restreamer, error)