Class: HubSpotSDK::Resources::Files::Folders

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/files/folders.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Folders

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Folders.

Parameters:



241
242
243
# File 'lib/hubspot_sdk/resources/files/folders.rb', line 241

def initialize(client:)
  @client = client
end

Instance Method Details

#delete_by_id(folder_id, request_options: {}) ⇒ nil

Delete folder by ID.

Parameters:

Returns:

  • (nil)

See Also:



17
18
19
20
21
22
23
24
# File 'lib/hubspot_sdk/resources/files/folders.rb', line 17

def delete_by_id(folder_id, params = {})
  @client.request(
    method: :delete,
    path: ["files/2026-03/folders/%1$s", folder_id],
    model: NilClass,
    options: params[:request_options]
  )
end

#delete_by_path(folder_path, request_options: {}) ⇒ nil

Delete a folder, identified by its path.

Parameters:

Returns:

  • (nil)

See Also:



36
37
38
39
40
41
42
43
# File 'lib/hubspot_sdk/resources/files/folders.rb', line 36

def delete_by_path(folder_path, params = {})
  @client.request(
    method: :delete,
    path: ["files/2026-03/folders/%1$s", folder_path],
    model: NilClass,
    options: params[:request_options]
  )
end

#get_by_id(folder_id, properties: nil, request_options: {}) ⇒ HubSpotSDK::Models::Files::Folder

Retrieve a folder by its ID.

Parameters:

Returns:

See Also:



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/hubspot_sdk/resources/files/folders.rb', line 56

def get_by_id(folder_id, params = {})
  parsed, options = HubSpotSDK::Files::FolderGetByIDParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["files/2026-03/folders/%1$s", folder_id],
    query: query,
    model: HubSpotSDK::Files::Folder,
    options: options
  )
end

#get_by_path(folder_path, properties: nil, request_options: {}) ⇒ HubSpotSDK::Models::Files::Folder

Retrieve a folder, identified by its path.

Parameters:

Returns:

See Also:



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/hubspot_sdk/resources/files/folders.rb', line 79

def get_by_path(folder_path, params = {})
  parsed, options = HubSpotSDK::Files::FolderGetByPathParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["files/2026-03/folders/%1$s", folder_path],
    query: query,
    model: HubSpotSDK::Files::Folder,
    options: options
  )
end

#get_update_async_status(task_id, request_options: {}) ⇒ HubSpotSDK::Models::Files::FolderActionResponse

Check status of folder update. Folder updates happen asynchronously.

Parameters:

Returns:

See Also:



101
102
103
104
105
106
107
108
# File 'lib/hubspot_sdk/resources/files/folders.rb', line 101

def get_update_async_status(task_id, params = {})
  @client.request(
    method: :get,
    path: ["files/2026-03/folders/update/async/tasks/%1$s/status", task_id],
    model: HubSpotSDK::Files::FolderActionResponse,
    options: params[:request_options]
  )
end

#search(after: nil, before: nil, created_at: nil, created_at_gte: nil, created_at_lte: nil, id_gte: nil, id_lte: nil, ids: nil, limit: nil, name: nil, parent_folder_ids: nil, path: nil, properties: nil, sort: nil, updated_at: nil, updated_at_gte: nil, updated_at_lte: nil, request_options: {}) ⇒ HubSpotSDK::Internal::Page<HubSpotSDK::Models::Files::Folder>

Some parameter documentations has been truncated, see Models::Files::FolderSearchParams for more details.

Search for folders. Does not contain hidden or archived folders.

Parameters:

  • after (String)

    The paging cursor token of the last successfully read resource will be returned

  • before (String)
  • created_at (Time)
  • created_at_gte (Time)
  • created_at_lte (Time)
  • id_gte (Integer)
  • id_lte (Integer)
  • ids (Array<Integer>)
  • limit (Integer)

    The maximum number of results to display per page.

  • name (String)
  • parent_folder_ids (Array<Integer>)
  • path (String)
  • properties (Array<String>)
  • sort (Array<String>)
  • updated_at (Time)
  • updated_at_gte (Time)
  • updated_at_lte (Time)
  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/hubspot_sdk/resources/files/folders.rb', line 156

def search(params = {})
  parsed, options = HubSpotSDK::Files::FolderSearchParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "files/2026-03/folders/search",
    query: query.transform_keys(
      created_at: "createdAt",
      created_at_gte: "createdAtGte",
      created_at_lte: "createdAtLte",
      id_gte: "idGte",
      id_lte: "idLte",
      parent_folder_ids: "parentFolderIds",
      updated_at: "updatedAt",
      updated_at_gte: "updatedAtGte",
      updated_at_lte: "updatedAtLte"
    ),
    page: HubSpotSDK::Internal::Page,
    model: HubSpotSDK::Files::Folder,
    options: options
  )
end

#update_async_by_id(id:, name: nil, parent_folder_id: nil, request_options: {}) ⇒ HubSpotSDK::Models::Files::FolderUpdateTaskLocator

Some parameter documentations has been truncated, see Models::Files::FolderUpdateAsyncByIDParams for more details.

Update properties of folder by given ID. This action happens asynchronously and will update all of the folder’s children as well.

Parameters:

  • id (String)

    The unique identifier of the folder to be updated.

  • name (String)

    New name. If specified the folder’s name and fullPath will change. All children

  • parent_folder_id (Integer)

    New parent folderId. If changed, the folder and all it’s children will be moved

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



198
199
200
201
202
203
204
205
206
207
# File 'lib/hubspot_sdk/resources/files/folders.rb', line 198

def update_async_by_id(params)
  parsed, options = HubSpotSDK::Files::FolderUpdateAsyncByIDParams.dump_request(params)
  @client.request(
    method: :post,
    path: "files/2026-03/folders/update/async",
    body: parsed,
    model: HubSpotSDK::Files::FolderUpdateTaskLocator,
    options: options
  )
end

#update_by_id(folder_id, name: nil, parent_folder_id: nil, request_options: {}) ⇒ HubSpotSDK::Models::Files::Folder

Some parameter documentations has been truncated, see Models::Files::FolderUpdateByIDParams for more details.

Update a folder’s properties, identified by folder ID.

Parameters:

  • folder_id (String)
  • name (String)

    New name. If specified the folder’s name and fullPath will change. All children

  • parent_folder_id (Integer)

    New parent folderId. If changed, the folder and all it’s children will be moved

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



227
228
229
230
231
232
233
234
235
236
# File 'lib/hubspot_sdk/resources/files/folders.rb', line 227

def update_by_id(folder_id, params = {})
  parsed, options = HubSpotSDK::Files::FolderUpdateByIDParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["files/2026-03/folders/%1$s", folder_id],
    body: parsed,
    model: HubSpotSDK::Files::Folder,
    options: options
  )
end