Class: HighLevel::Resources::Medias

Inherits:
Base
  • Object
show all
Defined in:
lib/high_level/resources/medias.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from HighLevel::Resources::Base

Instance Method Details

#bulk_delete_media_objects(body:, **_opts) ⇒ Object

Bulk Delete / Trash Files or Folders

Soft-deletes or trashes multiple files and folders in a single request



84
85
86
87
88
89
90
91
# File 'lib/high_level/resources/medias.rb', line 84

def bulk_delete_media_objects(body:, **_opts)
  request(
    method: :put,
    path: "/medias/delete-files",
    security: ["Location-Access"],
    body: body
  )
end

#bulk_update_media_objects(body:, **_opts) ⇒ Object

Bulk Update Files/ Folders

Updates metadata or status of multiple files and folders



72
73
74
75
76
77
78
79
# File 'lib/high_level/resources/medias.rb', line 72

def bulk_update_media_objects(body:, **_opts)
  request(
    method: :put,
    path: "/medias/update-files",
    security: ["Location-Access"],
    body: body
  )
end

#create_media_folder(body:, **_opts) ⇒ Object

Create Folder

Creates a new folder in the media storage



60
61
62
63
64
65
66
67
# File 'lib/high_level/resources/medias.rb', line 60

def create_media_folder(body:, **_opts)
  request(
    method: :post,
    path: "/medias/folder",
    security: ["Location-Access"],
    body: body
  )
end

#delete_media_content(id:, alt_type: nil, alt_id: nil, **_opts) ⇒ Object

Delete File or Folder

Deletes specific file or folder from the media storage



48
49
50
51
52
53
54
55
# File 'lib/high_level/resources/medias.rb', line 48

def delete_media_content(id:, alt_type: nil, alt_id: nil, **_opts)
  request(
    method: :delete,
    path: "/medias/#{id}",
    security: ["Location-Access"],
    params: { "altType" => alt_type, "altId" => alt_id }.compact
  )
end

#fetch_media_content(offset: nil, limit: nil, sort_by: nil, sort_order: nil, type: nil, query: nil, alt_type: nil, alt_id: nil, parent_id: nil, fetch_all: nil, **_opts) ⇒ Object

Get List of Files/ Folders

Fetches list of files and folders from the media storage



12
13
14
15
16
17
18
19
# File 'lib/high_level/resources/medias.rb', line 12

def fetch_media_content(offset: nil, limit: nil, sort_by: nil, sort_order: nil, type: nil, query: nil, alt_type: nil, alt_id: nil, parent_id: nil, fetch_all: nil, **_opts)
  request(
    method: :get,
    path: "/medias/files",
    security: ["Location-Access"],
    params: { "offset" => offset, "limit" => limit, "sortBy" => sort_by, "sortOrder" => sort_order, "type" => type, "query" => query, "altType" => alt_type, "altId" => alt_id, "parentId" => parent_id, "fetchAll" => fetch_all }.compact
  )
end

#update_media_object(id:, body:, **_opts) ⇒ Object

Update File/ Folder

Updates a single file or folder by ID



36
37
38
39
40
41
42
43
# File 'lib/high_level/resources/medias.rb', line 36

def update_media_object(id:, body:, **_opts)
  request(
    method: :post,
    path: "/medias/#{id}",
    security: ["Location-Access"],
    body: body
  )
end

#upload_media_content(body:, **_opts) ⇒ Object

Upload File into Media Storage

If hosted is set to true then fileUrl is required. Else file is required. If adding a file, maximum allowed is 25 MB



24
25
26
27
28
29
30
31
# File 'lib/high_level/resources/medias.rb', line 24

def upload_media_content(body:, **_opts)
  request(
    method: :post,
    path: "/medias/upload-file",
    security: ["Location-Access"],
    body: body
  )
end