1

I'm quite not able to understand GmailApi documentation for dart. I've implemented

import 'package:googleapis/gmail/v1.dart' as gapi;
Future <gapi.ListLabelsResponse> gmailProfile() async{
  final userProfile = await gapi.GmailApi(httpClient).users.labels.list(
    uid, //this is firebase auth user id
   //$fields expected
  );
  return userProfile;
}

reading from https://pub.dev/documentation/googleapis/latest/googleapis.gmail.v1/UsersLabelsResourceApi/list.html but as list expects 2 arguments where second is $fields, I don't understand what to put there.

Similarly what would it be for

Future <gapi.ListLabelsResponse> gmailProfile() async{
  final userTrash = await gapi.GmailApi(httpClient).users.labels.list(
    uid,
    //id expected which I'm asssuming is gonna be mail's/message's id
    //$fields expected same as above
  );
  return userTrash;
}

Please go easy on me. As there are no practical examples of GoogleApis for dart, I'm implementing everything reading the documentation which is hard to understand.

codekls
  • 149
  • 4
  • 16
  • Hi ! From [the documentation on labels list](https://developers.google.com/gmail/api/v1/reference/users/labels/list#python) I can tell the only required parameter is the user id, thus, fields is optional. Fields is usually used in the requests to filter the response (for example looking for specific labels and so on) fields would refer to the fields of the JSON response object you want to retrieve. **Have you tried running this without specifying fields** i.e just with one parameter ? – Mateo Randwolf May 25 '20 at 11:00

0 Answers0