Skip to content

Commit

Permalink
feat: added SetPublishedUpload
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan-Nava authored Nov 14, 2023
1 parent 0f7380f commit 869f214
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
26 changes: 26 additions & 0 deletions compress/api_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,30 @@ func (o *compress) GetJobidProgress(requestBody jobidProgressRequest) (*VideoUpl
return nil, err
}
return &obj, nil
}
/**
* jobid is compulsory
* example: set_published_upload(1000)
* @param {string} api_key
* @param {number} jobid
*/
func (o *compress) SetPublishedUpload(requestBody publishedUploadRequest) (*VideoUploadInfo , error) {
//
if errs := validator.Validate(requestBody); errs != nil {
// values not valid, deal with errors here
return nil, errs
}
resp, err := o.restyPost(SET_PUBLISHED_UPLOAD(requestBody.JobId), requestBody)
if err != nil {
return nil, err
}
o.debugPrint(resp)
if resp.IsError() {
return nil, fmt.Errorf("")
}
var obj VideoUploadInfo
if err := json.Unmarshal(resp.Body(), &obj); err != nil {
return nil, err
}
return &obj, nil
}
1 change: 1 addition & 0 deletions compress/compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type ICompress interface {
GetUploads(uploadsPaginated UploadsPaginated) ([]VideoUploadInfo, error)
GetSingleUpload(requestBody jobidProgressRequest) (*VideoUploadInfo , error)
GetJobidProgress(requestBody jobidProgressRequest) (*VideoUploadInfo , error)
SetPublishedUpload(requestBody publishedUploadRequest) (*VideoUploadInfo , error)
GetCategories(requestBody categoriesRequest) ([]Category, error)
CreateCategory( requestBody createCategoryRequest ) (*Category, error)
//
Expand Down
5 changes: 4 additions & 1 deletion compress/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ var (
return TNGRM_BASE_URL+UPLOADS+"/jobid"
}
GET_JOBID_PROGRESS = func(jobId int) string {
return TNGRM_BASE_URL+UPLOADS+"job_progress/jobid"
return TNGRM_BASE_URL+UPLOADS+"/job_progress/jobid"
}
SET_PUBLISHED_UPLOAD = func(jobId int) string {
return TNGRM_BASE_URL+UPLOADS+"/set_published"
}
//
)
6 changes: 6 additions & 0 deletions compress/model_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,10 @@ type VideoUploadInfo struct {
type jobidProgressRequest struct {
BaseModel
JobId int `json:"job_id" validate:"nonzero,min=1" required:"true"`
}

type publishedUploadRequest struct {
BaseModel
JobId int `json:"job_id" validate:"nonzero,min=1" required:"true"`
Published int `json:"published" required:"true"`
}

0 comments on commit 869f214

Please sign in to comment.