Lists the replies for a particular comment on a file. The file is specified by file ID. This example lists replies for comment (id="AAAABg7tSGw") on the file having id = "0B5drHSd5ZHwgc3RhcnRlcl9maWxlX2Rhc2hlclYw".
// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;
import android.app.Activity;
import com.chilkatsoft.*;
import android.widget.TextView;
import android.os.Bundle;
public class SimpleActivity extends Activity {
private static final String TAG = "Chilkat";
// Called when the activity is first created.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CkRest rest = new CkRest();
boolean success;
// Provide a previously obtained OAuth2 access token.
CkOAuth2 oauth2 = new CkOAuth2();
oauth2.put_AccessToken("OAUTH2_ACCESS_TOKEN");
rest.SetAuthOAuth2(oauth2);
success = rest.Connect("www.googleapis.com",443,true,true);
if (success != true) {
Log.i(TAG, rest.lastErrorText());
return;
}
rest.AddQueryParam("fields","replies");
CkStringBuilder sbJson = new CkStringBuilder();
success = rest.FullRequestNoBodySb("GET","/drive/v3/files/0B5drHSd5ZHwgc3RhcnRlcl9maWxlX2Rhc2hlclYw/comments/AAAABg7tSGw/replies",sbJson);
if (success != true) {
Log.i(TAG, rest.lastErrorText());
return;
}
if (rest.get_ResponseStatusCode() != 200) {
Log.i(TAG, "Received error response code: " + String.valueOf(rest.get_ResponseStatusCode()));
Log.i(TAG, "Response body:");
Log.i(TAG, sbJson.getAsString());
return;
}
CkJsonObject json = new CkJsonObject();
json.LoadSb(sbJson);
// The following code parses the JSON response.
// A sample JSON response is shown below the sample code.
int i;
int count_i;
String kind;
String id;
String createdTime;
String modifiedTime;
String authorKind;
String authorDisplayName;
String authorPhotoLink;
boolean authorMe;
String htmlContent;
String content;
boolean deleted;
String action;
i = 0;
count_i = json.SizeOfArray("replies");
while (i < count_i) {
json.put_I(i);
kind = json.stringOf("replies[i].kind");
id = json.stringOf("replies[i].id");
createdTime = json.stringOf("replies[i].createdTime");
modifiedTime = json.stringOf("replies[i].modifiedTime");
authorKind = json.stringOf("replies[i].author.kind");
authorDisplayName = json.stringOf("replies[i].author.displayName");
authorPhotoLink = json.stringOf("replies[i].author.photoLink");
authorMe = json.BoolOf("replies[i].author.me");
htmlContent = json.stringOf("replies[i].htmlContent");
content = json.stringOf("replies[i].content");
deleted = json.BoolOf("replies[i].deleted");
action = json.stringOf("replies[i].action");
i = i + 1;
}
Log.i(TAG, "Example Completed.");
}
static {
System.loadLibrary("chilkat");
// Note: If the incorrect library name is passed to System.loadLibrary,
// then you will see the following error message at application startup:
//"The application <your-application-name> has stopped unexpectedly. Please try again."
}
}
{
"replies": [
{
"kind": "drive#reply",
"id": "AAAABg76H9g",
"createdTime": "2017-11-13T18:24:12.782Z",
"modifiedTime": "2017-11-13T18:24:12.782Z",
"author": {
"kind": "drive#user",
"displayName": "Matt Fausey",
"photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
"me": true
},
"htmlContent": "This is the first reply to a comment.",
"content": "This is the first reply to a comment.",
"deleted": false,
"action": "reopen"
},
{
"kind": "drive#reply",
"id": "AAAABg76H9k",
"createdTime": "2017-11-13T18:24:45.085Z",
"modifiedTime": "2017-11-13T18:24:45.085Z",
"author": {
"kind": "drive#user",
"displayName": "Matt Fausey",
"photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
"me": true
},
"htmlContent": "This is the second reply to a comment.",
"content": "This is the second reply to a comment.",
"deleted": false,
"action": "resolve"
},
{
"kind": "drive#reply",
"id": "AAAABg76H9o",
"createdTime": "2017-11-13T18:25:11.828Z",
"modifiedTime": "2017-11-13T18:25:11.828Z",
"author": {
"kind": "drive#user",
"displayName": "Matt Fausey",
"photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
"me": true
},
"htmlContent": "This is the third reply to a comment.",
"content": "This is the third reply to a comment.",
"deleted": false,
"action": "resolve"
}
]
}