File Comments

A FileComment is a comment attached to a file by a user.

List File Comments by Path

SDK Method

Files::FileComment.list_for

Return Object

List<FileComment>

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

ArgumentDescription
path
string
Required
Path to operate on.

Additional Arguments

Example Request

begin
  file_comments = Files::FileComment.list_for(path)
  file_comments.auto_paging_each do |file_comment|
    # Operate on file_comment
  end
rescue Files::NotAuthenticatedError => e
  puts "Authentication Error Occurred (#{e.class.to_s}): " + e.message
rescue Files::Error => e
  puts "Unknown Error Occurred (#{e.class.to_s}): " + e.message
end

Create File Comment

SDK Method

Files::FileComment.create

Return Object

FileComment

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

ArgumentDescription
body
string
Required
Comment body.
path
string
Required
File path.

Example Request

begin
  file_comment = Files::FileComment.create(
    body: "What a great file!",
    path: "path"
  )
  # Operate on file_comment
rescue Files::NotAuthenticatedError => e
  puts "Authentication Error Occurred (#{e.class.to_s}): " + e.message
rescue Files::Error => e
  puts "Unknown Error Occurred (#{e.class.to_s}): " + e.message
end

Update File Comment

SDK Method

file_comment.update

Return Object

FileComment

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

ArgumentDescription
body
string
Required
Comment body.

Example Request

begin
  file_comment = Files::FileComment.list.first
  file_comment.update(
    body: "What a great file!"
  )
rescue Files::NotAuthenticatedError => e
  puts "Authentication Error Occurred (#{e.class.to_s}): " + e.message
rescue Files::Error => e
  puts "Unknown Error Occurred (#{e.class.to_s}): " + e.message
end

Delete File Comment

SDK Method

file_comment.delete

Return Object

nil

Authorization Requirement

Available to all authenticated keys or sessions.

Example Request

begin
  file_comment = Files::FileComment.list.first
  file_comment.delete
rescue Files::NotAuthenticatedError => e
  puts "Authentication Error Occurred (#{e.class.to_s}): " + e.message
rescue Files::Error => e
  puts "Unknown Error Occurred (#{e.class.to_s}): " + e.message
end

The FileComment Object

Some of the methods above return a FileComment object. The attributes of this object are listed below.

AttributeDescription
id
int64
File Comment ID
body
string
Comment body.
reactions
array(object)
Reactions to this comment.