Class: DaytonaToolboxApiClient::FileSystemApi

Inherits:
Object
  • Object
show all
Defined in:
lib/daytona_toolbox_api_client/api/file_system_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FileSystemApi

Returns a new instance of FileSystemApi.



19
20
21
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_folder(path, mode, opts = {}) ⇒ nil

Create a folder Create a folder with the specified path and optional permissions

Parameters:

  • path (String)

    Folder path to create

  • mode (String)

    Octal permission mode (default: 0755)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


28
29
30
31
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 28

def create_folder(path, mode, opts = {})
  create_folder_with_http_info(path, mode, opts)
  nil
end

#create_folder_with_http_info(path, mode, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Create a folder Create a folder with the specified path and optional permissions

Parameters:

  • path (String)

    Folder path to create

  • mode (String)

    Octal permission mode (default: 0755)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 39

def create_folder_with_http_info(path, mode, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSystemApi.create_folder ...'
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.create_folder"
  end
  # verify the required parameter 'mode' is set
  if @api_client.config.client_side_validation && mode.nil?
    fail ArgumentError, "Missing the required parameter 'mode' when calling FileSystemApi.create_folder"
  end
  # resource path
  local_var_path = '/files/folder'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'path'] = path
  query_params[:'mode'] = mode

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"FileSystemApi.create_folder",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSystemApi#create_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_file(path, opts = {}) ⇒ nil

Delete a file or directory Delete a file or directory at the specified path

Parameters:

  • path (String)

    File or directory path to delete

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :recursive (Boolean)

    Enable recursive deletion for directories

Returns:

  • (nil)


99
100
101
102
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 99

def delete_file(path, opts = {})
  delete_file_with_http_info(path, opts)
  nil
end

#delete_file_with_http_info(path, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a file or directory Delete a file or directory at the specified path

Parameters:

  • path (String)

    File or directory path to delete

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :recursive (Boolean)

    Enable recursive deletion for directories

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 110

def delete_file_with_http_info(path, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSystemApi.delete_file ...'
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.delete_file"
  end
  # resource path
  local_var_path = '/files'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'path'] = path
  query_params[:'recursive'] = opts[:'recursive'] if !opts[:'recursive'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"FileSystemApi.delete_file",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSystemApi#delete_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#download_file(path, opts = {}) ⇒ File

Download a file Download a file by providing its path

Parameters:

  • path (String)

    File path to download

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (File)


165
166
167
168
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 165

def download_file(path, opts = {})
  data, _status_code, _headers = download_file_with_http_info(path, opts)
  data
end

#download_file_with_http_info(path, opts = {}) ⇒ Array<(File, Integer, Hash)>

Download a file Download a file by providing its path

Parameters:

  • path (String)

    File path to download

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(File, Integer, Hash)>)

    File data, response status code and response headers



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 175

def download_file_with_http_info(path, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSystemApi.download_file ...'
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.download_file"
  end
  # resource path
  local_var_path = '/files/download'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'path'] = path

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'File'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"FileSystemApi.download_file",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSystemApi#download_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#download_files(download_files, opts = {}) ⇒ Hash<String, Object>

Download multiple files Download multiple files by providing their paths. Successful files are returned as multipart parts named ‘file`. Per-file failures are returned as multipart parts named `error` with JSON payloads shaped like ErrorResponse.

Parameters:

  • download_files (FilesDownloadRequest)

    Paths of files to download

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


229
230
231
232
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 229

def download_files(download_files, opts = {})
  data, _status_code, _headers = download_files_with_http_info(download_files, opts)
  data
end

#download_files_with_http_info(download_files, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Download multiple files Download multiple files by providing their paths. Successful files are returned as multipart parts named &#x60;file&#x60;. Per-file failures are returned as multipart parts named &#x60;error&#x60; with JSON payloads shaped like ErrorResponse.

Parameters:

  • download_files (FilesDownloadRequest)

    Paths of files to download

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 239

def download_files_with_http_info(download_files, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSystemApi.download_files ...'
  end
  # verify the required parameter 'download_files' is set
  if @api_client.config.client_side_validation && download_files.nil?
    fail ArgumentError, "Missing the required parameter 'download_files' when calling FileSystemApi.download_files"
  end
  # resource path
  local_var_path = '/files/bulk-download'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(download_files)

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"FileSystemApi.download_files",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSystemApi#download_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#find_in_files(path, pattern, opts = {}) ⇒ Array<Match>

Find text in files Search for text pattern within files in a directory

Parameters:

  • path (String)

    Directory path to search in

  • pattern (String)

    Text pattern to search for

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



298
299
300
301
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 298

def find_in_files(path, pattern, opts = {})
  data, _status_code, _headers = find_in_files_with_http_info(path, pattern, opts)
  data
end

#find_in_files_with_http_info(path, pattern, opts = {}) ⇒ Array<(Array<Match>, Integer, Hash)>

Find text in files Search for text pattern within files in a directory

Parameters:

  • path (String)

    Directory path to search in

  • pattern (String)

    Text pattern to search for

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Array<Match>, Integer, Hash)>)

    Array<Match> data, response status code and response headers



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 309

def find_in_files_with_http_info(path, pattern, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSystemApi.find_in_files ...'
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.find_in_files"
  end
  # verify the required parameter 'pattern' is set
  if @api_client.config.client_side_validation && pattern.nil?
    fail ArgumentError, "Missing the required parameter 'pattern' when calling FileSystemApi.find_in_files"
  end
  # resource path
  local_var_path = '/files/find'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'path'] = path
  query_params[:'pattern'] = pattern

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<Match>'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"FileSystemApi.find_in_files",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSystemApi#find_in_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_file_info(path, opts = {}) ⇒ FileInfo

Get file information Get detailed information about a file or directory

Parameters:

  • path (String)

    File or directory path

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



368
369
370
371
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 368

def get_file_info(path, opts = {})
  data, _status_code, _headers = get_file_info_with_http_info(path, opts)
  data
end

#get_file_info_with_http_info(path, opts = {}) ⇒ Array<(FileInfo, Integer, Hash)>

Get file information Get detailed information about a file or directory

Parameters:

  • path (String)

    File or directory path

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FileInfo, Integer, Hash)>)

    FileInfo data, response status code and response headers



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 378

def get_file_info_with_http_info(path, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSystemApi.get_file_info ...'
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.get_file_info"
  end
  # resource path
  local_var_path = '/files/info'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'path'] = path

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FileInfo'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"FileSystemApi.get_file_info",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSystemApi#get_file_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_files(opts = {}) ⇒ Array<FileInfo>

List files and directories List files and directories in the specified path

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :path (String)

    Directory path to list (defaults to working directory)

Returns:



432
433
434
435
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 432

def list_files(opts = {})
  data, _status_code, _headers = list_files_with_http_info(opts)
  data
end

#list_files_with_http_info(opts = {}) ⇒ Array<(Array<FileInfo>, Integer, Hash)>

List files and directories List files and directories in the specified path

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :path (String)

    Directory path to list (defaults to working directory)

Returns:

  • (Array<(Array<FileInfo>, Integer, Hash)>)

    Array<FileInfo> data, response status code and response headers



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 442

def list_files_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSystemApi.list_files ...'
  end
  # resource path
  local_var_path = '/files'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'path'] = opts[:'path'] if !opts[:'path'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<FileInfo>'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"FileSystemApi.list_files",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSystemApi#list_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#move_file(source, destination, opts = {}) ⇒ nil

Move or rename file/directory Move or rename a file or directory from source to destination

Parameters:

  • source (String)

    Source file or directory path

  • destination (String)

    Destination file or directory path

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


493
494
495
496
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 493

def move_file(source, destination, opts = {})
  move_file_with_http_info(source, destination, opts)
  nil
end

#move_file_with_http_info(source, destination, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Move or rename file/directory Move or rename a file or directory from source to destination

Parameters:

  • source (String)

    Source file or directory path

  • destination (String)

    Destination file or directory path

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 504

def move_file_with_http_info(source, destination, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSystemApi.move_file ...'
  end
  # verify the required parameter 'source' is set
  if @api_client.config.client_side_validation && source.nil?
    fail ArgumentError, "Missing the required parameter 'source' when calling FileSystemApi.move_file"
  end
  # verify the required parameter 'destination' is set
  if @api_client.config.client_side_validation && destination.nil?
    fail ArgumentError, "Missing the required parameter 'destination' when calling FileSystemApi.move_file"
  end
  # resource path
  local_var_path = '/files/move'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'source'] = source
  query_params[:'destination'] = destination

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"FileSystemApi.move_file",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSystemApi#move_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#replace_in_files(request, opts = {}) ⇒ Array<ReplaceResult>

Replace text in files Replace text pattern with new value in multiple files

Parameters:

  • request (ReplaceRequest)

    Replace request

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



563
564
565
566
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 563

def replace_in_files(request, opts = {})
  data, _status_code, _headers = replace_in_files_with_http_info(request, opts)
  data
end

#replace_in_files_with_http_info(request, opts = {}) ⇒ Array<(Array<ReplaceResult>, Integer, Hash)>

Replace text in files Replace text pattern with new value in multiple files

Parameters:

  • request (ReplaceRequest)

    Replace request

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Array<ReplaceResult>, Integer, Hash)>)

    Array<ReplaceResult> data, response status code and response headers



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 573

def replace_in_files_with_http_info(request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSystemApi.replace_in_files ...'
  end
  # verify the required parameter 'request' is set
  if @api_client.config.client_side_validation && request.nil?
    fail ArgumentError, "Missing the required parameter 'request' when calling FileSystemApi.replace_in_files"
  end
  # resource path
  local_var_path = '/files/replace'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(request)

  # return_type
  return_type = opts[:debug_return_type] || 'Array<ReplaceResult>'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"FileSystemApi.replace_in_files",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSystemApi#replace_in_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_files(path, pattern, opts = {}) ⇒ SearchFilesResponse

Search files by pattern Search for files matching a specific pattern in a directory

Parameters:

  • path (String)

    Directory path to search in

  • pattern (String)

    File pattern to match (e.g., *.txt, *.go)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



632
633
634
635
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 632

def search_files(path, pattern, opts = {})
  data, _status_code, _headers = search_files_with_http_info(path, pattern, opts)
  data
end

#search_files_with_http_info(path, pattern, opts = {}) ⇒ Array<(SearchFilesResponse, Integer, Hash)>

Search files by pattern Search for files matching a specific pattern in a directory

Parameters:

  • path (String)

    Directory path to search in

  • pattern (String)

    File pattern to match (e.g., *.txt, *.go)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(SearchFilesResponse, Integer, Hash)>)

    SearchFilesResponse data, response status code and response headers



643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 643

def search_files_with_http_info(path, pattern, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSystemApi.search_files ...'
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.search_files"
  end
  # verify the required parameter 'pattern' is set
  if @api_client.config.client_side_validation && pattern.nil?
    fail ArgumentError, "Missing the required parameter 'pattern' when calling FileSystemApi.search_files"
  end
  # resource path
  local_var_path = '/files/search'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'path'] = path
  query_params[:'pattern'] = pattern

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SearchFilesResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"FileSystemApi.search_files",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSystemApi#search_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#set_file_permissions(path, opts = {}) ⇒ nil

Set file permissions Set file permissions, ownership, and group for a file or directory

Parameters:

  • path (String)

    File or directory path

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :owner (String)

    Owner (username or UID)

  • :group (String)

    Group (group name or GID)

  • :mode (String)

    File mode in octal format (e.g., 0755)

Returns:

  • (nil)


705
706
707
708
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 705

def set_file_permissions(path, opts = {})
  set_file_permissions_with_http_info(path, opts)
  nil
end

#set_file_permissions_with_http_info(path, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Set file permissions Set file permissions, ownership, and group for a file or directory

Parameters:

  • path (String)

    File or directory path

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :owner (String)

    Owner (username or UID)

  • :group (String)

    Group (group name or GID)

  • :mode (String)

    File mode in octal format (e.g., 0755)

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 718

def set_file_permissions_with_http_info(path, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSystemApi.set_file_permissions ...'
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.set_file_permissions"
  end
  # resource path
  local_var_path = '/files/permissions'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'path'] = path
  query_params[:'owner'] = opts[:'owner'] if !opts[:'owner'].nil?
  query_params[:'group'] = opts[:'group'] if !opts[:'group'].nil?
  query_params[:'mode'] = opts[:'mode'] if !opts[:'mode'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"FileSystemApi.set_file_permissions",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSystemApi#set_file_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upload_file(path, file, opts = {}) ⇒ Hash<String, Object>

Upload a file Upload a file to the specified path

Parameters:

  • path (String)

    Destination path for the uploaded file

  • file (File)

    File to upload

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Hash<String, Object>)


776
777
778
779
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 776

def upload_file(path, file, opts = {})
  data, _status_code, _headers = upload_file_with_http_info(path, file, opts)
  data
end

#upload_file_with_http_info(path, file, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>

Upload a file Upload a file to the specified path

Parameters:

  • path (String)

    Destination path for the uploaded file

  • file (File)

    File to upload

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Hash<String, Object>, Integer, Hash)>)

    Hash<String, Object> data, response status code and response headers



787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 787

def upload_file_with_http_info(path, file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSystemApi.upload_file ...'
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.upload_file"
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling FileSystemApi.upload_file"
  end
  # resource path
  local_var_path = '/files/upload'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'path'] = path

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = file

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Hash<String, Object>'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"FileSystemApi.upload_file",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSystemApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upload_files(opts = {}) ⇒ nil

Upload multiple files Upload multiple files with their destination paths

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


850
851
852
853
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 850

def upload_files(opts = {})
  upload_files_with_http_info(opts)
  nil
end

#upload_files_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>

Upload multiple files Upload multiple files with their destination paths

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
# File 'lib/daytona_toolbox_api_client/api/file_system_api.rb', line 859

def upload_files_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSystemApi.upload_files ...'
  end
  # resource path
  local_var_path = '/files/bulk-upload'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"FileSystemApi.upload_files",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSystemApi#upload_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end