google-api-nodejs-client icon indicating copy to clipboard operation
google-api-nodejs-client copied to clipboard

GMail users.messages.list ignores labels when sent as an array

Open angelxmoreno opened this issue 2 years ago • 0 comments

Environment details

  • OS: mac
  • Node.js version: v14.17.0
  • npm version: 6.14.13
  • googleapis version: ^100.0.0

Steps to reproduce

const optionsA = {
    userId: 'me',
}

const optionsB = {
    userId: 'me',
    labelIds: ['SENT']
}

const optionsC = {
    userId: 'me',
    labelIds: 'SENT'
}

gmailClient.users.messages.list(optionsA); // --> returns messages
gmailClient.users.messages.list(optionsB); // --> returns the same messages as optionsA
gmailClient.users.messages.list(optionsC); // --> returns messages with the label 'SENT'

The params for list state that labelIds is an array:

export interface Params$Resource$Users$Messages$List extends StandardParameters {
        /**
         * Only return messages with labels that match all of the specified label IDs.
         */
        labelIds?: string[];
}

Not sure if this is a documentation + TS Definition issue or something deeper

angelxmoreno avatar May 03 '22 06:05 angelxmoreno