File Comments

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

List File Comments by Path

SDK Method

FileComment.ListFor();

Return Object

FilesList<FileComment>

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

ArgumentDescription
path
string
Required
Path to operate on.

Additional Arguments

Example Request

using FilesCom.Models;

try
{
    var fileCommentIterator = FileComment.ListFor(path);
    foreach (FileComment fileComment in fileCommentIterator.ListAutoPaging()) {
        // Operate on fileComment
    }
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Create File Comment

SDK Method

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

using FilesCom.Models;

var parameters = new Dictionary<string, object>();
parameters.Add("body", "What a great file!");
parameters.Add("path", "path");

try
{
    var fileComment = await FileComment.Create(parameters);
    // Operate on fileComment
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Update File Comment

SDK Method

fileComment.Update();

Return Object

FileComment

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

ArgumentDescription
body
string
Required
Comment body.

Example Request

using FilesCom.Models;

var parameters = new Dictionary<string, object>();
parameters.Add("body", "What a great file!");

try
{
    var fileComment = (await FileComment.List())[0];
    await fileComment.Update(parameters);
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

Delete File Comment

SDK Method

fileComment.Delete();

Return Object

No return value.

Authorization Requirement

Available to all authenticated keys or sessions.

Example Request

using FilesCom.Models;

try
{
    var fileComment = (await FileComment.List())[0];
    await fileComment.Delete();
}
catch (FilesCom.NotAuthenticatedException e)
{
    Console.WriteLine($"Authentication Error Occurred ({e.GetType().Name}): " + e.Message);
}
catch (FilesCom.SdkException e)
{
    Console.WriteLine($"Unknown Error Occurred ({e.GetType().Name}): " + e.Message);
}

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.