File Comments

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

List File Comments by Path

SDK Function

FileComment.listFor()

Return Object

ListIterator<FileComment>

Authorization Requirement

Available to all authenticated keys or sessions.

Function Arguments

ArgumentDescription
path
string
Required
Path to operate on.

Additional Arguments

Example Request

import com.files.ListIterator;
import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.FileComment;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  ListIterator<FileComment> fileComments = FileComment.listFor(path, parameters);
  for (FileComment fileComment : fileComments.listAutoPaging()) {
    // Operate on fileComment
  }
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Create File Comment

SDK Function

FileComment.create()

Return Object

FileComment

Authorization Requirement

Available to all authenticated keys or sessions.

Function Arguments

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

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.FileComment;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("body", "What a great file!");
  parameters.put("path", "path");
  
  FileComment fileComment = FileComment.create(parameters);
  // Operate on fileComment
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Update File Comment

SDK Function

fileComment.update();

Return Object

FileComment

Authorization Requirement

Available to all authenticated keys or sessions.

Attribute Setters

SetterDescription
setBody
string
Required
Comment body.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.FileComment;

try {
  FileComment fileComment = FileComment.list()[0];
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("body", "What a great file!");
  fileComment.update(parameters);
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Delete File Comment

SDK Function

fileComment.delete();

Return Object

No return value.

Authorization Requirement

Available to all authenticated keys or sessions.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.FileComment;

try {
  FileComment fileComment = FileComment.list()[0];
  fileComment.delete(null);
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

The FileComment Object

Some of the functions 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.